- SEE ALSO
- COPYRIGHT AND LICENSE
Locale::POFileManager - Helpers for keeping a set of related .po files in sync
use Locale::POFileManager; my $manager = Locale::POFileManager->new( base_dir => '/path/to/app/i18n/po', canonical_language => 'en', ); my %missing = $manager->find_missing; $manager->add_stubs; $manager->add_language('de');
This module contains helpers for managing a set of gettext translation files, including tools to keep the translation files in sync, adding new translation files, and manipulating the translations contained in the files. It is based on the Locale::Maketext::Lexicon parser library.
Accepts a hash of arguments:
The directory that contains the .po files. Required.
The language for the file that contains the canonical set of msgids. Required.
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
canonical_msgstr(the msgstr value from the
Returns a Path::Class::Dir object corresponding to the
base_dir passed to the constructor.
Returns a list of Locale::POFileManager::File objects corresponding to the .po files that were found in the
Returns the canonical language id passed to the constructor.
Returns the string passed to the constructor as
stub_msgstr if it was a string, or a coderef wrapped to supply the
canonical_msgstr option if it was a coderef.
Returns true if a language file exists for the given language in the
base_dir, false otherwise.
Creates a new language file for the language passed in as an argument. Creates a header for that file copied over from the header in the
canonical_language language file, and saves the newly created file in the
Returns the Locale::POFileManager::File object corresponding to the given language.
Returns the Locale::POFileManager::File object corresponding to the
Searches through all of the files in the
base_dir, and returns a hash mapping language names to an arrayref of msgids that were found in the
canonical_language file but not in the file for that language.
Adds stub msgid (and possibly msgstr, if the
stub_msgstr option was given) entries to each language file for each msgid found in the
canonical_language file but not in the language file.
No known bugs.
Please report any bugs through RT: email
bug-locale-pofilemanager at rt.cpan.org, or browse to http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Locale-POFileManager.
You can find this documentation for this module with the perldoc command.
You can also look for information at:
AnnoCPAN: Annotated CPAN documentation
RT: CPAN's request tracker
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.