当前位置: 动力学知识库 > 问答 > 编程问答 >

Testing Firefox Add-on/Extension Internationalization

问题描述:

I have created a Firefox Add-on using jpm and I have added a number of localization files such as:

  • locale/da.properties
  • locale/en-GB.properties
  • locale/en-US.properties
  • locale/fi.properties

And so on...

In my HTML files I use attributes to set these values, for example: data-l10n-id="ext_panel_heading_text".

I know the translations are working, because changes I make to values in en-GB.properties are reflected in my add-ons HTML page.

I've tried navigating to Options > Content > Choose... (under languages), removing English and adding another language (such as Finnish), however it doesn't seem to have an affect on the .properties file loaded by my extension. I also tried restarting Firefox after changing the language.

My question is: How do I test the different languages?

网友答案:

The language of Firefox is dependent on the activated language pack, or for Windows and Mac I believe it is hard coded into the build.

Language packs are available from https://addons.mozilla.org/en-US/firefox/language-tools/

网友答案:

The only way I know is to change general.useragent.locale to the locale you want to use (en-GB, da, en-US, fi) in about:configand then restarting your browser: that way your add-on should show localized texts.

As an alternative, you can use Quick Locale Switcher, which does the same but it's a little more friendly.

分享给朋友:
您可能感兴趣的文章:
随机阅读: