Step-by-step Guide To Localizing Firefox using Mozilla Translator Converting a 0.9.x langpack to the 1.0 format
Author: Benjamin Smedberg <bsmedberg@covad.net>Prerequisites
- Mozilla Translator 5.04 (Download Here)
- Perl (on windows, this should be cygwin perl)
- Your language pack for Firefox 0.9.x
- A tool to handle ZIP files (either command-line "zip", or GUI tools like WinZip are fine)
Optional Tools
- A CVS client (either command-line "cvs" or a GUI tool like WinCVS)
Decisions to Make Before You Start
You have two ways you can get the original English files to translate. You can pull them from CVS, or download them from ZIP files. If you pull from CVS, you can also pull the entire source code to build Firefox.
Step-By-Step Instructions
Repackaging your 0.9.x Langpack.
You will need the following files from your 0.9.x langpack:ab-CD.jar
CD.jar
ab-win.jar
ab-mac.jar
ab-unix.jar
- Place these files in an empty directory (e.g.
~/0.9-langpack/
) - Download the perl repackaging script (Download Here)
- Open a command line, change the working directory to
~/0.9-langpack/
and run the perl repackaging script:~/0.9-langpack/ $ perl repackage-0.9.pl ab-CD
- You should have two new files in your directory:
toolkit-ab-CD.zip
andbrowser-ab-CD.zip
.
Getting the English files to translate
Create a new empty directory (e.g.~/firefox-translation/
). Your English and translated files will live under this directory.Getting the Source Files from CVS
Following the usual directions for CVS, pull a source tree. You need to use the aviary branch tag:
~/firefox-translation/ $ export CVSROOT=:pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot ~/firefox-translation/ $ cvs co -r AVIARY_1_0_20040515_BRANCH mozilla/client.mk ~/firefox-translation/mozilla $ make -f client.mk MOZ_PHOENIX=1 checkout
Downloading the Source Files as ZIPs
- Create the following empty directories:
~/firefox-translation/mozilla/toolkit/locales/
~/firefox-translation/mozilla/browser/locales/
- Download the English source files from the Firefox 1.0 l10n freeze:
toolkit-en-US.zip
(Download Here)browser-en-US.zip
(Download Here)
- Unzip
toolkit-en-US.zip
into~/firefox-translation/mozilla/toolkit/locales/en-US/
- Unzip
browser-en-US.zip
into~/firefox-translation/mozilla/browser/locales/en-US/
- Create the following empty directories:
Unpack the Translation
Now you are ready to unzip the files from step I-d.- Unzip
toolkit-ab-CD.zip
into~/firefox-translation/mozilla/toolkit/locales/ab-CD/
- Unzip
browser-ab-CD.zip
into~/firefox-translation/mozilla/browser/locales/ab-CD/
- Unzip
Use Mozilla Translator
- Launch Mozilla Translator 5.04 Older versions will not work!
- File -> Manage Products -> Add
Product name "Toolkit" or something similar. Do not enter any file paths. You must create a new product, you cannot re-use an existing product from 0.9.x version of Firefox. - Import -> CVS directory
Product: toolkit
Select directory:~/firefox-translation/mozilla/toolkit/locales/en-US/
- Import -> CVS translation
Product: toolkit
Select directory:~/firefox-translation/mozilla/toolkit/locales/ab-CD/
Locale: ab-CD - File -> Manage Products -> Add
Product name "Firefox 1.x" or something similar. Do not enter any file paths. - Import -> CVS directory
Product: "Firefox 1.x"
Select directory:~/firefox-translation/mozilla/browser/locales/en-US/
- Import -> CVS translation
Product: "Firefox 1.x"
Select directory:~/firefox-translation/mozilla/browser/locales/ab-CD/
Locale: ab-CD
Exporting from MT to commit to CVS
- Export -> CVS directory This menu item is
misnamed, it exports a translation, not the English
original
Product: Toolkit
Select directory:~/firefox-translation/mozilla/toolkit/locales/ab-CD/
Locale: ab-CD - Export -> CVS directory
Product: Firefox 1.x
Select directory:~/firefox-translation/mozilla/browser/locales/ab-CD/
Locale: ab-CD - When you are finished translating the chrome files using Mozilla Translator, there will still be some files that need to be manually translated. These are typically not part of the product chrome, but are used to build the installers, langpacks, or are part of the default profile. They can all be opened in an ordinary text editor. Most of them use the UTF8 encoding, or state explicitly which encoding is required.
- Export -> CVS directory This menu item is
misnamed, it exports a translation, not the English
original
Comparing Your Translation With English
As a last step before committing your translation to CVS (or posting it for review), you should run a perl script which will compare the translated files with the English originals. This script is not fail-safe, but it does find the most obvious errors.
If you're using a full CVS source tree, the script can be found in your source tree at mozilla/toolkit/locales/compare-locales.pl If you downloaded the English ZIP files, download the script from LXR (Download Here). Run the script once for the toolkit files, and once for the browser files. It will spit back some messages. "Unable to compare" messages mean that the script cannot do an automated comparison, you must do the comparison yourself. Read through the results to ensure there are no obvious errors.
~/firefox-translation/mozilla/toolkit/locales/ $ perl compare-locales.pl en-US ab-CD ~/firefox-translation/mozilla/browser/locales/ $ perl ../../toolkit/locales/compare-locales.pl en-US ab-CD
If you are using a Windows machine, please make sure that your files have unix-style line endings before committing. This can be accomplished with the "dos2unix" command line tool. Make sure you don't run dos2unix on binary files (GIF or PNG images).
If no obvious errors are displayed, your files should be ready for checkin.