GNOME command line translation management tool



Hi All,
Some time ago I posted on my blog an article for a command-line
translation management tool for GNOME,
http://blogs.gnome.org/simos/2008/03/03/designing-a-command-line-translation-tool-for-gnome/

I just managed to finish a working version of the tool, and is available from
http://github.com/simos/intltool-manage-vcs/

This is beta quality, and it is good to try it only if you feel
comfortable with Python code.
There is a --dry-run option when experimenting or if you do not have
an SVN account.
I am using it in the last few hours and it works for me.

What the tool does is
1. allows to specify which subset of
http://l10n.gnome.org/languages/LL/ you want to work
on (such as, which category, module, ui or doc) and downloads the
necessary files.
The relevant PO files are placed in a PO/ directory.
2. You translate, edit, process, etc the .po files in this PO
directory with your own tools, scripts,etc.
3. Once you have finished, you invoke the tool and it commits your
changes automatically for you.

TODO:
1. The current version does not update the ChangeLog files.
2. We currently only support SVN. Git to come shortly.
3. You need to have an initial translation already committed otherwise
the tool refuses
to continue. This is good to fix.
4. I am not to be held responsible if a repository is messed up ;-(.

Here is a walkthrough for this tool:

1. To download, visit http://github.com/simos/intltool-manage-vcs/ and
click on Download.
You can also "git clone git://github.com/simos/intltool-manage-vcs.git"
2. To run, there is a requirement for the 'python-lxml' package. You
need to install it.
3. Run ./intltool-manage-vcs to get a list of the options.
4. Let's download the UI po files for the admin tools (just two
packages). We run
./intltool-manage-vcs --init --release gnome-2-26 --language el
--username simos --transtype ui --category admin-tools --dry-run

--init: we initialise and create the necessary local files
--release gnome-2-26: we target gnome-2-26 (sorry, not HEAD yet)
--language el: our language per ISO 639 (corresponds to
http://l10n.gnome.org/languages/el/)
--username simos: your SVN username, required when initialising. If
you do not have an SVN account, specify --dry-run and add anything
here
--transtype ui: we can select either ui or doc. If we do not specify,
it downloads both.
--category admin-tools: we limit to the admin-tools (other options:
desktop, dev-tools)
--dry-run: will not checkout any files, just download the list for our language.

If you do not see any strange error messages, type the command again,
without --dry-run
./intltool-manage-vcs --init --release gnome-2-26 --language el
--username simos --transtype ui --category admin-tools --dry-run
5. The PO files (two, in this example), are placed in the PO/ directory.
Edit and change them at will.
6. In my example I edit only sabayon.
We run
$ ./intltool-manage-vcs --apply
Copying PO/sabayon.HEAD.el.po to LINKS/sabayon.HEAD.el.po
$ _
This shows that our changed sabayon.po has been copied to the local repository.
7. Now, it's commit time,
$ ./intltool-manage-vcs --commit --language el --dry-run
Committing in VCS/pessulus po@HEAD language: el
chdir VCS/pessulus po@HEAD;svn commit -m "Updated el translation"
Committing in VCS/sabayon po@HEAD language: el
chdir VCS/sabayon po@HEAD;svn commit -m "Updated el translation"
$ _

Now try without --dry-run and the commit will take place.

I have used this tool to update the gnome-games documentation and the
part about the Free Documentation License.
All translation files have the same content for the FDL license (comes
from legal.xml), so it is good to be able to translate once, and apply
to all translation files.
We run the command

$ \ls PO/*.po | perl -n -e 'chop; $a=$_; print "msgmerge
--no-fuzzy-matching -o mytemp.po ../el-check.po $a; mv mytemp.po
$a\n"' | sh
$ _

and then we commit the whole lot.

Simos


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]