Localize extension descriptions: Difference between revisions

From MozillaZine Knowledge Base
Jump to navigationJump to search
m (added comment about using UTF-8 encoding for the localized properties file)
(redirect to devmo)
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
{{extdev}}
See [http://developer.mozilla.org/en/docs/Localizing_extension_descriptions Localizing extension descriptions] at the Mozilla Developer Center.
'''The content of this article is a workaround to the Firefox [https://bugzilla.mozilla.org/show_bug.cgi?id=257155 bug 257155]'''
[[Category:Redirects]]
 
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 "<code>extensions.''extension_id''.description</code>", where "<code>extension_id</code>" is the [[Install.rdf#Items.27_IDs|ID of your extension]].
 
Below are instructions on how to modify this preference key. These instructions require knowledge of how to use the [[Dev_:_Using_preferences#Default_preferences|default preferences]] file in your extension package.
 
==Instructions==
#[[Dev_:_Using_preferences#How_to_install_extension.27s_defaults_files|Create]] your default preferences file, if you don't already have one yet.
#Add the preference key "<code>extensions.''extension_id''.description</code>" to it, where <code>extension_id</code> is the ID of your extension.
#Set the value of the preference key to be the URI of a localized [http://www.xulplanet.com/tutorials/xultu/locprops.html properties file] (e.g., "<tt>chrome://my_ext/locale/names.properties</tt>")
#Create or edit the corresponding localized properties file - '''be sure to use UTF-8 encoding, otherwise any foreign characters will not be displayed'''.
#Add a new name-value pair to the properties file with the name also set to "<code>extensions.''extension_id''.description</code>" and the value set to the description of your extension.
 
==Example==
If all goes well, your preferences file (<tt>my_ext\defaults\preferences\prefs.js</tt>) may look like this:
pref("extensions.{abcdef01-1234-abcd-1234-012345abcdef}.description", "chrome://my_ext/locale/names.properties");
And your localized properties file (<tt>chrome://my_ext/locale/names.properties</tt>) may look like this:
extensions.{abcdef01-1234-abcd-1234-012345abcdef}.description = Plays a sound when the time has come to shine.
 
[[Category:Development]]

Latest revision as of 17:23, 7 September 2006

See Localizing extension descriptions at the Mozilla Developer Center.