Reputation: 771
is there a way to ask for i18n messages of a specific locale using JS please?
I'm working on an extension for Youtube,
and in Youtube site the user can change the site language, so even if the user's browser is in English, the user able to view the site in Japanese for example.
In a case like that if I use the chrome.i18n.getMessage()
it will retrieve an English message, so it won't be the same as the Youtube site language.
I can easily get the Youtube site language, and will like to use that value to request i18n messages with it, but I don't see where can I send this kind of parameter.
It will be also really nice to just set the locale first like chrome.i18n.setLocale('ja')
and keep using getMessage()
in a regular way.
Of course I can just write my own function to do so as it's just a regular JSON file, but still if there is a way using chrome API it will be much better and easy.
Upvotes: 3
Views: 1563
Reputation: 77541
Sadly, you can't. i18n
API does not support setting locale manually.
You'll have to roll your own internationalization if you want this functionality.
Upvotes: 4