Search code examples
htmlgoogle-chromegoogle-chrome-extension

How to provide multiple languages for a Chrome Extension


I currently have a chrome extension that when clicked creates a popup with a form field that you fill out, pretty basic.

I want to also provide the extension in German but I can't figure out a good way to translate the HTML document for the popup into German.

I already made the web store title and description translated with the _locales folder and en and de sub folders with correct messages.json files. But I'm trying get the actual HTML document translated so when a German user uses the extension, the popup will automatically be in German and when a English user uses it, it will be in English.

It would help if you told me all the code I would have to write.


Solution

  • The only way to do it is via JavaScript :

    chrome.i18n.getMessage("name")

    The documentation for i18n : https://developer.chrome.com/extensions/i18n.html

    Source: https://stackoverflow.com/a/4298423/390330