Locale::POFileManager - Helpers for keeping a set of related .po files in sync
version 0.05
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 msgid, lang, and canonical_msgstr (the msgstr value from the canonical_language. Optional.
msgid
lang
canonical_msgstr
canonical_language
Returns a Path::Class::Dir object corresponding to the base_dir passed to the constructor.
base_dir
Returns a list of Locale::POFileManager::File objects corresponding to the .po files that were found in the base_dir.
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.
stub_msgstr
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 base_dir.
Returns the Locale::POFileManager::File object corresponding to the given language.
Returns the Locale::POFileManager::File object corresponding to the canonical_language.
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.
bug-locale-pofilemanager at rt.cpan.org
Locale::Maketext::Lexicon
Locale::Maketext
Locale::PO
You can find this documentation for this module with the perldoc command.
perldoc Locale::POFileManager
You can also look for information at:
AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/Locale-POFileManager
CPAN Ratings
http://cpanratings.perl.org/d/Locale-POFileManager
RT: CPAN's request tracker
http://rt.cpan.org/NoAuth/Bugs.html?Dist=Locale-POFileManager
Search CPAN
http://search.cpan.org/dist/Locale-POFileManager
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.