diff --git a/i18next-parser.config.js b/i18next-parser.config.ts similarity index 65% rename from i18next-parser.config.js rename to i18next-parser.config.ts index e5c992516..a92d9fbc3 100644 --- a/i18next-parser.config.js +++ b/i18next-parser.config.ts @@ -2,7 +2,7 @@ export default { keySeparator: false, namespaceSeparator: false, contextSeparator: "|", - pluralSeparator: "|", + pluralSeparator: "_", createOldCatalogs: false, defaultNamespace: "app", lexers: { @@ -10,7 +10,14 @@ export default { { lexer: "JavascriptLexer", functions: ["t", "translatedError"], - functionsNamespace: ["useTranslation", "withTranslation"], + namespaceFunctions: ["useTranslation", "withTranslation"], + }, + ], + tsx: [ + { + lexer: "JsxLexer", + functions: ["t", "translatedError"], + namespaceFunctions: ["useTranslation", "withTranslation"], }, ], }, diff --git a/public/locales/de/app.json b/public/locales/de/app.json index c1af5e46d..26b9075ba 100644 --- a/public/locales/de/app.json +++ b/public/locales/de/app.json @@ -72,11 +72,11 @@ "Thanks, we received your feedback!": "Danke, wir haben deine Rückmeldung erhalten!", "Submitting…": "Sende …", "Submit": "Absenden", - "{{count}} stars|other": "{{count}} Sterne", + "{{count}} stars_other": "{{count}} Sterne", "{{displayName}}, your call has ended.": "{{displayName}}, dein Anruf wurde beendet.", "<0>We'd love to hear your feedback so we can improve your experience.": "<0>Wir würden uns freuen, deine Rückmeldung zu hören, um deine Erfahrung verbessern zu können.", "How did it go?": "Wie ist es gelaufen?", - "{{count}} stars|one": "{{count}} Stern", + "{{count}} stars_one": "{{count}} Stern", "<0>Thanks for your feedback!": "<0>Danke für deine Rückmeldung!", "{{displayName}} is presenting": "{{displayName}} präsentiert", "Show connection stats": "Verbindungsstatistiken zeigen", @@ -94,8 +94,8 @@ "Not encrypted": "Nicht verschlüsselt", "Microphone off": "Mikrofon aus", "Microphone on": "Mikrofon an", - "{{count, number}}|one": "{{count, number}}", - "{{count, number}}|other": "{{count, number}}", + "{{count, number}}_one": "{{count, number}}", + "{{count, number}}_other": "{{count, number}}", "Sharing screen": "Bildschirm wird geteilt", "You": "Du", "Continue in browser": "Weiter im Browser", diff --git a/public/locales/el/app.json b/public/locales/el/app.json index c64f1a295..3eae224ad 100644 --- a/public/locales/el/app.json +++ b/public/locales/el/app.json @@ -67,8 +67,8 @@ "Feedback": "Ανατροφοδότηση", "Submitting…": "Υποβολή…", "Thanks, we received your feedback!": "Ευχαριστούμε, λάβαμε τα σχόλιά σας!", - "{{count}} stars|other": "{{count}} αστέρια", - "{{count}} stars|one": "{{count}} αστέρι", + "{{count}} stars_other": "{{count}} αστέρια", + "{{count}} stars_one": "{{count}} αστέρι", "{{displayName}}, your call has ended.": "{{displayName}}, η κλήση σας τερματίστηκε.", "<0>Submitting debug logs will help us track down the problem.": "<0>Η υποβολή αρχείων καταγραφής σφαλμάτων θα μας βοηθήσει να εντοπίσουμε το πρόβλημα.", "How did it go?": "Πώς σας φάνηκε;", diff --git a/public/locales/en-GB/app.json b/public/locales/en-GB/app.json index b09179e18..3e4701370 100644 --- a/public/locales/en-GB/app.json +++ b/public/locales/en-GB/app.json @@ -1,8 +1,8 @@ { - "{{count, number}}|one": "{{count, number}}", - "{{count, number}}|other": "{{count, number}}", - "{{count}} stars|one": "{{count}} stars", - "{{count}} stars|other": "{{count}} stars", + "{{count, number}}_one": "{{count, number}}", + "{{count, number}}_other": "{{count, number}}", + "{{count}} stars_one": "{{count}} stars", + "{{count}} stars_other": "{{count}} stars", "{{displayName}} is presenting": "{{displayName}} is presenting", "{{displayName}}, your call has ended.": "{{displayName}}, your call has ended.", "<0><1>You may withdraw consent by unchecking this box. If you are currently in a call, this setting will take effect at the end of the call.": "<0><1>You may withdraw consent by unchecking this box. If you are currently in a call, this setting will take effect at the end of the call.", @@ -104,6 +104,7 @@ "Submitting…": "Submitting…", "Thanks, we received your feedback!": "Thanks, we received your feedback!", "Thanks!": "Thanks!", + "This application has been opened in another tab.": "This application has been opened in another tab.", "This call already exists, would you like to join?": "This call already exists, would you like to join?", "This site is protected by ReCAPTCHA and the Google <2>Privacy Policy and <6>Terms of Service apply.<9>By clicking \"Register\", you agree to our <12>End User Licensing Agreement (EULA)": "This site is protected by ReCAPTCHA and the Google <2>Privacy Policy and <6>Terms of Service apply.<9>By clicking \"Register\", you agree to our <12>End User Licensing Agreement (EULA)", "Unmute microphone": "Unmute microphone", diff --git a/public/locales/es/app.json b/public/locales/es/app.json index 34073c5d4..994ff3915 100644 --- a/public/locales/es/app.json +++ b/public/locales/es/app.json @@ -78,8 +78,8 @@ "<0>We'd love to hear your feedback so we can improve your experience.": "<0>Nos encantaría conocer tu opinión para que podamos mejorar tu experiencia", "Feedback": "Danos tu opinión", "Submit": "Enviar", - "{{count}} stars|one": "{{count}} estrella", - "{{count}} stars|other": "{{count}} estrellas", + "{{count}} stars_one": "{{count}} estrella", + "{{count}} stars_other": "{{count}} estrellas", "{{displayName}}, your call has ended.": "{{displayName}}, tu llamada ha finalizado.", "Submitting…": "Enviando…", "Your feedback": "Tus comentarios" diff --git a/public/locales/et/app.json b/public/locales/et/app.json index b58e4d4cb..63b6208a6 100644 --- a/public/locales/et/app.json +++ b/public/locales/et/app.json @@ -72,8 +72,8 @@ "Submit": "Saada", "If you are experiencing issues or simply would like to provide some feedback, please send us a short description below.": "Kui selle rakenduse kasutamisel tekib sul probleeme või lihtsalt soovid oma arvamust avaldada, siis palun täida alljärgnev lühike kirjeldus.", "Feedback": "Tagasiside", - "{{count}} stars|one": "{{count}} tärni", - "{{count}} stars|other": "{{count}} tärni", + "{{count}} stars_one": "{{count}} tärni", + "{{count}} stars_other": "{{count}} tärni", "How did it go?": "Kuidas sujus?", "{{displayName}}, your call has ended.": "{{displayName}}, sinu kõne on lõppenud.", "<0>Thanks for your feedback!": "<0>Täname Sind tagasiside eest!", @@ -95,8 +95,8 @@ "Microphone on": "Mikrofon töötab", "Not encrypted": "Krüptimata", "Sharing screen": "Ekraanivaade on jagamisel", - "{{count, number}}|one": "{{count, number}}", - "{{count, number}}|other": "{{count, number}}", + "{{count, number}}_one": "{{count, number}}", + "{{count, number}}_other": "{{count, number}}", "You": "Sina", "Continue in browser": "Jätka veebibrauseris", "Mute microphone": "Summuta mikrofon", diff --git a/public/locales/fr/app.json b/public/locales/fr/app.json index 7ad931bd9..4abf4589e 100644 --- a/public/locales/fr/app.json +++ b/public/locales/fr/app.json @@ -72,9 +72,9 @@ "Submit": "Envoyer", "If you are experiencing issues or simply would like to provide some feedback, please send us a short description below.": "Si vous rencontrez des problèmes, ou vous voulez simplement faire un commentaire, faites-en une courte description ci-dessous.", "Feedback": "Commentaires", - "{{count}} stars|other": "{{count}} favoris", + "{{count}} stars_other": "{{count}} favoris", "<0>We'd love to hear your feedback so we can improve your experience.": "<0>Nous aimerions avoir vos commentaires afin que nous puissions améliorer votre expérience.", - "{{count}} stars|one": "{{count}} favori", + "{{count}} stars_one": "{{count}} favori", "{{displayName}}, your call has ended.": "{{displayName}}, votre appel est terminé.", "<0>Thanks for your feedback!": "<0>Merci pour votre commentaire !", "How did it go?": "Comment cela s’est-il passé ?", @@ -88,14 +88,14 @@ "Thanks!": "Merci !", "You were disconnected from the call": "Vous avez été déconnecté de l’appel", "Connectivity to the server has been lost.": "La connexion avec le serveur a été perdue.", - "{{count, number}}|other": "{{count, number}}", + "{{count, number}}_other": "{{count, number}}", "Encrypted": "Chiffré", "End call": "Terminer l’appel", "Grid": "Grille", "Microphone off": "Microphone éteint", "Microphone on": "Microphone allumé", "Sharing screen": "L’écran est partagé", - "{{count, number}}|one": "{{count, number}}", + "{{count, number}}_one": "{{count, number}}", "Not encrypted": "Non chiffré", "You": "Vous", "Continue in browser": "Continuer dans le navigateur", diff --git a/public/locales/id/app.json b/public/locales/id/app.json index a378b1e3b..21e45078a 100644 --- a/public/locales/id/app.json +++ b/public/locales/id/app.json @@ -75,11 +75,11 @@ "{{displayName}}, your call has ended.": "{{displayName}}, panggilan Anda telah berakhir.", "<0>Thanks for your feedback!": "<0>Terima kasih atas masukan Anda!", "How did it go?": "Bagaimana rasanya?", - "{{count}} stars|one": "{{count}} bintang", + "{{count}} stars_one": "{{count}} bintang", "<0>We'd love to hear your feedback so we can improve your experience.": "<0>Kami ingin mendengar masukan Anda supaya kami bisa meningkatkan pengalaman Anda.", "Show connection stats": "Tampilkan statistik koneksi", "{{displayName}} is presenting": "{{displayName}} sedang menampilkan", - "{{count}} stars|other": "{{count}} bintang", + "{{count}} stars_other": "{{count}} bintang", "By clicking \"Go\", you agree to our <2>End User Licensing Agreement (EULA)": "Dengan mengeklik \"Bergabung\", Anda menyetujui <2>Perjanjian Lisensi Pengguna Akhir (EULA)", "This site is protected by ReCAPTCHA and the Google <2>Privacy Policy and <6>Terms of Service apply.<9>By clicking \"Register\", you agree to our <12>End User Licensing Agreement (EULA)": "Situs ini dilindungi oleh reCAPTCHA dan <2>Kebijakan Privasi dan <6>Ketentuan Layanan Google berlaku.<9>Dengan mengeklik \"Daftar\", Anda menyetujui <12>Perjanjian Lisensi Pengguna Akhir (EULA) kami", "By clicking \"Join call now\", you agree to our <2>End User Licensing Agreement (EULA)": "Dengan mengeklik \"Bergabung ke panggilan sekarang\", Anda menyetujui <2>Perjanjian Lisensi Pengguna Akhir (EULA) kami", @@ -88,7 +88,7 @@ "You were disconnected from the call": "Anda terputus dari panggilan", "Reconnect": "Hubungkan ulang", "Thanks!": "Terima kasih!", - "{{count, number}}|other": "{{count, number}}", + "{{count, number}}_other": "{{count, number}}", "Encrypted": "Terenkripsi", "End call": "Akhiri panggilan", "Grid": "Kisi", @@ -96,7 +96,7 @@ "Microphone on": "Mikrofon dinyalakan", "Not encrypted": "Tidak terenkripsi", "Sharing screen": "Berbagi layar", - "{{count, number}}|one": "{{count, number}}", + "{{count, number}}_one": "{{count, number}}", "You": "Anda", "Continue in browser": "Lanjutkan dalam peramban", "Mute microphone": "Matikan mikrofon", diff --git a/public/locales/it/app.json b/public/locales/it/app.json index cafb7f4c6..52ab234ab 100644 --- a/public/locales/it/app.json +++ b/public/locales/it/app.json @@ -1,8 +1,8 @@ { - "{{count, number}}|one": "{{count, number}}", - "{{count, number}}|other": "{{count, number}}", - "{{count}} stars|one": "{{count}} stelle", - "{{count}} stars|other": "{{count}} stelle", + "{{count, number}}_one": "{{count, number}}", + "{{count, number}}_other": "{{count, number}}", + "{{count}} stars_one": "{{count}} stelle", + "{{count}} stars_other": "{{count}} stelle", "{{displayName}} is presenting": "{{displayName}} sta presentando", "<0>Already have an account?<1><0>Log in Or <2>Access as a guest": "<0>Hai già un profilo?<1><0>Accedi o <2>Accedi come ospite", "<0>Create an account Or <2>Access as a guest": "<0>Crea un profilo o <2>Accedi come ospite", diff --git a/public/locales/lv/app.json b/public/locales/lv/app.json index 8df5392d8..1b3484f45 100644 --- a/public/locales/lv/app.json +++ b/public/locales/lv/app.json @@ -1,6 +1,6 @@ { - "{{count}} stars|one": "{{count}} zvaigzne", - "{{count}} stars|other": "{{count}} zvaigznes", + "{{count}} stars_one": "{{count}} zvaigzne", + "{{count}} stars_other": "{{count}} zvaigznes", "<0>Already have an account?<1><0>Log in Or <2>Access as a guest": "<0>Jau ir konts?<1><0>Pieteikties vai <2>Piekļūt kā viesim", "<0>Create an account Or <2>Access as a guest": "<0>Izveidot kontu vai <2>Piekļūt kā viesim", "<0>Oops, something's gone wrong.": "<0>Ak vai, kaut kas nogāja greizi!", diff --git a/public/locales/pl/app.json b/public/locales/pl/app.json index 2fd7d9572..de26668e4 100644 --- a/public/locales/pl/app.json +++ b/public/locales/pl/app.json @@ -72,8 +72,8 @@ "Submitting…": "Wysyłanie…", "Submit": "Wyślij", "Your feedback": "Twoje opinie", - "{{count}} stars|other": "{{count}} gwiazdki", - "{{count}} stars|one": "{{count}} gwiazdki", + "{{count}} stars_other": "{{count}} gwiazdki", + "{{count}} stars_one": "{{count}} gwiazdki", "{{displayName}}, your call has ended.": "{{displayName}}, Twoje połączenie zostało zakończone.", "<0>Thanks for your feedback!": "<0>Dziękujemy za Twoją opinię!", "<0>We'd love to hear your feedback so we can improve your experience.": "<0>Z przyjemnością wysłuchamy Twojej opinii, aby poprawić Twoje doświadczenia.", @@ -88,7 +88,7 @@ "You were disconnected from the call": "Rozłączono Cię z połączenia", "Connectivity to the server has been lost.": "Utracono połączenie z serwerem.", "Reconnect": "Połącz ponownie", - "{{count, number}}|other": "{{count, number}}", + "{{count, number}}_other": "{{count, number}}", "Encrypted": "Szyfrowane", "End call": "Zakończ połączenie", "Grid": "Siatka", @@ -96,7 +96,7 @@ "Microphone on": "Mikrofon włączony", "Not encrypted": "Nie szyfrowane", "Sharing screen": "Udostępnianie ekranu", - "{{count, number}}|one": "{{count, number}}", + "{{count, number}}_one": "{{count, number}}", "Continue in browser": "Kontynuuj w przeglądarce", "Mute microphone": "Wycisz mikrofon", "Name of call": "Nazwa połączenia", diff --git a/public/locales/ru/app.json b/public/locales/ru/app.json index 2db689112..4bcd2bd87 100644 --- a/public/locales/ru/app.json +++ b/public/locales/ru/app.json @@ -72,8 +72,8 @@ "Feedback": "Отзыв", "Submit": "Отправить", "Submitting…": "Отправляем…", - "{{count}} stars|one": "{{count}} отмечен", - "{{count}} stars|other": "{{count}} отмеченных", + "{{count}} stars_one": "{{count}} отмечен", + "{{count}} stars_other": "{{count}} отмеченных", "{{displayName}}, your call has ended.": "{{displayName}}, ваш звонок окончен.", "<0>Thanks for your feedback!": "<0>Спасибо за обратную связь!", "Your feedback": "Ваш отзыв", diff --git a/public/locales/sk/app.json b/public/locales/sk/app.json index 49349aae2..5b44383e9 100644 --- a/public/locales/sk/app.json +++ b/public/locales/sk/app.json @@ -72,9 +72,9 @@ "Submit": "Odoslať", "If you are experiencing issues or simply would like to provide some feedback, please send us a short description below.": "Ak máte problémy alebo jednoducho chcete poskytnúť spätnú väzbu, pošlite nám krátky popis nižšie.", "Feedback": "Spätná väzba", - "{{count}} stars|one": "{{count}} hviezdička", + "{{count}} stars_one": "{{count}} hviezdička", "How did it go?": "Ako to išlo?", - "{{count}} stars|other": "{{count}} hviezdičiek", + "{{count}} stars_other": "{{count}} hviezdičiek", "{{displayName}}, your call has ended.": "{{displayName}}, váš hovor skončil.", "<0>Thanks for your feedback!": "<0> Ďakujeme za vašu spätnú väzbu!", "<0>We'd love to hear your feedback so we can improve your experience.": "<0> Radi si vypočujeme vašu spätnú väzbu, aby sme mohli zlepšiť vaše skúsenosti.", @@ -88,7 +88,7 @@ "Reconnect": "Znovu pripojiť", "Thanks!": "Ďakujeme!", "You were disconnected from the call": "Boli ste odpojení z hovoru", - "{{count, number}}|other": "{{count, number}}", + "{{count, number}}_other": "{{count, number}}", "Encrypted": "Šifrované", "End call": "Ukončiť hovor", "Microphone off": "Mikrofón vypnutý", @@ -96,7 +96,7 @@ "Grid": "Sieť", "Not encrypted": "Nie je zašifrované", "Sharing screen": "Zdieľanie obrazovky", - "{{count, number}}|one": "{{count, number}}", + "{{count, number}}_one": "{{count, number}}", "You": "Vy", "Continue in browser": "Pokračovať v prehliadači", "Mute microphone": "Stlmiť mikrofón", diff --git a/public/locales/sv/app.json b/public/locales/sv/app.json index 4e7031ba2..962e1f480 100644 --- a/public/locales/sv/app.json +++ b/public/locales/sv/app.json @@ -1,8 +1,8 @@ { - "{{count}} stars|one": "{{count}} stjärna", - "{{count}} stars|other": "{{count}} stjärnor", - "{{count, number}}|one": "{{count, number}}", - "{{count, number}}|other": "{{count, number}}", + "{{count}} stars_one": "{{count}} stjärna", + "{{count}} stars_other": "{{count}} stjärnor", + "{{count, number}}_one": "{{count, number}}", + "{{count, number}}_other": "{{count, number}}", "{{displayName}} is presenting": "{{displayName}} presenterar", "{{displayName}}, your call has ended.": "{{displayName}}, ditt samtal har avslutats." } diff --git a/public/locales/uk/app.json b/public/locales/uk/app.json index e4f17f415..2929bbff6 100644 --- a/public/locales/uk/app.json +++ b/public/locales/uk/app.json @@ -73,8 +73,8 @@ "If you are experiencing issues or simply would like to provide some feedback, please send us a short description below.": "Якщо у вас виникли проблеми або ви просто хочете залишити відгук, надішліть нам короткий опис нижче.", "Feedback": "Відгук", "<0>Thanks for your feedback!": "<0>Дякуємо за ваш відгук!", - "{{count}} stars|one": "{{count}} зірок", - "{{count}} stars|other": "{{count}} зірок", + "{{count}} stars_one": "{{count}} зірок", + "{{count}} stars_other": "{{count}} зірок", "{{displayName}}, your call has ended.": "{{displayName}}, ваш виклик завершено.", "<0>We'd love to hear your feedback so we can improve your experience.": "<0>Ми будемо раді почути ваші відгуки, щоб поліпшити роботу застосунку.", "How did it go?": "Вам усе сподобалось?", @@ -88,12 +88,12 @@ "Retry sending logs": "Повторити надсилання журналів", "You were disconnected from the call": "Вас від'єднано від виклику", "Thanks!": "Дякуємо!", - "{{count, number}}|other": "{{count, number}}", + "{{count, number}}_other": "{{count, number}}", "Encrypted": "Зашифровано", "Microphone on": "Мікрофон увімкнено", "Not encrypted": "Не зашифровано", "Sharing screen": "Презентація екрана", - "{{count, number}}|one": "{{count, number}}", + "{{count, number}}_one": "{{count, number}}", "End call": "Завершити виклик", "Grid": "Сітка", "Microphone off": "Мікрофон вимкнено", diff --git a/public/locales/zh-Hans/app.json b/public/locales/zh-Hans/app.json index e8d4c65d7..9dee26127 100644 --- a/public/locales/zh-Hans/app.json +++ b/public/locales/zh-Hans/app.json @@ -68,8 +68,8 @@ "Microphone off": "麦克风关闭", "Microphone on": "麦克风开启", "Not encrypted": "未加密", - "{{count, number}}|one": "{{count, number}}", - "{{count, number}}|other": "{{count, number}}", + "{{count, number}}_one": "{{count, number}}", + "{{count, number}}_other": "{{count, number}}", "Sharing screen": "屏幕共享", "You": "你", "Continue in browser": "在浏览器中继续", @@ -86,7 +86,7 @@ "Call not found": "未找到通话", "Calls are now end-to-end encrypted and need to be created from the home page. This helps make sure everyone's using the same encryption key.": "现在,通话是端对端加密的,需要从主页创建。这有助于确保每个人都使用相同的加密密钥。", "Your web browser does not support media end-to-end encryption. Supported Browsers are Chrome, Safari, Firefox >=117": "您的浏览器不支持媒体端对端加密。支持的浏览器有 Chrome、Safari、Firefox >=117", - "{{count}} stars|other": "{{count}} 个星", + "{{count}} stars_other": "{{count}} 个星", "{{displayName}} is presenting": "{{displayName}}正在展示", "{{displayName}}, your call has ended.": "{{displayName}},通话已结束。", "<0>Submitting debug logs will help us track down the problem.": "<0>提交日志以帮助我们修复问题。", @@ -97,7 +97,7 @@ "Thanks, we received your feedback!": "谢谢,我们收到了反馈!", "By clicking \"Go\", you agree to our <2>End User Licensing Agreement (EULA)": "点击 \"开始\",即表示您同意我们的<2>最终用户许可协议 (EULA)", "By clicking \"Join call now\", you agree to our <2>End User Licensing Agreement (EULA)": "点击 \"加入通话\",即表示您同意我们的<2>最终用户许可协议 (EULA)", - "{{count}} stars|one": "{{count}} 个星", + "{{count}} stars_one": "{{count}} 个星", "<0>Thanks for your feedback!": "<0>感谢反馈!", "Your feedback": "您的反馈", "Connectivity to the server has been lost.": "与服务器的连接中断。", diff --git a/public/locales/zh-Hant/app.json b/public/locales/zh-Hant/app.json index 01d228a19..70f6ab4f7 100644 --- a/public/locales/zh-Hant/app.json +++ b/public/locales/zh-Hant/app.json @@ -72,10 +72,10 @@ "Submit": "遞交", "If you are experiencing issues or simply would like to provide some feedback, please send us a short description below.": "若您遇到問題或只是想提供一些回饋,請在下方傳送簡短說明給我們。", "Feedback": "回饋", - "{{count}} stars|other": "{{count}} 個星星", + "{{count}} stars_other": "{{count}} 個星星", "<0>Thanks for your feedback!": "<0>感謝您的回饋!", "<0>We'd love to hear your feedback so we can improve your experience.": "<0>我們想要聽到您的回饋,如此我們才能改善您的體驗。", - "{{count}} stars|one": "{{count}} 個星星", + "{{count}} stars_one": "{{count}} 個星星", "{{displayName}}, your call has ended.": "{{displayName}},您的通話已結束。", "How did it go?": "進展如何?", "{{displayName}} is presenting": "{{displayName}} 正在展示", @@ -88,8 +88,8 @@ "Retry sending logs": "重試傳送紀錄檔", "Thanks!": "感謝!", "You were disconnected from the call": "您已從通話斷線", - "{{count, number}}|one": "{{count, number}}", - "{{count, number}}|other": "{{count, number}}", + "{{count, number}}_one": "{{count, number}}", + "{{count, number}}_other": "{{count, number}}", "Encrypted": "已加密", "End call": "結束通話", "Grid": "網格", diff --git a/src/@types/i18next.d.ts b/src/@types/i18next.d.ts new file mode 100644 index 000000000..9f98f2920 --- /dev/null +++ b/src/@types/i18next.d.ts @@ -0,0 +1,28 @@ +/* +Copyright 2023 New Vector Ltd + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +import "i18next"; +// import all namespaces (for the default language, only) +import app from "../../public/locales/en-GB/app.json"; + +declare module "i18next" { + interface CustomTypeOptions { + defaultNS: "app"; + resources: { + app: typeof app; + }; + } +} diff --git a/src/TranslatedError.ts b/src/TranslatedError.ts index 6c7f5dad6..a9bd2e1d0 100644 --- a/src/TranslatedError.ts +++ b/src/TranslatedError.ts @@ -16,6 +16,9 @@ limitations under the License. import i18n from "i18next"; +import type { ParseKeys, TFunction } from "i18next/typescript/t"; +import type { DefaultNamespace, TOptions } from "i18next/typescript/options"; + /** * An error with messages in both English and the user's preferred language. */ @@ -27,8 +30,11 @@ export abstract class TranslatedError extends Error { */ public readonly translatedMessage: string; - public constructor(messageKey: string, translationFn: typeof i18n.t) { - super(translationFn(messageKey, { lng: "en-GB" })); + public constructor( + messageKey: ParseKeys, + translationFn: TFunction, + ) { + super(translationFn(messageKey, { lng: "en-GB" } as TOptions)); this.translatedMessage = translationFn(messageKey); } } @@ -38,6 +44,6 @@ class TranslatedErrorImpl extends TranslatedError {} // i18next-parser can't detect calls to a constructor, so we expose a bare // function instead export const translatedError = ( - messageKey: string, + messageKey: ParseKeys, t: typeof i18n.t, ): TranslatedError => new TranslatedErrorImpl(messageKey, t); diff --git a/src/initializer.tsx b/src/initializer.tsx index dd1e225d5..512e505a0 100644 --- a/src/initializer.tsx +++ b/src/initializer.tsx @@ -74,7 +74,7 @@ export class Initializer { defaultNS: "app", keySeparator: false, nsSeparator: false, - pluralSeparator: "|", + pluralSeparator: "_", contextSeparator: "|", interpolation: { escapeValue: false, // React has built-in XSS protections diff --git a/tsconfig.json b/tsconfig.json index 961199a9e..2544804f8 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -14,6 +14,7 @@ "noUnusedLocals": true, "moduleResolution": "node", "declaration": true, + "resolveJsonModule": true, // TODO: Enable the following options later. // "forceConsistentCasingInFileNames": true,