Localize extension descriptions

From MozillaZine Knowledge Base
Revision as of 23:08, 8 February 2006 by RenegadeX (talk | contribs) (added comment about using UTF-8 encoding for the localized properties file)
Jump to navigationJump to search

This page is part of the extension development documentation project.

Ask your questions in MozillaZine Forums. Also try browsing example code.

Note: development documentation is in process of being moved to Mozilla Development Center (MDC).

The content of this article is a workaround to the Firefox bug 257155

To localize the description of an extension (the string that shows up under extension's name in the Extensions window), you need to use a special preference key to override the description specified in your install.rdf file. This name of this preference key is "extensions.extension_id.description", where "extension_id" is the ID of your extension.

Below are instructions on how to modify this preference key. These instructions require knowledge of how to use the default preferences file in your extension package.

Instructions

  1. Create your default preferences file, if you don't already have one yet.
  2. Add the preference key "extensions.extension_id.description" to it, where extension_id is the ID of your extension.
  3. Set the value of the preference key to be the URI of a localized properties file (e.g., "chrome://my_ext/locale/names.properties")
  4. Create or edit the corresponding localized properties file - be sure to use UTF-8 encoding, otherwise any foreign characters will not be displayed.
  5. Add a new name-value pair to the properties file with the name also set to "extensions.extension_id.description" and the value set to the description of your extension.

Example

If all goes well, your preferences file (my_ext\defaults\preferences\prefs.js) may look like this:

pref("extensions.{abcdef01-1234-abcd-1234-012345abcdef}.description", "chrome://my_ext/locale/names.properties");

And your localized properties file (chrome://my_ext/locale/names.properties) may look like this:

extensions.{abcdef01-1234-abcd-1234-012345abcdef}.description = Plays a sound when the time has come to shine.