localization in extension

141 views
Skip to first unread message

Mostafa Fotouhi

unread,
Nov 15, 2021, 4:33:16 AM11/15/21
to Chromium Extensions
 Do we can create a switch button and change the language of the extension? I mean without changing the chrome browser language.
Changing between two languages.

Jackie Han

unread,
Nov 18, 2021, 3:42:10 AM11/18/21
to Mostafa Fotouhi, Chromium Extensions
If you implement i18n by yourself or use other i18n JS libraries, the answer is Yes.
If you use chrome.i18n.getMessage() , the answer is No at present.

On Mon, Nov 15, 2021 at 5:33 PM Mostafa Fotouhi <mfot...@gmail.com> wrote:
 Do we can create a switch button and change the language of the extension? I mean without changing the chrome browser language.
Changing between two languages.

--
You received this message because you are subscribed to the Google Groups "Chromium Extensions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-extens...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-extensions/4816a017-e788-43d7-a3c5-6c0deb88a375n%40chromium.org.

Mostafa Fotouhi

unread,
Nov 18, 2021, 2:52:13 PM11/18/21
to Jackie Han, Chromium Extensions
Ok, thanks. 

Simeon Vincent

unread,
Nov 22, 2021, 3:42:02 PM11/22/21
to Mostafa Fotouhi, Jackie Han, Chromium Extensions
If you'd like to watch for updates to i18n.getMessage, I think issue 1187361 is probably the right issue to track.

Simeon - @dotproto
Chrome Extensions DevRel


chen min

unread,
Feb 27, 2023, 1:49:48 AM2/27/23
to Chromium Extensions, Jackie Han, Chromium Extensions, Mostafa Fotouhi
Do we can create a switch button and change the language of the extension?changing the chrome browser language,modification chrome://settings/languages

Jackie Han

unread,
Feb 27, 2023, 10:41:24 AM2/27/23
to chen min, Chromium Extensions, Mostafa Fotouhi
1. A switch button that can change the language of the extension?

a) If you use `chrome.i18n`, I have proposed an API for switching the extension language independently. But I don't know when browsers will implement this feature.
b) There are some workaround ways to change the extension language. For example, `fetch` the language resources by yourself.


2. By the way, let me explain two other misleading concepts.
a) Browser UI language
This is the browser UI itself language, not websites' languages.
You can get it by `chrome.i18n.getUILanguage()`.
But you can't change it by extension api. You can change it through the operating system's language setting or through Chrome command-line options.

b) Website language
chrome://settings/languages is used for website's preferred language, i.e. HTTP Accept-Language header.
You can add one or more languages here. But it doesn't change the browser UI language.
You can get it by `navigator.languages` or `chrome.i18n.getAcceptLanguages()`.
But you can't change it by extension api.

Note: Firefox's language setting (about:preferences -> language) combines both Browser UI language and Website language settings. So you can change both UI language and Website languages.

Reply all
Reply to author
Forward
0 new messages