mozilla
Your Search Results

    L10n Checks

    L10n Checks is a Python script and library similar to compare-locales. It allows Mozilla localizers to easily check their work.

    Installation (releases)

    L10n Checks needs to be installed. To do that, you must have Python 2.5, 2.6, or 2.7 installed on your machine. Once Python is installed, the easiest way to install L10n Checks (on Mac or Linux) is to just run:

    $ sudo easy_install -U l10n-checks
    

    or, if you're on Windows:

    $ easy_install -U l10n-checks
    

     

    Installation (development versions)

    L10n Checks needs to be installed, and it requires that you have Python and Mercurial installed on your machine. The easiest way is to just run:

    $ hg clone http://hg.mozilla.org/users/akalla_aviary.pl/silme-patched/
    $ cd silme-patched/
    $ sudo python setup.py install
    

    or, if you're on Windows:

    $ hg clone http://hg.mozilla.org/users/akalla_aviary.pl/silme-patched/
    $ cd silme-patched/
    $ python setup.py install
    

    Running it

    Mercurial source (source) mode

    L10n Checks gathers the directories to compare from an ini file, usually found in $APP/locales/l10n.ini. You pass both the path to the ini file and the parent directory of the localizations as first arguments, followed by the locale codes of the locales you want to compare. If you want to test the localization for de, run:

    check-l10n-completeness browser/locales/l10n.ini ../l10n/ de
    

    Add-ons (xpi) mode

    L10n Checks gathers the locales to compare from the chrome.manifest file inside the xpi file. You pass the path to the xpi file (optionally) followed by the locale codes of the locales you want to compare. If you want to test the localization for de, run:

    check-l10n-completeness -i xpi my-extension.xpi de
    

    To check all locales in an extension:

    check-l10n-completeness -i xpi my-extension.xpi
    

    Language packs (xpis) mode

    L10n Checks can compare two locales found in different xpi files. You pass both paths to the xpi file and both paths to the locales inside the files, e.g.:

    check-l10n-completeness -i xpis en-US-langpack.xpi my-langpack.xpi jar:chrome/en-US.jar!locale/en-US/ jar:chrome/my.jar!locale/my/
    

    Jar/Zip File (jar) mode

    L10n Checks can compare two locales found in different jar files. You pass both paths to the jar file including the inner path, e.g.:

    check-l10n-completeness -i jar jar:en-US.jar!locale/en-US/ jar:my.jar!locale/my/
    

    Directories (dir) mode

    L10n Checks can compare two locales found in different directories. You pass both paths to the directories, e.g.:

    check-l10n-completeness -i dir en-US/ my/
    

    Files (file) mode

    L10n Checks can compare two files. You pass both paths to the files, e.g.:

    check-l10n-completeness -i file en-US.dtd my.dtd
    

    The output

    The output of L10n Checks shows the missing and obsolete strings in a pseudo-diff format.

    ab-CD
      browser
        chrome/browser
          browser.dtd
              +backForwardMenu.tooltip
              +fullZoomEnlargeCmd.commandkey3
              +fullZoomReduceCmd.commandkey2
              +fullZoomResetCmd.commandkey2
              +organizeBookmarks.label
              -showAllBookmarksCmd2.label
          migration/migration.dtd
              -importFromFile.accesskey
              -importFromFile.label
              +importFromHTMLFile.accesskey
              +importFromHTMLFile.label
    

    You can assume changed strings when you see entities removed and added with a similar name. The file names will be shown in a hierarchical form, so in the example above, your files are browser.dtd in ab-CD/browser/chrome/browser and migration.dtd in another directory level deeper.

    The output closes with a summary, giving the total counts of missing and obsolete strings and some statistics on how many strings are changed or not, excluding access and command keys. 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.

    Options

    Reference locale

    In the source and xpi modes you can change the default reference locale (en-US) by setting the -r parameter, e.g.:

    check-l10n-completeness -r pl browser/locales/l10n.ini ../l10n/ de
    

    Output mode

    You can change the look and feel of the output by setting the -o parameter to 0 (tree; default), 1 (full tree) or 2 (full relative paths), e.g.:

    check-l10n-completeness -o 2 browser/locales/l10n.ini ../l10n/ de
    

    en-US in the locale directory

    In the source mode you can tell L10n Checks to look for the en-US locale in the directory containing all other locales instead of the directory containing the source by setting the -l parameter (useful for e.g. "KompoZer"), e.g.:

    check-l10n-completeness -l browser/locales/l10n.ini ../l10n/ de
    

    Compare every directory

    In the source mode you can tell L10n Checks to compare every directory, not only the ones set in the all-locales file, by setting the -f parameter (useful for e.g. "SeaMonkey" with its extensions), e.g.:

    check-l10n-completeness -f suite/locales/l10n.ini ../l10n/ de
    

    Test the reference locale

    In the source mode you can tell L10n Checks to also check the reference locale, by setting the -e parameter (requires the -a parameter to be set too), e.g.:

    check-l10n-completeness -a 1 -e suite/locales/l10n.ini ../l10n/ de
    

    Turbo mode

    In the source mode you can tell L10n Checks to look only for missing and obsolete entities and files, by setting the -t parameter, e.g.:

    check-l10n-completeness -t suite/locales/l10n.ini ../l10n/ de
    

    Check access keys

    In all modes you can tell L10n Checks to check if the access keys are set properly, by setting the -a parameter, e.g.:

    check-l10n-completeness -a 1 suite/locales/l10n.ini ../l10n/ de
    

    There are three modes available:

    • 1: show just errors
    • 2: show errors and important warnings
    • 3: show all errors and warnings

    Spell checking

    In all modes you can tell L10n Checks to search for spelling errors, by setting the -c parameter, e.g.:

    check-l10n-completeness -c suite/locales/l10n.ini ../l10n/ de
    

    Spell checking requires enchant and pyenchant to be installed on the system.

    JSON output

    In all modes you can tell L10n Checks to present the output as JSON by setting the -j parameter to full_json, e.g.:

    check-l10n-completeness -j full_json suite/locales/l10n.ini ../l10n/ de
    

    JSON output requires simplejson to be present on the system if using Python 2.5.

    Verbose level

    In all modes you can set the verbose level, e.g.:

    check-l10n-completeness --verbose 5 full_json suite/locales/l10n.ini ../l10n/ de
    

    There are six levels. 0 - quiet; 5 - show all messages

    Merge

    In the source mode you can tell L10n Checks to merge missing strings and files into the locale files by setting a merge directory, e.g.:

    check-l10n-completeness -m output_dir suite/locales/l10n.ini ../l10n/ de
    
    Note: only files which were merged will be saved in that directory.

    Document Tags and Contributors

    Contributors to this page: jswisher, Standard8, Adrianer
    Last updated by: Standard8,