Thursday, May 31, 2012

How to export and sign-off translations from Narro for Mozilla Firefox

For few years I have been trying to help the Mozilla Armenian localization initiative (even though I can't read/write Armenian myself). A friend of mine asked me if I could do a screen cast showing how I export the translations that the localizers translate.

Excuse my lengthiness and, perhaps, not clarity that a well thought video could have avoided. Release early it is said.

Here is a 15 minute screen cast explaining this:

Here is the script that I run during the video:
modules=( browser dom netwerk security toolkit); \
for module in ${modules[@]}; do cd $module; \
for file in `find .  -name "*dtd" -type f`; do \
cat /Users/armenzg/repos/armenian/header.dtd $file > $; mv $ $file; done; \
for file in `find . -name "*properties" ! -name -type f`; do \
cat /Users/armenzg/repos/armenian/ $file > $; mv $ $file; done; \
cd ..; done;

FIND="browser dom netwerk toolkit services security"

for file in `find $FIND -name "*dtd"` ; do \
sed '${/^$/d;}' $file > $ && mv $ $file ; done
for file in `find $FIND -name "*properties"`; do \
sed '${/^$/d;}' $file > $ &&  mv $ $file ; done
for file in `find $FIND -name "*ini"`; do \
sed '${/^$/d;}' $file > $ && mv $ $file ; done

hg revert dom/chrome/layout/ \
for file in `hg st -un | grep searchplugins`; do rm $file; done
for file in `find . -name "*orig"`; do rm $file; done

cd ../compare-locales && git pull && cd - && \
cd ~/repos/branches/mozilla-aurora && hg pull -u && hg up -C; \
cd ~/repos/armenian/hy-AM_aurora

PYTHONPATH=../compare-locales/lib python \
../compare-locales/scripts/compare-locales \
~/repos/branches/mozilla-aurora/browser/locales/l10n.ini \
../hy-AM_aurora .
Here is a list of the three posts I have made about Narro:

Creative Commons License
This work by Zambrano Gasparnian, Armen is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License.


  1. I had to view this video in chunks because it's so sad. Every minute of this says "make ugly compromises to get a decent tool".

  2. Armen, all of your steps (except adding a customized header, which could be turned into a plugin) are included in Narro, running compare locales, and committing and pushing to Mercurial.

    To deal with the translate or not problem with searchplugins, you can check or uncheck files to be exported from the file list.

    So the step that I got to is translations are automatically pulled in from Mozilla through the build system. People translate in Narro. Somebody (or automatically via cron) pushes the export to Mercurial. All you're left with to do is do a sign off manually on the dashboard.

  3. Hi Alexandru,
    Thanks for taking the time to watch the video.
    What would it take to develop a plugin for maintaining the headers? any way I can help?

    With regards committing to Mercurial I have not felt comfortable to upload my private key for security reasons so I do it locally. If there was a way without it I would feel more leaning towards using it.

    I also need Mercurial locally so I can use hg diff and verify what is going in (hg diff).

    I need to use compare-locales locally because I do all those local modifications... I can't avoid it... BTW, how do you keep track that you are using the latest compare-locales version by Axel?

    I should have thought of the searchplugins exclusion from the beginning!
    Should I file a ticket to exclude them by default?

    Another feature request is to not generate a langpack when I export! (since it fails due to some files marked as not to be exported)

    Thanks again,

  4. Hi Armen,

    hg diff is included when you do the commit. Click on each file to see the diff after you press the test button in the Mercurial panel.

    compare locales is run on export, compare-locales is updated every night, if that doesn't happen it's a bug somewhere in the scripts.

    I can't tell what xml files are in en-US and what in your locale, so it's either all or none. You can always set any file not to be exported. And yes, for the language pack generation you need those files.

    Use a SSH key only for commiting to Mozilla and you should feel safer. I could use a single key for uploading from Narro, but then Mozilla would ask me to say who did every translation and that would mean I would have to keep track somehow what changed from the last commit to Mercurial to the running one so I can get the authors.

    Please file an issue for the headers saying what you need and I'll implement that. If it's just add a header to all files, than it's easy.