[MKDoc-modules] ANNOUNCE: i18nfool 0.1
Jean-Michel Hiver
jhiver at mkdoc.com
Sat Jul 24 23:48:14 BST 2004
What is it?
===========
Extract and manipulate ZPT I18N strings from internationalized ZPT/TAL
templates.
I18NFool stands for "Internationalization File Object Oriented Leech".
It inspects a list of internationalized templates and sucks out
internationalized strings to produce a series of .pot files.
It also comes with a couple of shell scripts to easily manage a
collection of .pot and .po files with the gettext tools.
It's designed to work with Petal and PHPTAL, which means it should work
with ZPT as well.
How does it work?
=================
There are basically 3 scripts:
i18nfool-extract
----------------
To extract strings from your templates and produce a bunch of .pot files
(one per domain):
mkdir /opt/myapp/locale
cd /opt/myapp/locale
i18nfool-extract file1 file2 ... fileN
This will create
/opt/myapp/locale/default.pot
/opt/myapp/locale/some_domain.pot
/opt/myapp/locale/some_other_domain.pot
i18nfool-update
---------------
To create a bunch of .po files or update existing .po files from the set
of .pot files:
cd /opt/myapp/locale
Create some target languages:
mkdir en
mkdir es
mkdir fr
Run the script:
i18nfool-update
This will create
/opt/myapp/locale/en/LC_MESSAGES/default.po
/opt/myapp/locale/en/LC_MESSAGES/some_domain.po
/opt/myapp/locale/en/LC_MESSAGES/some_other_domain.po
/opt/myapp/locale/es/LC_MESSAGES/default.po
/opt/myapp/locale/es/LC_MESSAGES/some_domain.po
/opt/myapp/locale/es/LC_MESSAGES/some_other_domain.po
/opt/myapp/locale/fr/LC_MESSAGES/default.po
/opt/myapp/locale/fr/LC_MESSAGES/some_domain.po
/opt/myapp/locale/fr/LC_MESSAGES/some_other_domain.po
i18nfool-build
--------------
Turns the .po files into .mo files.
cd /opt/myapp/locale
i18nfool-build
This will create
/opt/myapp/locale/en/LC_MESSAGES/default.mo
/opt/myapp/locale/en/LC_MESSAGES/some_domain.mo
/opt/myapp/locale/en/LC_MESSAGES/some_other_domain.mo
/opt/myapp/locale/es/LC_MESSAGES/default.mo
/opt/myapp/locale/es/LC_MESSAGES/some_domain.mo
/opt/myapp/locale/es/LC_MESSAGES/some_other_domain.mo
/opt/myapp/locale/fr/LC_MESSAGES/default.mo
/opt/myapp/locale/fr/LC_MESSAGES/some_domain.mo
/opt/myapp/locale/fr/LC_MESSAGES/some_other_domain.mo
Motive
======
I've tried i18ndude but it's got a couple of crippling bugs at the
moment. Apparently there's a i18n-extract.py somewhere with Zope 3 but
having to download and setup Zope 3 just for this one tool is a bit of a
drag.
I was on IRC today with the author of PHPTAL (a good friend of mine) and
he had basically the same issues... so in a joint effort, we wrote this
new tool.
I hope it will complement nicely other similar tools. Bug reports are
very welcome.
It fully supports namespaces and translation domains.
perl -MCPAN -e 'install I18NFool'
Should pull out the module and any required dependencies for you
automatically though.
Caveats & Limitations
=====================
At the moment, i18nfool doesn't make any assumption about the character
set and is character set agnostic. Hopefully it'll be a bit more refined
at that level in the future.
Let me know what you think!
Cheers,
Jean-Michel.
More information about the MKDoc-modules
mailing list