You are currently viewing a snapshot of www.mozilla.org taken on April 21, 2008. Most of this content is highly out of date (some pages haven't been updated since the project began in 1998) and exists for historical purposes only. If there are any pages on this archive site that you think should be added back to www.mozilla.org, please file a bug.



Localizing Firefox using CVS

Author: Benjamin Smedberg <bsmedberg@covad.net>

Firefox will be localized from the source tree through two centralized locations. The core localized files shared between Thunderbird and Firefox are located at mozilla/toolkit/locales in the CVS tree LXR. The localized files which are used only by Firefox are located at mozilla/browser/locales LXR.

Getting the English Files

Localizers can obtain the original English files for translating in three ways:

  1. check out the files from the CVS repository;
  2. download a complete Firefox source tree (tarred or ZIPped) from the mozilla.org FTP servers;
  3. download a ZIP of the locale files, which will be provided at the time of localization-freeze before a release.

Getting Source Files from CVS

You do not need a CVS account to obtain the source files from CVS, there is anonymous read-only access to the CVS server. You may wish to read this document describing how to check out the entire source code. If you only want to retrieve the locale files, use the commands

cvs checkout mozilla/toolkit/locales
cvs checkout mozilla/browser/locales

Firefox 1.0 source is not on the main CVS "trunk" but rather from a branch, named AVIARY_1_0_20040515_BRANCH. In order to check out the locale files from this branch, you must use the -r flag with CVS:

cvs checkout -r AVIARY_1_0_20040515_BRANCH mozilla/toolkit/locales

Unpacking a downloaded ZIP file

JAR, ZIP, and XPI files are all the same archive format by different names. They can all be unpacked using the unzip command-line utility, or a GUI tool like WinZip. Users who wish to examine nested structures of archive files (a JAR file in a XPI file) may want to use the 7-ZIP archive explorer.

Converting Firefox 0.9(.x) Langpacks

Because the directory structure of the source tree is different from the directory structure in the final Firefox product, there is a perl script that can convert a Firefox 0.9(.x) chrome JAR files into the new format. This perl script requires a unix-like environment (linux/osx/cygwin), and it will not work on windows without cygwin. If you only have a windows machine and cannot install cygwin, ask bsmedberg or somebody on the #firefox IRC channel to run this script on your locale files. You will only need this script once. It requires the following five files:

  1. ab-CD.jar (platform-neutral language chrome)
  2. CD.jar (region chrome)
  3. ab-win.jar (windows language chrome)
  4. ab-mac.jar (mac language chrome)
  5. ab-unix.jar (unix language chrome)

Download repackage-0.9.pl here.

To run the script, place the five files in an empty directory, cd to that directory, and type the command:

perl -w /path/to/repackage-0.9.pl ab-CD

When the script is done you should have two JAR files: toolkit-ab-CD.jar and browser-ab-CD.jar.

Comparing Your Localization to English

After you run the repackaging script, you will still need to manually copy some files into your language. These include default files for the profile (bookmarks.html), localized search plugins, and a few miscellaneous files needed by the installer. In order to help you figure out which files you need, I have written another perl script that will compare two language packs. It will make sure that the files match, and also that DTD files and .properties files have the same localized entries. You will also need to run this script when you upgrade your language pack. This script is part of the mozilla source tree, located at mozilla/toolkit/locales/compare-locales.pl. This script can compare zipped or unzipped locale directories. This perl script should also run on any variant of perl, including ActiveState perl which does not require cygwin. For example:

perl -w compare-locales.pl toolkit-en-US.jar toolkit-ab-CD

The output of this command will list mismatched files and other problems that may need to be solved for a compatible locale pack. NOTE: this comparison is not foolproof, it checks for properties and entities using regular expressions, not a full parser. If you encounter errors, please let me know by filing a bug in the Firefox->Build Config component of bugzilla.mozilla.org.

Checking Localized Files into CVS

After you have a completed locale pack and the comparison script returns no obvious errors, you are ready to have your localization checked in to the CVS repository. If you have never used CVS before, it would be best if you just sent me your ZIPped locale pack. I will add the necessary directories to CVS and commit your files. If you know how to use CVS, you may commit the files yourself. Please remember that Firefox 1.0 locale packs are on the aviary branch, and you must commit your new locale files on that branch as well.

If you do not have commit access to the CVS repository, you must obtain access by following these directions. You do not need three super-reviewers to approve your CVS access. Just cc bsmedberg@covad.net when you file your bug, and I will vouch that you are a localization owner or peer.