metamagikum
metamagikum

Reputation: 1358

firefox-addon-sdk localization of add-on options

In firefox Add-On builder there is a possibility to drop add-on preferences into the properties window in an "Extra package.json Properties" field.

The preferences for localization look like this:

{    "preferences": [
        {
            "type": "string", 
            "name": "myStringPref", 
            "value": "this is the default string value", 
            "title": "My String Pref"
        }
        ....
    ]}
}

Question: How can i localize the labels of the addon-options?

Upvotes: 4

Views: 595

Answers (3)

backy0175
backy0175

Reputation: 46

Here is essential of manual localization.

  1. create locale files in json format
  2. create locale listing file in json format
  3. download addon package(xpi file) from Add-on Builder
  4. rename file extension .xpi to .zip
  5. expand zip file
  6. create locale folder in the root of addon
  7. copy locale files into locale folder
  8. copy locale listing file into root folder
  9. zip all files and folders on root folder.
  10. rename file extension .zip to .xpi

file tree:

my-addon
    |   locales.json
    |
    +---data
    +---lib
    +---locale
        en-US.json
        fr-FR.json
        ja-JP.json

samples:

locales.json
{"locales":[
    "en-US",
    "fr-FR",
    "ja-JP"
]}

en-US.json
{
"test": "test en-US",
"test2": "test2 en-US"
}

fr-FR.json
{
"test": "test fr-FR",
"test2": "test2 fr-FR"
}

ja-JP.json
{
"test": "test ja-JP",
"test2": "test2 ja-JP"
}

Upvotes: 3

backy0175
backy0175

Reputation: 11

You can localize the labels of the addon preferences by add some json files into addon package file(xpi) manually.

I wrote "How To" document in Japanese, just yesterday. You can get it through Google Translate. I beleive that this document will help you.

http://translate.google.co.jp/translate?sl=ja&tl=en&js=n&prev=_t&hl=ja&ie=UTF-8&u=http%3A%2F%2Fbacky0175.at.webry.info%2F201310%2Farticle_4.html&act=url

Note: Google Translate makes some weird translation. :-( Sorry for inconvenient.

backy0175

Upvotes: 1

erikvold
erikvold

Reputation: 16528

No it's not possible to do this at the moment.

Upvotes: 0

Related Questions