Locale::POFileManager::File - A single .po file
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
Returns a Path::Class::File object corresponding to the
file passed to the constructor.
stub_msgstr passed to the constructor.
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
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) 2011 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.