NAME
Locale::Maketext::Extract - Extract translatable strings from source
SYNOPSIS
my $Ext = Locale::Maketext::Extract->new;
$Ext->readpo('messages.po');
$Ext->extractfile($) for <*.pl>;
# Set $entriesareingettextformat if the .pl files above use
# loc('%1') instead of loc('[1]')
$Ext->compile($entriesareingettextformat);
$Ext->writepo('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: "translate", "maketext", "gettext", "loc", "x", "" and "". HTML::Mason Strings inside "<&|/l>...&>" and "<&|/loc>...&>" are extracted. Template ToolkitStrings inside "[%|l%]...[%END%]" or "[%|loc%]...[%END%]" are
extracted. Text::Template Sentences between "STARTxxx" and "ENDxxx" are extracted individually. Generic Template Strings inside {{...}} are extracted. MMEETTHHOODDSS CCoonnssttrruuccttoorr new AAcccceessssoorrss header, setheader lexicon, setlexicon, msgstr, setmsgstr entries, setentries, entry, addentry, delentry compiledentries, setcompiledentries, compiledentry, addcompiledentry, delcompiledentry clear PPOO FFiillee mmaanniippuullaattiioonnmethod readpo ($file)
method writepo ($file, $addformatmarker?)
EExxttrraaccttiioonn extract extractfile CCoommppiillaattiioonncompile($entriesareingettextstyle?)
Merges the "entries" into "compiledentries".If $entriesareingettextstyle is true, the previously extracted
entries are assumed to be in the GGeetttteexxtt style (e.g. %1).
Otherwise they are assumed to be in MMaakkeetteexxtt style (e.g. "[1]") and are converted into GGeetttteexxtt style before merging into "compiledentries". The "entries" are not cleared after each compilation; use"-"setentries()> to clear them if you need to extract from sources
with varying styles. normalizespace LLeexxiiccoonn aacccceessssoorrss msgids, hasmsgid, msgstr, setmsgstr msgpositions, msgvariables, msgformat, msgout IInntteerrnnaall uuttiilliittiieess defaultheader maketexttogettext escape format AACCKKNNOOWWLLEEDDGGMMEENNTTSS 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 Audrey TangCOPYRIGHT (The "MIT" License) Copyright 2003, 2004, 2005, 2006 by Audrey Tang . Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is fur- nished to do so, subject to
the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OFMERCHANTABILITY, FIT- NESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.perl v5.8.8 2006-06-15 Locale::Maketext::Extract(3)