I18n in cloud plugin

I changed my language preference at id.atlassian.com, so now most of the text are in Chinese.

However for my plugins, after I implemented i18n as per this page (https://community.atlassian.com/t5/Marketplace-Apps-Integrations/Jira-Cloud-app-i18n-support/ba-p/1642643), is still displaying English.

I can confirm the resource files are loaded correctly, because I can use fallbackLng to force it to use either resource JSON file.

I set i18next to auto-detect language (by not specifying “lng” in .init()), but after .init(), the language value is “en-US”. I then checked view.getContext(), its locale attribute is also “en-US”.

I tested that view.getContext().locale is reading browser language instead of user preference.

How can I get the language preference in a Custom UI plugin?

1 Like

The answer is to call /rest/api/3/user?accountId=?
Locale is in the response data.

Also note that i18next only recognize dash, not underscore. So change zh_TW to zh-TW.

2 Likes