--
You received this message because you are subscribed to the Google Groups "Chromium-Extensions-Announce" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-extensions+unsub...@chromium.org.
To post to this group, send email to chromium-extensions@chromium.org.
Visit this group at https://groups.google.com/a/chromium.org/group/chromium-extensions/.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-extensions/ec2997c9-9da3-4997-960d-2b7a71b5740b%40chromium.org.
Yes, I understand that, but it was easier and more consistent if it would be provided by chrome api.
Now I use chrome.i18n to localize manifest only and to get browser locale to use it as a default one, structure of messages.json not so convenient to work with it manually.
Note that you can sort of do this in javascript just by using an XHR to fetch the messages.json file and then parse it yourself. Here's a quick example:function getMessageForLocale(message, locale, callback) {let xhr = new XmlHttpRequest();xhr.open("GET", chrome.runtime.getURL("_locales/" + locale + "/messages.json");xhr.onload = function() {let parsed = JSON.parse(xhr.responseText);callback(parsed[message]);};}You'd want to add some error handling, but that's the essential idea.
On Sun, Oct 30, 2016 at 1:14 AM, Lev Mishin <leomi...@gmail.com> wrote:
Add a link to issuehttps://bugs.chromium.org/p/chromium/issues/detail?id=660704#
On Sunday, October 30, 2016 at 9:12:18 AM UTC+1, Lev Mishin wrote:if you call methodchrome.i18n.getMessage("some_message")you will get a translation according to chrome's locale settingsBut it would be nice to have an ability to specify lang you want to use for your extension and let user change it in settingsso I propose to add a method to i18n API:chrome.i18n.setLocale("en")And if there is no any objections I can try to implement it by myselfPS if it is a wrong thread to post please let me know which one would more appropriate
--
You received this message because you are subscribed to the Google Groups "Chromium-Extensions-Announce" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-extens...@chromium.org.
To post to this group, send email to chromium-...@chromium.org.
Visit this group at https://groups.google.com/a/chromium.org/group/chromium-extensions/.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-extensions/ec2997c9-9da3-4997-960d-2b7a71b5740b%40chromium.org.
Kind regards,
Lev Mishin