I18n language same as user preffered in Jira

I’m using i18n in my plugin and have currently set 2 properties files for 2 langs (English and Polish).

What I want to accomplish is when a user has selected EN as preferred language in Jira, I want him to see EN language in my plugin as well (even when his system/browser language is PL).

Right now, even when I have selected EN lang in Jira as my preferred one, i18n in my plugin still serves me PL lang (probably because my system/browser language is set to PL).

Is there any way to set specific lang for i18n? I can check what language user has selected in Jira via UserPreferencesManager, but I don’t know how to provide this information to i18n.

Any thoughts?

1 Like

The i18n engine should automatically choose a language file based on the user’s preferences. My team’s plugin is localized in English and German and it works just as expected. Your browser’s language shouldn’t matter for this.

Have you checked that your language files use the correct naming scheme? All language files except for the default one need the locale string after their base name. For instance, our English file, which is also the default one, is called ourpluginname.properties and the German one is called ourpluginname_de_DE.properties.

Because you always seem to get Polish strings, I assume that your default file (the one without a locale string in its name) contains the Polish translation. Your English file should then be named somename_en_US.properties.

I recommend using English as the default language though, because the default language file will be used if you haven’t translated your plugin to the user’s preferred language yet. I don’t know your plugin’s target demographic of course, but someone who selected some third language in their Jira settings is probably more likely to understand English than Polish. If you want to do that, rename the English file to somename.properties (without a locale Sting) and the Polish file to somename_pl_PL.properties (with the Polish locale string).