Visit Mozilla.org

Compare-locales

From MDC

compare-locales is a python script that helps localizers to check their work without running Firefox or another application.

Contents

[edit] Installation

compare-locales needs to be installed, and it requires that you have Python installed on your machine. The easiest way is to just

easy_install compare-locales

if you have that set up, as I uploaded a current version to pypi.

It's checked in to cvs at mozilla/testing/tests/l10n, so you can get it via

cvs -z3 -d:pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot co mozilla/testing/tests/l10n

To actually install it, go into the source dir and use the regular distutils setup.py commands:

cd mozilla/testing/tests/l10n
python setup.py install

You can specify a --prefix option in the latter, but make sure that you have your PYTHONPATH set up correctly to pick it up.

This will install the necessary python modules as well as some command line scripts, notably compare-locales.

The most recent version is now on http://hg.mozilla.org/users/axel_mozilla.com/tooling, though that didn't get code reviews lately. The version uploaded on pypi is built from here, though, too.

[edit] Running it

compare-locales assumes that you're running it from the parent directory of both the mozilla and l10n repositories. If you want to test the localization for de, run

compare-locales de

[edit] Options

TBD

[edit] The output

The output of compare-locales is currently still somewhat cryptic, but here it goes:

First, it will show you a bunch of warnings

WARNING:root: Can't compare chrome/global/intl.css in toolkit
WARNING:root: Can't compare chrome/help/prefs.xhtml in browser
WARNING:root: Can't compare chrome/help/popup.xhtml in browser
...
WARNING:root: Can't compare myspell/README.txt in extensions/spellcheck
WARNING:root: Can't compare chrome/global-region/builtinURLs.rdf in toolkit

Those are fine, all they're saying is that those files are not checked, but as long as they are in the localization, that's just a warning. If any of those files would be missing, it's actually show that below.

Then follows the actual comparison output, which currently is nothing but the prettyprint of a hash. The main entries are for

missing 
Your localization files miss localizable strings.
missingFiles 
This is a list of missing files, you still need to localize those.
obsolete 
Those are localizable strings in your localization that don't appear in the English original
obsoleteFiles 
These are files that can be removed.

For each of those, you'll see a tree of module (i.e., browser etc), relative path to file, and key name of localizable entry, if applicable.

Read the output carefully, something that's missing here and obsolete there might just be a typo, for example.

The output closes with a summary, giving the total counts of missing and obsolete strings (individual entries in missing files are not counted yet), and some statistics on how many strings are changed or not, excluding access- and commandkeys. That gives localizers an idea on how thorough the localization is. This number won't reach 100% in general, mid 80s should be the target, though.