From 6b14ecfdf9454af76d98eab3e897a033bcd112fc Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Wed, 16 Aug 2023 16:26:21 +0100 Subject: [PATCH] Re-key all |zero-pluralised translations for Localazy compatibility (#11417) * Re-key all |zero-pluralised translations for Localazy compatibility * Add missing interpolation variable * i18n * Add test coverage * Improve coverage --- src/components/structures/UploadBar.tsx | 17 +++-- .../dialogs/devtools/RoomNotifications.tsx | 30 ++++++--- .../views/dialogs/devtools/RoomState.tsx | 7 ++- src/i18n/strings/bg.json | 2 +- src/i18n/strings/ca.json | 2 +- src/i18n/strings/cs.json | 7 +-- src/i18n/strings/da.json | 1 - src/i18n/strings/de_DE.json | 9 ++- src/i18n/strings/el.json | 5 +- src/i18n/strings/en_EN.json | 9 ++- src/i18n/strings/en_US.json | 2 +- src/i18n/strings/eo.json | 5 +- src/i18n/strings/es.json | 7 +-- src/i18n/strings/et.json | 9 ++- src/i18n/strings/eu.json | 2 +- src/i18n/strings/fa.json | 5 +- src/i18n/strings/fi.json | 5 +- src/i18n/strings/fr.json | 9 ++- src/i18n/strings/gl.json | 7 +-- src/i18n/strings/he.json | 7 +-- src/i18n/strings/hu.json | 9 ++- src/i18n/strings/id.json | 9 ++- src/i18n/strings/is.json | 7 +-- src/i18n/strings/it.json | 9 ++- src/i18n/strings/ja.json | 7 +-- src/i18n/strings/kab.json | 2 +- src/i18n/strings/ko.json | 2 +- src/i18n/strings/lo.json | 5 +- src/i18n/strings/lt.json | 2 +- src/i18n/strings/lv.json | 2 +- src/i18n/strings/nb_NO.json | 2 +- src/i18n/strings/nl.json | 7 +-- src/i18n/strings/nn.json | 2 +- src/i18n/strings/pl.json | 9 ++- src/i18n/strings/pt.json | 2 +- src/i18n/strings/pt_BR.json | 5 +- src/i18n/strings/ru.json | 7 +-- src/i18n/strings/sk.json | 9 ++- src/i18n/strings/sq.json | 9 ++- src/i18n/strings/sr.json | 2 +- src/i18n/strings/sv.json | 9 ++- src/i18n/strings/th.json | 2 +- src/i18n/strings/tr.json | 2 +- src/i18n/strings/uk.json | 9 ++- src/i18n/strings/vi.json | 7 +-- src/i18n/strings/vls.json | 2 +- src/i18n/strings/zh_Hans.json | 7 +-- src/i18n/strings/zh_Hant.json | 9 ++- src/utils/i18n-helpers.ts | 12 +++- test/components/structures/UploadBar-test.tsx | 52 ++++++++++++++++ test/utils/i18n-helpers-test.ts | 62 +++++++++++++++++++ 51 files changed, 270 insertions(+), 158 deletions(-) create mode 100644 test/components/structures/UploadBar-test.tsx create mode 100644 test/utils/i18n-helpers-test.ts diff --git a/src/components/structures/UploadBar.tsx b/src/components/structures/UploadBar.tsx index 9424b23b06..98e356be2c 100644 --- a/src/components/structures/UploadBar.tsx +++ b/src/components/structures/UploadBar.tsx @@ -107,11 +107,18 @@ export default class UploadBar extends React.PureComponent { return null; } - // MUST use var name 'count' for pluralization to kick in - const uploadText = _t("Uploading %(filename)s and %(count)s others", { - filename: this.state.currentFile, - count: this.state.countFiles - 1, - }); + let uploadText: string; + if (this.state.countFiles > 1) { + // MUST use var name 'count' for pluralization to kick in + uploadText = _t("Uploading %(filename)s and %(count)s others", { + filename: this.state.currentFile, + count: this.state.countFiles - 1, + }); + } else { + uploadText = _t("Uploading %(filename)s", { + filename: this.state.currentFile, + }); + } const uploadSize = fileSize(this.state.currentTotal!); return ( diff --git a/src/components/views/dialogs/devtools/RoomNotifications.tsx b/src/components/views/dialogs/devtools/RoomNotifications.tsx index cbb0f3c0a6..d7a2ad253d 100644 --- a/src/components/views/dialogs/devtools/RoomNotifications.tsx +++ b/src/components/views/dialogs/devtools/RoomNotifications.tsx @@ -76,16 +76,26 @@ export default function RoomNotifications({ onBack }: IDevtoolsProps): JSX.Eleme

{_t("Room status")}