NAME

PApp::I18n - internationalization support for PApp

open_translator $path, lang1, lang2...

Open an existing translation directory. A translation directory can contain any number of language translation tables. The additional arguments must list all translations one is interested in. The translator will always choose a translation table in this list. (In future versions this might be autodetected).

($lang, $table) = $translator->get_language($languages)

In scalar context, return a translator table for the language that best matches the $languages (always succeeds). In list context, return both the selected language and the translation table.

$translation = $table->gettext($msgid)

Find the translation for $msgid, or return the original string if no translation is found. If the msgid starts with the two characters "\" and "{", then these characters and all remaining characters until the closing '}' are skipped before attempting a translation. If you do want to include these two characters at the beginning of the string, use the sequence "\{\{". This can be used to specify additional arguments to some translation steps (like the language used). Here are some examples:

string      =>    translation
\{\string   =>    \translation
\{\{string  =>    \{translation
\{}string   =>    translation

To assure that the string is translated "as is" just prefix it with "\{}".

CLASS PApp::I18n::PO_Reader

This class can be used to read serially through a .po file. (where "po file" is about the same thing as a standard "Portable Object" file from the NLS standard developed by Uniforum).

$po = new PApp::I18n::PO_Reader $pathname

Opens the given file for reading.

($msgid, $msgstr, @comments) = $po->next;

Read the next entry. Returns nothing on end-of-file.

CLASS PApp::I18n::PO_Writer

This class can be used to write a new .po file. (where "po file" is about the same thing as a standard "Portable Object" file from the NLS standard developed by Uniforum).

$po = new PApp::I18n::PO_Writer $pathname

Opens the given file for writing.

$po->add($msgid, $msgstr, @comments);

Write another entry to the po file. See PO_Reader's next method.

AUTHOR

Marc Lehmann <pcg@goof.com>
http://www.goof.com/pcg/marc/