Manage extension updates by locale: Difference between revisions

From MozillaZine Knowledge Base
Jump to navigationJump to search
No edit summary
(No difference)

Revision as of 09:44, 4 August 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).

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

The purpose of this is to be able to provide updates only for selected locales users (e.g. only for the users of the fr-FR or so), useful if you don't want to delay the release of a new version because of the l10n time or if the translator want to correct an error in the translation. It's also a way to get usage statistics by locale. The result is the possibility to get one update.rdf file per locale.

You need to use a special preference key to override the update check url specified in your install.rdf file. The name of this preference key is "extensions.{GUID}.update.url", where "{GUID}" 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.{GUID}.update.url" to it, where {GUID} is the GUID 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.{GUID}.update.url" and the value set to the address of your rdf update file (See this for more info).

Example

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

pref("extensions.{abcdef01-1234-abcd-1234-012345abcdef}.update.url", "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}.update.url = http://www.mysite.com/updates/my_ext-locale.rdf

where "locale" is the locale code (e.g. en-US).


Inspired by Localize extension descriptions