MozLCDB is a tool made for localization of various Mozilla (Gecko) based products. It is designed to resolve issues introduced since Mozilla Firefox 1.0 branch, and a replacement for MozillaTranslator.
This is Hung-Te Lin,
maintainer of Traditional Chinese Mozilla Localization,
and the famous "mozip"
(a tool to make Win32 localized builds).
I have been using MozillaTranslator for years
(whether the official builds or my own tweaked versions) since Mozilla M14
(Milestone 14, not 1.4. The M series are older than Mozilla 0.6).
During these years MT works O.K although more and more extra works have to
be done because Mozilla locale structure changes all the time.
Since the landing of Mozilla Firefox 1.0PR, localizers of Mozilla* suffered from
the huge changes in Mozilla locale structure and new CVS requirements.
Unfortunately, MozillaTranslator does not work anymore. Although MT has released
new versions to solve issues, after trying MT5.04 I think it's time to develop
a new tool which is more robust or I have to manually do many extra work for all
versions. With my experience in localization, I proposed
what I need and made a new tool, named MozLCDB. This name is a little weird
because the better name 'MLDB' is already taken by others. Hmmm. Maybe MLD?
I'm not an perl guru so this script is not perfect nor elegant now, but it helped me to generate a working Firefox 1.0PR locale without too much effort (in comparision to fight with MozillaTranslator).
Basically, MozLCDB works in this manner: MozLCDB tries to 'import' from a 'prepared directory' (pulled from CVS or ZIP language pack), then save and merge into a '(glossary) database'. If any new locale string or updated ones are found, these entries will be written to an 'input (editing) table'. You can then edit the input table to do localization. After everything is done, you have to 'update' the '(glossary) database' with your 'input (editing) table'. Then you can 'export' the locales to another 'prepared directory'. Finally, the 'prepared directory' will contain all the localized stuff.
When one DTD or properties file was found, MozLCDB first reads its content for the 'key's and original locales. If a key was not found (never seen), it will be inserted into database as a 'new' entry. If a key was found, MozLCDB will determine what to do depending on the original (en-US) locale message. If it is exactly same as some version recorded in database, it is considered a 'same' entry with no new entries introduced. If no entries with same original could be found, MozLCDB will append one entry with timestamp into database. This is the magic to make multiple product possible. We keep all versions of original messages.
When one DTD or properties file was found, MozLCDB first reads its content for the 'key's and original locales, then try to lookup database to decide what localized string to put in. If you export with '-x', MozLCDB assume you are working with a clean original copy exactly just what you have imported, so it will check for existence of keys and original locale message. However, you may want to export to a working (trial) copy. In that usage, -x will warn and stop because original message is filled with your localized strings. In this case you may use '-X' which will not check for keys.
usage: mozlcdb.pl [-uUixXen] [PATH] ... [-u] : (default) update editing table (current.txt) to database -U [files...]: import/update from editing table -i ROOT: import files from ROOT(jar file or directory root) -x ROOT: extract and update files in ROOT. -X ROOT: extract and update files in ROOT, ignore errors. -e : generate latest version of full table from database -n ROOT1 ROOT2: init with ROOT1 as en while ROOT2 as tr [CARE] -c : check database -r aa-BB DispName: update "contents.rdf" locale entries from en-US to aa-BB with DispName
python mt2mldb.py
perl mozlcdb.pl -U mldb.outUsually you'll get some warnings about "Not sync". Don't worry about that.
perl mozlcdb.pl -n en-US aa-BB
perl mozlcdb.pl -i ROOTExample:
perl mozlcdb.pl -i mozilla/toolkit/locales/en-US/chrome mozilla/browser/locales/en-US/chrome
perl mozlcdb.pl -i ROOTExample:
perl mozlcdb.pl -i locale
;comment [browser/aboutDialog.dtd] id=aboutVersion en=version tr=PUT YOUR LOCALIZED STRING HERE.
P.S: Updated and newly found strings will be ";tr=" commented at first. Remeber to remove the ";" mark when you localized one.
perl mozlcdb.pl
(or) perl mozlcdb.pl -u
cp -R mozilla/toolkit/locales/en-US/chrome aa-BB-toolkitThe commands (UNIX only) above will generate ROOT of "aa-BB-toolkit aa-BB-browser".
cp -R mozilla/browser/locales/en-US/chrome aa-BB-browser
For me, I'd like to copy original files into aa-BB CVS directory: (the aa-BB is exactly the CVS directory of locale aa-BB in the example, and the commands are witten with bash. You have to modify it to fit your own environment.)find aa-BB -name "*.dtd" -delete; find aa-BB -name "*.properties" -delete; for X in `find en-US -name "*.dtd"` ; do cp $X ${X/en-US/aa-BB} ; cvs add ${X/en-US/aa-BB}; done
perl mozlcdb.pl -x ROOTFor example:
perl mozlcdb.pl -x aa-BB-toolkit aa-BB-browser
perl mozlcdb.pl -X ROOT
The better way is to export to CVS files and let mozilla.org build a official localized build. And if you want to make end user happy, due to the issues I mentioned above, here I described is kind of 'hacked' language pack. I'll export files, and make them with en-US chrome node path, and save to an 'en-US.jar' to replace the original en-US.jar.
This is NOT GOOD, but seems like making most end user happy. If you don't want to make such evil language packs, you have to go manually edit every *.rdf in directories, and prepare install.rdf or install.js.
OK... But if you are happy with evil packs, or you're just trying your newly localized stuff (this is mainly what I use this feature now for) , here's how to make it work:
perl mozlcdb.pl -x ROOTFor example,
perl mozlcdb.pl -x locale
perl mozlcdb.perl -r aa-BB "Language Name" ROOTwhich will update all the 'contents.rdf' in ROOT. However, using a new locale name will require a mechanism of locale switching.
zip -r0 en-US.jar locale
perl mozlcdb.pl -X ROOT
This program is still under development. I used it sucessfully to make a working language pack (well, the en-US.jar) for Mozilla Firefox 1.0PR, Traditional Chinese. I'm not sure whether it is easy enough for most people or not, but it is designed for all what I need. So here I present it to all who needs to localize new Mozilla products but could not find any working tools to go on.
If you have any suggestions/problems, feel free to contact me. You can also use mozilla-l10n mailing list.