bug-gnu-utils
[Top][All Lists]
Advanced

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

Integration of gettext in Perl


From: Guido Flohr
Subject: Integration of gettext in Perl
Date: Thu, 1 Aug 2002 21:55:18 +0200
User-agent: Mutt/1.3.16i

Hi,

an announcement, not a bug report.

I've written an implementation of libintl (supports the full interface
declared in libintl.h as of gettext 0.10.37, including *ngettext) in
Perl.  Upon initialization the module tries to load the C binding
of GNU gettext »Locale::gettext« and if that fails, it falls
back to the Perl implementation.  

The module can convert messages to and from every 8 bit charset I know
(I happen to know exactly those that have a charmap file in the recent
GNU libc) on the fly, plus to and from UTF-8.  This is also done in
Perl, which makes the package completely independent of any runtime
libraries available on the system.

I've uploaded a prototype version to

  http://ml.imperia.org/projects/libintl-perl/libintl-perl-0.05.tar.gz

The module will be available as free (GPL and/or Artistic) software.
Please do not publish the above URL, the home address of the package
will be on the CPAN (http://www.cpan.org/).

Current limitations:

        - the conversion interface will change (fallback to the
          new built-in conversion routines of Perl 5.8.0 if they
          are available on the system)

        - LC_MESSAGES is only available in Perl with the Locale::gettext
          package that I emulate.  I therefore have to guess a little
          bit when selecting the correct message catalog.  Setting
          the environment variable LANGUAGE will always remedy problems
          arising from this fact

        - the fallback mechanism to the C binding is currently disabled
          because the official version does not yet support ngettext()
          and friends (and we need correct plural handling here) and
          the original author and "owner" of the namespace Locale::gettext
          is not available

        - the documentation is not present or out of sync with the
          implementation

Apart from that, the code is stable, it has proven to work in our product
on different operating systems and Microsoft Windows.

I've also written a message extractor in Perl for Perl but that thing
has a couple of limitations, the most serious one being performance
(takes about 10 minutes here to scan 180k lines of Perl code).  I
will make an attempt to re-implement the parser in C and would then
of course contribute that to GNU gettext, if this is considered a
valuable extension.  But since parsing Perl is no fun I would also
be glad to hear about someone else being on the way to do that.

Just in case anybody asks for better integration of gettext
in Perl ...

Guido 
-- 
Imperia AG, Development
Leyboldstr. 10 - D-50354 Hürth - http://www.imperia.de/

Attachment: pgpzd_ZjIeHfe.pgp
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]