2011-02-03

new dist::zilla command: pot

i just released dist::zilla::app::command::pot, providing dist::zilla with a new pot command (not the plant, you hippy!).

this command allows to (re-)generate a messages.pot file holding all strings to be translated from your module. If a messages.pot file is found, it will update it. otherwise, you will be prompted for a file location, with a default matching Locale::TextDomain settings:
$dzil pot
[...]
[DZ] Trying to find a messages.pot file...
[DZ] No messages.pot found - enter your own.
messages.pot to use [lib/LocaleData/Foo-Bar-messages.pot]:
[DZ] Running xgettext...
yup, underneath it just runs xgettext. and currently, it only finds calls to T() - but i'll add an option to provide your own convention such as _(), gettext(), etc.

2 comments:

  1. wait what does it do? can you give more examples for the gettext ignorants on why this is awesome.

    ReplyDelete
  2. @xenoterracide: usually, every projet that i know using xgettext does have a script to a) collect the list of perl files and b) run xgettext on this set of files with options such as copyright holder, etc.

    dzil already has all this information, so instead of duplicating yet another script, why not putting it in a dzil command? that's what i did.

    so, when you have a project to be i18n, you need to:
    - make sure strings are enclosed in gettext calls (or __() or T() or whatever). usually, those calls are provided by a i18n framework - i like locale::textdomain for its simplicity
    - run dzil pot to collect the strings
    - hand over the pot file to l10n people that will translate

    ReplyDelete