What should I18n be replaced with in new versions?

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" };
7 Likes