Update (2009-03-29): I've updated TLT to version 0.1 alpha 4 removing two annoying, but minor problems (see the changelog for more details). No real need to update when everything is working for you.
Update (2009-05-05): I've updated TLT to version 0.1 alpha 5 with added support for automatic creation of the Mercurial file structure for hg.mozilla.org . The step with map_structure.py must still be applied first and the map-file MUST be named like "map_browser.txt","map_mail.txt" or "map_suite.txt", or it will not work! I will update the instructions below to reflect that changes later...
If you/your team/someone else have/has already a working Firefox and Thunderbird localization, and now you are interested in starting a SeaMonkey localization, there is a fast* way to import the Firefox and Thunderbird localizations to SeaMonkey.
In case you already have a full/partial localization of SeaMonkey 1.1.x, 1.0.x or Mozilla Suite 1.x: it is also possible to use this method to import it and then import the new strings from Firefox and Thunderbird. Unfortunately, there are a few limitations here which I'll explain below.
Please: don't see that as the only method for starting a SeaMonkey localization and don't be too scared about the long list of steps below - it's easier than it looks like.
And also: this is more a collection of hacks, than a perfect method. But it works, and that's what counts here.
*fast in compare to doing it manually
Attention: most of the code for the TLT script has been written ages ago and Silme is still under development, so there maybe some, small problems.
System Requirements:
- Perl 5.8 or newer (Perl 5.10 recommended):
- Python 2.5.x or 2.6.x:
- Mac and Windows: download and install the version 2.6.1 from here
- on Linux: use your distributions package manager
- Mercurial 1.1.x or newer:
- CVS 1.11.x or newer (but not 1.12.13 - see why!):
- Windows: download and unzip version 1.12.9
- Mac: install the free Apple XCode Tools package, which includes CVS
- Linux: install CVS through your distributions package manager
- Perl IPC::Run module (on Linux/Mac/Windows)
Build and install it with*:
perl Makefile.Pl
make
make test
make install
* On Windows you have to use nmakeinstead of make (download and install it if you don't already have it)
- "7za" executable file in your PATH:
- Linux: install p7zip through your distributions package manager
- Mac: download and install p7zip for Mac
- Windows: download and unpack the "7-Zip Command Line Version"; don't forget to set the "PATH" variable
- (only on Windows):
The tools:
Using TLT to import localizations:
- Download your localized Firefox and Thunderbird Linux-builds and the corresponding, en-US (or other reference locale) builds. Dowload a current en-US (or other reference locale) SeaMonkey Linux-build too.
The localized and reference builds must have a name of the form:
<product_name>-<product_version>.<locale>.linux-i686.tar.bz2 (example: firefox-3.2a1pre.en-US.linux-i686.tar.bz2)
The version numbers for both files (localized and reference), must be the same. If they are not: rename the localized build!
- Copy all the downloaded builds to the TLT main folder.
- Now open a console and navigate to the TLT folder
- to open a console window on Windows, go to "Start"/"Run" and type there:
cmd and click on OK.
- Run:
perl TLT en-US ab-CD --create Firefox 3.1b3pre --offline
to create the product Firefox with the version 3.1b3pre and all the English (US) strings, where "ab-CD" must be replaced with Your locale. If you do not use "en-US" as the reference locale, you can replace it with Your reference locale.
perl TLT en-US ab-CD --importexisting Firefox 3.1b3pre --offline
to import the existing localization of Firefox 3.1b3pre.
perl TLT en-US ab-CD --create Thunderbird 3.0b2pre --offline
perl TLT en-US ab-CD --importexisting Thunderbird 3.0b2pre --offline
perl TLT en-US ab-CD --create SeaMonkey 2.0a3pre --offline
-
- If you already have a partially localized SeaMonkey (for example a 1.0.x or 1.1.x release, or even the old Mozilla Suite), you can import that localization at this step only!(IF NOT: GO TO THE NEXT STEP!)
BUT BE AWARE: it imports the localized strings into the en-US dtd/properties files, so the old formatting and/or comments will be lost!
- The above file name convention also applies here: it must be a tar.bz2 file, with exactly the same name like the reference file (e.g. "en-US"), with only the locale name changed. If you don't have a Linux build, but the "ab-CD.jar" file, you can simply pack it to a tar.bz2 file, it should work. If you have a Linux build, but it is a tar.gz build: repack it to tar.bz2 archive.
perl TLT en-US ab-CD --importexisting SeaMonkey 2.0a3pre --offline
- Now we can import the Thunderbird localization into the SeaMonkey files:
perl TLT en-US ab-CD --dictionaryimport SeaMonkey 2.0a3pre Thunderbird 3.0b2pre
- Now it may be a good idea to open the "SeaMonkey-2.0a3pre_ab-CD_Translate.txt" file in TLT/Dictionaries/ab-CD and check, if the strings where at the end of the line you have ***automatically imported from Thunderbird*** are localized correctly (because with the next step this comments will be removed!)
perl TLT en-US ab-CD --update SeaMonkey 2.0a3pre --offline
- Now we can import the Firefox localization into the SeaMonkey files:
perl TLT en-US ab-CD --dictionaryimport SeaMonkey 2.0a3pre Firefox 3.1b3pre
- Now it may be a good idea to open the "SeaMonkey-2.0a3pre_ab-CD_Translate.txt" file in TLT/Dictionaries/ab-CD and check, if the strings where at the end of the line you have ***automatically imported from Firefox*** are localized correctly (because with the next step this comments will be removed!)
perl TLT en-US ab-CD --update SeaMonkey 2.0a3pre --offline
perl TLT en-US ab-CD --accesskeyscheck SeaMonkey 2.0a3pre
Now you've got a "SeaMonkey-2.0a3pre_ab-CD_AccessKeys.txt" file, where you'll see all the broken access keys (they were NOT automatically imported because of a sometimes different menu structure in the programs). To correct them, go to the file "SeaMonkey-2.0a3pre_ab-CD.txt" and edit the broken access keys.
A good idea might be to check all access keys, not just the ones that are reported broken, because TLT did not import any access key at all - so the en-US access keys are being used.
perl TLT en-US ab-CD --update SeaMonkey 2.0a3pre --offline
perl TLT en-US ab-CD --upgrade SeaMonkey 2.0a3pre --offline
Now you've got a working ab-CD.jar file in the TLT main folder.
It's possible to easily create a working language pack now (if you want or need to):
- Navigate to output/langpacks/ab-CD/SeaMonkey
Don't be confused about the "langpacks" in output/langpacks/ab-CD - they are not working, at this moment.
- Now you'll need at least: chrome.manifest and install.rdf files. And optionally: defaults, dictionaries and searchplugins directories (you don't need the chrome directory, because it's already there!). You can use the Polish langpack as an example of the files and the directory structure (an xpi file is in fact a zip-file, so you can easily unzip it).
- if you plan to use the files from the example langpack: don't forget to change the contents of the files to match your ab-CD locale!
- Put the two files (and optional directories) in the output/langpacks/ab-CD/SeaMonkey directory.
- Run again:
perl TLT en-US ab-CD --upgrade SeaMonkey 2.0a3pre --offline
- Now you'll find a working "SeaMonkey.ab-CD.langpack.xpi" in output/langpacks/ab-CD. Congratulations!
The langpack should install and work with the same binaries like the ones used above; and in later binaries, as long as there won't be any string changes.
To get a source-l10n structure (for Mozilla Mercurial repositories), you'll need Silme now:
- Use Mercurial/TortoiseHG to download the SeaMonkey source:
hg clone http://hg.mozilla.org/comm-central
- If you also want the DOM Inspector:
hg clone http://hg.mozilla.org/dom-inspector
- If you also want ChatZilla and/or Venkman:
cvs -d :pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot co mozilla/client.mk
cd mozilla
make -f client.mk checkout MOZ_CO_PROJECT=suite
- Unpack ab-CD.jar (it's in fact a zip file, so you can rename the file extension)
- Run the Silme map_structure.py script in the scripts directory to create a structure map file. To run it from Silmes main directory:
python scripts/map_structure.py new_map_suite_file.txt unpacked_jar_folder/locale/ab-CD local_copy_of_comm-central/suite/locales/en-US
- What you should know: many files have the same file names. map_structure always gives you the opportunity to choose one. Don't choose the wrong one, because you could notice the consequences too late! If you are not sure: check the files in a file editor to see the contents!
- Not all files need to be matched: with an already localized Firefox and Thunderbird you just need the suite directory (and: extensions/irc, extensions/venkman and the DOMInspector). So: there are some files you don't need to map.
- To make map files for extensions/irc, extensions/venkman and the DOMInspector you need to do:
python scripts/map_structure.py new_map_inspector_file.txt unpacked_jar_folder/locale/ab-CD/inspector local_copy_of_dom-inspector/resources/locale/en-US
python scripts/map_structure.py new_map_irc_file.txt unpacked_jar_folder/locale/ab-CD/chatzilla local_copy_of_extensions/irc/locales/en-US
python scripts/map_structure.py new_map_venkman_file.txt unpacked_jar_folder/locale/ab-CD/venkman local_copy_of_extensions/venkman/locales/en-US
- Run the Silme apply_map.py script in the scripts directory to produce the source-l10n files. To run it from Silmes main directory:
python scripts/apply_map.py map_suite_file.txt unpacked_jar_folder/locale/ab-CD new_folder_suite
python scripts/apply_map.py map_inspector_file.txt unpacked_jar_folder/locale/ab-CD/inspector new_folder_inspector
python scripts/apply_map.py map_irc_file.txt unpacked_jar_folder/locale/ab-CD/chatzilla new_folder_irc
python scripts/apply_map.py map_venkman_file.txt unpacked_jar_folder/locale/ab-CD/venkman new_folder_venkman
- In the "new_folder_*" directories you'll find the files prepared to be pushed to hg.mozilla.org. Congratulations!
More about TLT
The main function of TLT (Toolkit Localization Tool) is to provide an easy way to localize Mozilla software (not just SeaMonkey) using:
- just one file. All the strings from DTD and Properties files are being stored in one file (e.g. "SeaMonkey-2.0a3pre_ab-CD.txt"). There are two other files: the "translate" file with all untranslated strings, for easier localization, and the "ignore" file, where all entities which shouldn't be translated can be placed, so they won't show up again in the "translate" file.
- multilocale. You can always see both at once: the reference string and the localized string, which makes QA easier.
As seen above, it also provides a basic way for checking broken access keys, with the "--accesskeyscheck" argument.
It also provides the option to check, if the same strings in two products were translated differently. TLT looks only for strings where: the file name, the entity name and the reference (e.g. en-US) string are exactly the same. To do it, you need the "--compare" argument. To compare SeaMonkey with Firefox, you would do:
perl TLT en-US ab-CD --compare SeaMonkey 2.0a3pre Firefox 3.1b3pre
The results will be in the dictionaries/ab-CD directory.
More about Silme
Silme is the new L10n framework, not only for Mozilla localization, but also for other formats, like gettext. It is still in development, but it's already working very well.
The next version of TLT will be written using the Silme library, which should resolve most of the problems TLT is making now. Unfortunately, I have no idea when I'll have time to do that, so don't expect that to happen too soon.