++ed by:

1 PAUSE user
1 non-PAUSE user.



Locale::Maketext::Lexicon - Use other catalog formats in Maketext


This document describes version 0.02 of Locale::Maketext::Lexicon, released May 13, 2002.


As part of a localization class:

    package Hello::L10N;
    use base 'Locale::Maketext';
    use Locale::Maketext::Lexicon {de => [Gettext => 'hello_de.po']};

Alternatively, as part of a localization subclass:

    package Hello::L10N::de;
    use base 'Hello::L10N';
    use Locale::Maketext::Lexicon;
    Locale::Maketext::Lexicon->import(Gettext => \*DATA);
    # Some sample data
    msgid ""
    msgstr ""
    "Project-Id-Version: Hello\n"
    "MIME-Version: 1.0\n"
    "Content-Type: text/plain; charset=iso8859-1\n"
    "Content-Transfer-Encoding: 8bit\n"

    #: Hello.pm:10
    msgid "Hello, World!"
    msgstr "Hallo, Welt!"


This module provides lexicon-handling modules to read from other localization formats, such as Gettext, Msgcat, and so on.

The import() function accepts two forms of arguments:

(format, [ filehandle | filename | arrayref ])

This form pass the contents specified by the second argument to Locale::Maketext::Plugin::format->parse as a plain list, and export its return value as the %Lexicon hash in the calling package.

{ language => format, [ filehandle | filename | arrayref ] ... }

This form accepts a hash reference. It will export a %Lexicon into the subclasses specified by each language, using the process described above. It is designed to alleviate the need to set up a separate subclass for each localized language, and just use the catalog files.


Thanks to Jesse Vincent for suggesting this function, and Sean M Burke for coming up with Locale::Maketext in the first place.


Locale::Maketext, Locale::Maketext::Lexicon::Gettext


Autrijus Tang <autrijus@autrijus.org>


Copyright 2002 by Autrijus Tang <autrijus@autrijus.org>.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

See http://www.perl.com/perl/misc/Artistic.html