Message Catalogs -- looking for usable module
am 30.05.2007 18:24:49 von llavicka
Hi all,
I'm looking for an usable perl module that supports message catalogs.
On CPAN, I found the following modules:
- i18n
- Locale::TextDomain
I would like to combine the usage of the message catalogs with
Log::Log4perl.
Has anybody experience with the usage of these modules? Which one
would you recommend? Are there any better practices?
Thank you for your support,
Lubos
Re: Message Catalogs -- looking for usable module
am 31.05.2007 08:14:07 von Gregor Goldbach
On 30 May 2007 09:24:49 -0700, llavicka wrote:
> I'm looking for an usable perl module that supports message catalogs.
> On CPAN, I found the following modules:
> - i18n
> - Locale::TextDomain
Locale::TextDomain works fine for us here. Just put
use Locale::TextDomain 'appname', undef;
at the top of your scripts and call gettext() or it's short cut __().
You definitely want to take a look at __x() which is the function you want
to use to interpolate values into messages.
Using Locale::TextDomain you are able to extract the messages with
xgettext this way:
xgettext --keyword=__ --keyword=__x --language=perl --from-code=utf-8 \
-o appname.pot -f list_of_files_to_extract_messages_from
--
Gregor Goldbach (PKI Team), DFN-CERT Services GmbH, Phone: +49 40 808077-621
DFN-CERT Services GmbH, https://www.dfn-cert.de, Phone +49 40 808077-555
Sitz / Register: Hamburg, AG Hamburg, HRB 88805, Ust-IdNr.: DE 232129737