Localize extension descriptions: Difference between revisions

From MozillaZine Knowledge Base
Jump to navigationJump to search
No edit summary
 
(terminology..)
Line 1: Line 1:
{{extdev}}
{{extdev}}


To localize the description of an extension, 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.{<i>app_guid</i>}.description</code>", where "<code>app_guid</code>" is the [[Install.rdf#Items.27_IDs|GUID]] string that is unique to each extension.
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.
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.
Line 7: Line 7:
==Instructions==
==Instructions==
#[[Dev_:_Using_preferences#How_to_install_extension.27s_defaults_files|Create]] your default preferences file, if you don't already have one yet.
#[[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.{<i>app_guid</i>}.description</code>" to it.
#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 URL of a localized [http://www.xulplanet.com/tutorials/xultu/locprops.html properties] file. (e.g., "<tt>chrome://my_app/locale/names.properties</tt>")
#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.
#Create or edit the corresponding localized properties file.
#Add a new name-value pair to the properties file with the name also set to "<code>extensions.{app_guid}.description</code>" and the value set to the description of your extension.
#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==
==Example==
If all goes well, your preferences file (<tt>defaults\preferences\prefs.js</tt>) may look like this:
If all goes well, your preferences file (<tt>defaults\preferences\prefs.js</tt>) may look like this:
<pre>
pref("extensions.{abcdef01-1234-abcd-1234-012345abcdef}.description", "chrome://my_ext/locale/names.properties");
pref("extensions.{abcdef01-1234-abcd-1234-012345abcdef}.description", "chrome://my_app/locale/names.properties");
And your localized properties file (<tt>chrome://my_ext/locale/names.properties</tt>) may look like this:
</pre>
extensions.{abcdef01-1234-abcd-1234-012345abcdef}.description = Plays a sound when the time has come to shine.
And your localized properties file (<tt>chrome://my_app/locale/names.properties</tt>) may look like this:
<pre>
extensions.{abcdef01-1234-abcd-1234-012345abcdef}.description = Plays a sound when the time has come to shine.
</pre>


[[Category:Development]]
[[Category:Development]]

Revision as of 23:00, 16 July 2005

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).

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.
  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 (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.