From 704ed0fc7b77b1086d2819072a9bdaad714a28b0 Mon Sep 17 00:00:00 2001 From: Yash Rajpal <58601732+yash-rajpal@users.noreply.github.com> Date: Thu, 19 Oct 2023 22:44:31 +0530 Subject: [PATCH] fix: i18n translations using sprintf post processor (#30685) --- .changeset/perfect-onions-develop.md | 5 +++++ apps/meteor/app/utils/lib/i18n.ts | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .changeset/perfect-onions-develop.md diff --git a/.changeset/perfect-onions-develop.md b/.changeset/perfect-onions-develop.md new file mode 100644 index 000000000000..3ca5c3e00bb7 --- /dev/null +++ b/.changeset/perfect-onions-develop.md @@ -0,0 +1,5 @@ +--- +'@rocket.chat/meteor': patch +--- + +Fix i18n translations using sprintf post processor diff --git a/apps/meteor/app/utils/lib/i18n.ts b/apps/meteor/app/utils/lib/i18n.ts index 13d5c667709d..7fa491d965e8 100644 --- a/apps/meteor/app/utils/lib/i18n.ts +++ b/apps/meteor/app/utils/lib/i18n.ts @@ -7,7 +7,7 @@ export const i18n = i18next.use(sprintf); export const addSprinfToI18n = function (t: (typeof i18n)['t']) { return function (key: string, ...replaces: any): string { - if (replaces[0] === undefined || isObject(replaces[0])) { + if (replaces[0] === undefined || (isObject(replaces[0]) && !Array.isArray(replaces[0]))) { return t(key, ...replaces); }