-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Proposal: allow to use i18n.getMessage
in a serviceWorker
#93
Comments
chrome.i18n.getMessage
in a serviceWorkeri18n.getMessage
in a serviceWorker
This might have gotten fixed in Chrome: https://bugs.chromium.org/p/chromium/issues/detail?id=1159438#c24 |
Thanks for pointing that out! It actually hasn't been fixed. |
Opened a new issue for it specifically for i18n.getMessage: |
Thanks for opening that issue, @carlosjeurissen. To my knowledge Chrome intends to support |
@dotproto Thanks for the update. Are there any proposals on how to do that? Potentially we can do something like |
On Chrome 103.0.5060.134 seems to be working already. |
I think we can close this. It was simply a bug in Chrome, and Safari has supported this in v3 since supporting v3. |
@xeenon Thanks for the added labels and closing the issue. Seems serviceWorkers are not yet supported in Firefox, however, this API will probably work just fine once they do. |
With mv3,
i18n.getMessage
andi18n.getUILanguage
are not a function in theservice_worker
background script. This is troublesome as this is needed to set the label of action buttons or the entries of context menus.One of the reasons this might not be available is the sync nature of this method. Potentially we can resolve this by either offer an promise-based initialization function for this after which
i18n.getMessage
is available. Or make an async version ofi18n.getMessage
. Using fetch calls to the _locales files is not a viable alternative as this wouldn't allow the extension developer to rely on the native browser fallback system (es_419 would fall back to es). This would also be an issue sincei18n.getUILanguage
is unavailable and one has to rely either on navigator.language(s) ori18n.getAcceptLanguages
which both would not give the language of the browser.See also:
The text was updated successfully, but these errors were encountered: