What should I18n be replaced with in new versions?

after some updates in discourse, this code-line I18n.translations.en.js.filters.unanswered = { title: "unanswered", help: "questions with no answers" }; doesn’t work anymore for non-English locales.

does anyone know what should it be replaced with?

a sample use case of the line: Add /users to top nav

For Persian, something like this should work:

I18n.translations.fa_IR.js.filters.unanswered = { title: "Unanswered", help: "Topics that have not be answered" };

If themes are adding a translation in this way, they need to be checking that the locale is defined. Something like this would be safe in a theme:

 if (I18n.translations.en) {
    I18n.translations.en.js.filters.unanswered = { title: "Unanswered", help: "Topics that have not be answered" };

I’m not sure what the best practice for doing this should be. Doing something like this seems to be safe:

let currentLocale = I18n.currentLocale();
I18n.translations[currentLocale].js.filters.unanswered = { title: "Unanswered", help: "Topics that have not be answered" };

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.