My extension has two locales in the _locales
folder, it has ja
and ru
.
The manifest.json has "default_locale": "ru"
.
But now let's say for example a Spanish user installs my extension, their chrome.i18n.getUILanguage()
and chrome.i18n.getAcceptLanguages()
results in ['es', 'es-ES']
.
Is there a way I can determine what locale the browser is displaying my extension material in?
EDIT - What i currently do:
I XHR the _locales directory (make sure to have the ending /
otherwise XHR fails) I then get all the directories. Then i find a common key among all files that has a unique value across all files. Then I do chrome.i18n.getMessage(key)
and see which directories message.json gave that. It works but I just thought there would be a built in way.