man Locale::Maketext::Extract () - Extract translatable strings from source
NAME
Locale::Maketext::Extract - Extract translatable strings from source
SYNOPSIS
my $Ext = Locale::Maketext::Extract->new; $Ext->read_po('messages.po'); $Ext->extract_file($_) for <*.pl>; $Ext->compile; $Ext->write_po('messages.po');
DESCRIPTION
This module can extract translatable strings from files, and write them back to PO files. It can also parse existing PO files and merge their contents with newly extracted strings.
A command-line utility, xgettext.pl, is installed with this module as well.
Following formats of input files are supported:
- Perl source files
- Valid localization function names are: CWtranslate, CWmaketext, CWgettext, CWloc, CWx, CW_ and CW__.
- HTML::Mason
- Strings inside CW<&|/l>CI...CW</&> and CW<&|/loc>CI...CW</&> are extracted.
- Template Toolkit
- Strings inside CW[%|l%]...[%END%] or CW[%|loc%]...[%END%] are extracted.
- Text::Template
- Sentences between CWSTARTxxx and CWENDxxx are extracted individually.
- Generic Template
- Strings inside {{...}} are extracted.
METHODS
Constructor
new
Accessors
header, set_header lexicon, set_lexicon, msgstr, set_msgstr entries, set_entries, entry, add_entry, del_entry clear
PO File manipulation
read_po write_po
Extraction
extract extract_file
Compilation
compile normalize_space
Lexicon accessors
msgids, has_msgid, msgstr, set_msgstr msg_positions, msg_variables, msg_format, msg_out
Internal utilities
_default_header _to_gettext _escape _format
ACKNOWLEDGMENTS
Thanks to Jesse Vincent for contributing to an early version of this module.
Also to Alain Barbet, who effectively re-wrote the source parser with a flex-like algorithm.
SEE ALSO
xgettext.pl, Locale::Maketext, Locale::Maketext::Lexicon
AUTHORS
Autrijus Tang <autrijus@autrijus.org>
COPYRIGHT
Copyright 2003, 2004 by Autrijus Tang <autrijus@autrijus.org>.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
See <http://www.perl.com/perl/misc/Artistic.html>