Locale::POFileManager::File - A single .po file
version 0.05
use Locale::POFileManager; my $manager = Locale::POFileManager->new( base_dir => '/path/to/app/i18n/po', canonical_language => 'en', ); my $file = $manager->language_file('de'); my $lang = $file->language; # 'de' $file->add_entry( msgid => 'Hello', msgstr => 'Guten Tag' ); my $translation = $file->msgstr('Hello'); # 'Guten Tag'
This module represents a single translation file, providing methods for manipulating the translation entries in it.
Accepts a hash of arguments:
The name of the file this represents. Required, and must exist.
The msgstr to insert when adding stubs to language files. This can be either a literal string, or a coderef which accepts a hash containing the keys msgid and lang. Optional.
msgid
lang
Returns a Path::Class::File object corresponding to the file passed to the constructor.
file
Returns the stub_msgstr passed to the constructor.
stub_msgstr
Returns a list of msgids found in the file.
Returns true if the given msgid is found in the file, and false otherwise.
Returns the msgstr that corresponds with the given msgid.
Returns the list of header entries.
Returns the value of the given header entry.
Adds an entry to the translation file. Arguments are a hash, with valid keys being msgid and msgstr.
msgstr
Returns the language that this file corresponds to.
Takes another translation file (either as a filename or as a Locale::POFileManager::File object), and returns a list of msgids that the given file contains that this file doesn't.
Takes another translation file (either as a filename or as a Locale::POFileManager::File object), and adds stubs for each msgid that the given file contains that this file doesn't.
Jesse Luehrs <doy at tozt dot net>
This software is copyright (c) 2013 by Jesse Luehrs.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Locale::POFileManager, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Locale::POFileManager
CPAN shell
perl -MCPAN -e shell install Locale::POFileManager
For more information on module installation, please visit the detailed CPAN module installation guide.