How to Test Localized Add-ons by Changing Firefox’s Language Setting29 Nov 2010
When I add a new language translation to my Text2Link Firefox and Thunderbird add-on, I need to check whether the translated text will display correctly for users of that language. To do this, I change Firefox’s language and country code setting to the language and country I want to test.
Changing Firefox’s language and country code is a three-step process. First, type
about:config into the address bar.
Firefox will list all its configuration settings, which it calls preferences. The language and country code is stored in the
general.useragent.locale preference, which you need to enter in the Filter input box located above the preferences list. As you type, Firefox removes the preferences that don’t match what you have typed, so you won’t need to type the whole preference name before seeing it near the top of the list. Tip: many Firefox preferences begin with
general., so start typing
useragent to filter the list more quickly.
The language and country code is stored in the
general.useragent.locale preference as a five-character string. The first two lower-case letters represent the language code, here en for English. The dash separates the language code from the two-letter uppercase country code, here GB for Great Britain. (A list of two-letter language codes is available here; a list of two-letter country codes is available here.)
The second step is to change the language and country code. Double-click the
general.useragent.locale preference and replace the language and country code string. Here I’ve changed en-GB to zh-CN, which is the language and country code for Simplified Chinese.
After clicking OK to update the preference, the third step is to restart Firefox. The next time you open Firefox, any localized add-ons will display their text in the new language. For example, Text2Link displays three context-menu options when right-clicking after selecting a URL not marked-up in HTML:
- Open URL
- Open URL in New Tab
- Open URL in New Window
Here are Text2Link’s context-menu options displayed for the default English locale:
Here are Text2Link’s context-menu options displayed for the Simplified Chinese locale (zh-CN):
Here are Text2Link’s context-menu options displayed for the French locale (fr-FR):