chrome.i18n unavailable in MV3 (service worker) extensions – NO REPLACEMENT AVAILABLE

289 views
Skip to first unread message

Ricky Romero

unread,
Dec 1, 2021, 7:25:55 PM12/1/21
to Chromium Extensions
Hi,

I have a blocker to adopting Manifest V3 on the timeline announced by Google via email today. The chrome.i18n API isn't available in service workers, which prevents internationalization of things like context menus. There is no alternative API available. Please see https://bugs.chromium.org/p/chromium/issues/detail?id=1268098 for info. I first reported this bug (with test cases) in February via issue 1180446. This was closed as a duplicate.

This commit (https://crrev.com/a35eaacc117423fb2c0e1388033439c4305f45bc) was supposed to address this shortfall, however the API remains unavailable for service workers in Canary 98.0.4741.0, 6 weeks later.

If this isn't fixed, portions of the UI in my Chrome extension can't be translated. That would be a humiliating concession for adopting MV3.


Ricky

Simeon Vincent

unread,
Dec 2, 2021, 5:09:45 PM12/2/21
to Chromium Extensions, ricky....@gmail.com
Chrome Stable (m96) exposes the following properties on the i18n API
  • getAcceptLanguages
Chrome Canary (m98)  exposes the following properties on the i18n API
  • detectLanguage
  • getAcceptLanguages
  • getUILanguage
The commit you linked explicitly says it adds getUILanguage and detectLanguage (which it did). The getMessage method is still a work in progress. The problem with that method is that it is a synchronous API (SWs are async) and the implementation needs to be moved to a different process in the browser.

What portions of your UI cannot be localized in Manifest V3? You mentioned context menus; are there any other areas of concern?

Simeon - @dotproto
Chrome Extensions DevRel
Reply all
Reply to author
Forward
0 new messages