Locale::PO::Callback - parse gettext source files
Thomas Thurman <thomas@thurman.org.uk>
use Locale::PO::Callback; sub callback { # ... } my $lpc = Locale::PO::Callback->new(\&callback); $lpc->read('test.po');
This module parses the .po files used by GNU gettext to hold translation catalogues. It takes one parameter, a coderef, and calls it repeatedly with a description of every item in the file. This enables chains of filters to be produced, as is commonly done with XML processing.
Creates an object. The callback parameter is a coderef which will be called with a description of every item in the file.
Reads and parses a file.
Parses a string.
Reads and parses a file or a string, depending on the is_string argument.
Behaves as though we had just read in an empty file, with default headers.
Given a coderef, this function returns a function which can be passed as a callback to this class's constructor. The coderef will be called with strings which, if concatenated, make a .po file equivalent to the source .po file.
In pipeline terms, this function produces sinks.
Given a coderef, this function returns a function which can be passed as a callback to this class's constructor. The function will pass its parameters through to the coderef unchanged, except for headers, when the file date will be changed to the current system date.
In pipeline terms, this function produces filters.
"header", "translation", or "other" (which last should never appear in ordinary use).
An arrayref of comments which appear before this item.
A hashref of the flags of this item (such as "fuzzy").
An arrayref of arrayrefs, the first item being a filename and the second being a line number.
The source message, in its singular form.
The source message, in its plural form. This is usually empty.
The translation, if any, unless this translation has plural forms, in which case see the next entry.
Variations on the translation for different plural forms.
The "context" of the translation. Rarely filled in.
A hashref of headers, mapping fieldnames to values. The keys are lowercased.
An arrayref of the header fieldnames, in the casing and order in which they were found.
We need to support encodings other than UTF-8.
This documentation was written in a bit of a rush.
This Perl module is copyright (C) Thomas Thurman, 2010. This is free software, and can be used/modified under the same terms as Perl itself.
To install Locale::PO::Callback, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Locale::PO::Callback
CPAN shell
perl -MCPAN -e shell install Locale::PO::Callback
For more information on module installation, please visit the detailed CPAN module installation guide.