Debug i18n internationalization

Hello, I am currently adding translations to my addon thanks to i18n and sometimes it requires some CSS adjustments because of the variation of phrase and word lengths. For now, if I want to switch the language, I have to rename subfolders inside _locales each time. Is there an easier way to switch between the different languages? An option to change inside Firefox settings or a variable to modify in JavaScript?

If you use the web-ext command:
web-ext run --pref=general.useragent.locale=de-DE (or whatever locale)

1 Like

Thank you for your quick answer. I am taking a look at it. It seems that it requires nodeJS and npm to use this command.

Yes, but nowadays as a javascript developer you should have node installed anyway. There are so many good things you can do with it :heart:

Is it possible to use it on Firefox Android?

I don’t think so. At least I have not seen any option for that.

We’re removing that preference in 59, see bug 1414390.

Mmmh, so it seems that there is no reliable cross-browser easy way to switch locale in addons for now :thinking:

web-ext isn’t crossbrowser either, as far as I know. It’s for firefox. And as far as I’ve read the bugticket, there will be a replacement for the pref.