7

I'm developing an add-on for Firefox and I now wish to localize the name and description of the add-on itself, as visible to the user in the Add-ons Manager menu.

However, the guides I've seen online only seem to mention preferences in package.json and nothing about the name of the add-on or its description. I have tried to apply the suggestions for preferences to the name/description fields and haven't had any success - it will always appear in English.

Is localization of these fields even possible?

BeneGal
  • 180
  • 1
  • 11

2 Answers2

4

There is currently no way to do this from package.json. Read bug 661083 for more details.

However, there is a workaround: Manually edit install.rdf to add em:localized properties.

To do this you'll need to use the SDK to package your app into an xpi file. Then open the xpi (it is a zip file) and you'll see install.rdf in the root of the directory.

The MDN article Localizing extension descriptions describes what structure the em:localized properties needs to have.

christi3k
  • 297
  • 1
  • 5
  • Thank you for a definitive answer. In attempting to do the above, I can edit the install.rdf file but can't repackage the xpi without corrupting it. However, you've answered my original question so I'll accept it. – BeneGal Dec 04 '13 at 15:11
  • Ah, yes, that's a good point. Have you tried simply zipping the directory? Be sure to give the compressed file a .xpi extension and not .zip, of course. – christi3k Dec 04 '13 at 17:21
  • I compressed to .zip and then renamed to .xpi? – BeneGal Dec 05 '13 at 11:46
  • https://bugzilla.mozilla.org/show_bug.cgi?id=661083 has been marked RESOLVED FIXED since September 8. But I still can't figure out how to use the SDK to localize the add-on name and description. – Alex Henrie Jan 18 '15 at 19:53
  • There was a comment added on 19 Jan, they are not going to fix this. – Eric G Jan 27 '15 at 23:34
0

This functionality has been added to the jpm tool recently (February 2016, see issue 495). Make sure that you use a recent jpm version, then the following code in package.json will work:

"title": "Default add-on name",
"description": "Default add-on description",
"locales": {
  "de": {
    "title": "Add-on name in German",
    "description": "Add-on description in German"
  },
  "ru": {
    "title": "Add-on name in Russian",
    "description": "Add-on description in Russian"
  },
}
Wladimir Palant
  • 56,865
  • 12
  • 98
  • 126