GoogleChrome/chrome-extensions-samples

chrome.i18n.getMessage example for v3 manifest?

Closed this issue · 5 comments

The documentation here says you can get a translation using chrome.i18n.getMessage(), but getMessage isn't defined when using a v3 manifest. I can't find any info about this in the migration guides, nor examples in this repo. I'm trying to use this inside of a service worker to set a context menu's title, for what it's worth.

I got the same issue while trying to port an extension to v3.

I would assume that chrome.i18n.getMessage() would be available in a service_worker but chrome.i18n only has a method for getAcceptLanguages

Screenshot 2021-12-05 at 11 09 17

+1
I want to use the chrome.action.setTitle method in service_worker.
Uncaught TypeError: chrome.i18n.getMessage is not a function

Follow https://bugs.chromium.org/p/chromium/issues/detail?id=1268098 (just star it, don't post useless "me too" comments).

Shame that Google still hasn't fixed this even though you can't submit new Manifest v2 extensions by January 17th. This makes it impossible to localize e.g. context menus and actions.

Found that chrome.i18n.getMessage() works well on the Chrome Canary 102.0.4962.3.
I hope will be available on the regular version soon.

This is now available here