.\" Automatically generated by Pod::Man 2.25 (Pod::Simple 3.16) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .ie \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . nr % 0 . rr F .\} .el \{\ . de IX .. .\} .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "Log::Report::Lexicon::POT 3pm" .TH Log::Report::Lexicon::POT 3pm "2011-08-23" "perl v5.14.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Log::Report::Lexicon::POT \- manage PO files .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 2 \& # this is usually not for end\-users, See ::Extract::PerlPPI \& # using a PO table \& \& my $pot = Log::Report::Lexicon::POT \& \->read(\*(Aqpo/nl.po\*(Aq, charset => \*(Aqutf\-8\*(Aq) \& or die; \& \& my $po = $pot\->msgid(\*(Aq\*(Aq); \& print $pot\->nrPlurals; \& print $pot\->msgstr(\*(Aqmsgid\*(Aq, 3); \& $pot\->write; \& \& # creating a PO table \& \& my $po = Log::Report::Lexicon::PO\->new(...); \& $pot\->add($po); \& \& $pot\->write(\*(Aqpo/nl.po\*(Aq) \& or die; .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" This module is reading, extending, and writing \s-1POT\s0 files. \s-1POT\s0 files are used to store translations in humanly readable format for most of existing translation frameworks, like \s-1GNU\s0 gettext and Perl's Maketext. If you only wish to access the translation, then you may use the much more efficient Log::Report::Lexicon::POTcompact. .PP The code is loosely based on Locale::PO, by Alan Schwartz. The coding style is a bit off the rest of \f(CW\*(C`Log::Report\*(C'\fR, and there was a need to sincere simplification. Each \s-1PO\s0 object will be represented by a Log::Report::Lexicon::PO. .SH "METHODS" .IX Header "METHODS" .SS "Constructors" .IX Subsection "Constructors" .IP "Log::Report::Lexicon::POT\->\fBnew\fR(\s-1OPTIONS\s0)" 4 .IX Item "Log::Report::Lexicon::POT->new(OPTIONS)" Create a new \s-1POT\s0 file. The initial header is generated for you, but it can be changed using the \fIheader()\fR method. .Sp .Vb 9 \& \-Option \-\-Default \& charset \& date now \& filename undef \& index {} \& nr_plurals 2 \& plural_alg n!=1 \& textdomain \& version undef .Ve .RS 4 .IP "charset => \s-1STRING\s0" 2 .IX Item "charset => STRING" The character-set which is used for the output. .IP "date => \s-1STRING\s0" 2 .IX Item "date => STRING" Overrule the date which is included in the generated header. .IP "filename => \s-1STRING\s0" 2 .IX Item "filename => STRING" Specify an output filename. The name can also be specified when \&\fIwrite()\fR is called. .IP "index => \s-1HASH\s0" 2 .IX Item "index => HASH" A set of translations (Log::Report::Lexicon::PO objects), with msgid as key. .IP "nr_plurals => \s-1INTEGER\s0" 2 .IX Item "nr_plurals => INTEGER" The number of translations each of the translation with plural form need to have. .IP "plural_alg => \s-1EXPRESSION\s0" 2 .IX Item "plural_alg => EXPRESSION" The algorithm to be used to calculate which translated msgstr to use. .IP "textdomain => \s-1STRING\s0" 2 .IX Item "textdomain => STRING" The package name, used in the directory structure to store the \&\s-1PO\s0 files. .IP "version => \s-1STRING\s0" 2 .IX Item "version => STRING" .RE .RS 4 .RE .PD 0 .IP "Log::Report::Lexicon::POT\->\fBread\fR(\s-1FILENAME\s0, \s-1OPTIONS\s0)" 4 .IX Item "Log::Report::Lexicon::POT->read(FILENAME, OPTIONS)" .PD Read the \s-1POT\s0 information from \s-1FILENAME\s0. .Sp .Vb 2 \& \-Option \-\-Default \& charset .Ve .RS 4 .IP "charset => \s-1STRING\s0" 2 .IX Item "charset => STRING" The character-set which is used for the file. You must specify this explicitly, while it cannot be trustfully detected automatically. .RE .RS 4 .RE .ie n .IP "$obj\->\fBwrite\fR([FILENAME|FILEHANDLE], \s-1OPTIONS\s0)" 4 .el .IP "\f(CW$obj\fR\->\fBwrite\fR([FILENAME|FILEHANDLE], \s-1OPTIONS\s0)" 4 .IX Item "$obj->write([FILENAME|FILEHANDLE], OPTIONS)" When you pass an open \s-1FILEHANDLE\s0, you are yourself responsible that the correct character-encoding (binmode) is set. When the write followed a \fIread()\fR or the filename was explicitly set with \fIfilename()\fR, then you may omit the first parameter. .SS "Attributes" .IX Subsection "Attributes" .ie n .IP "$obj\->\fBcharset\fR" 4 .el .IP "\f(CW$obj\fR\->\fBcharset\fR" 4 .IX Item "$obj->charset" The character-set to be used for reading and writing. You do not need to be aware of Perl's internal encoding for the characters. .ie n .IP "$obj\->\fBfilename\fR" 4 .el .IP "\f(CW$obj\fR\->\fBfilename\fR" 4 .IX Item "$obj->filename" Returns the \s-1FILENAME\s0, as derived from \fIread()\fR or specified during initiation with new(filename). .ie n .IP "$obj\->\fBindex\fR" 4 .el .IP "\f(CW$obj\fR\->\fBindex\fR" 4 .IX Item "$obj->index" Returns a \s-1HASH\s0 of all defined \s-1PO\s0 objects, organized by msgid. Please try to avoid using this: use \fImsgid()\fR for lookup and \fIadd()\fR for adding translations. .SS "Managing \s-1PO\s0's" .IX Subsection "Managing PO's" .ie n .IP "$obj\->\fBadd\fR(\s-1PO\s0)" 4 .el .IP "\f(CW$obj\fR\->\fBadd\fR(\s-1PO\s0)" 4 .IX Item "$obj->add(PO)" Add the information from a \s-1PO\s0 into this \s-1POT\s0. If the msgid of the \s-1PO\s0 is already known, that is an error. .ie n .IP "$obj\->\fBheader\fR([\s-1FIELD\s0, [\s-1CONTENT\s0]])" 4 .el .IP "\f(CW$obj\fR\->\fBheader\fR([\s-1FIELD\s0, [\s-1CONTENT\s0]])" 4 .IX Item "$obj->header([FIELD, [CONTENT]])" The translation of a blank \s-1MSGID\s0 is used to store a \s-1MIME\s0 header, which contains some meta-data. When only a \s-1FIELD\s0 is specified, that content is looked-up (case-insensitive) and returned. When a \s-1CONTENT\s0 is specified, the knowledge will be stored. In latter case, the header structure may get created. When the \s-1CONTENT\s0 is set to \f(CW\*(C`undef\*(C'\fR, the field will be removed. .ie n .IP "$obj\->\fBmsgid\fR(\s-1STRING\s0)" 4 .el .IP "\f(CW$obj\fR\->\fBmsgid\fR(\s-1STRING\s0)" 4 .IX Item "$obj->msgid(STRING)" Lookup the Log::Report::Lexicon::PO with the \s-1STRING\s0. If you want to add a new translation, use \fIadd()\fR. Returns \f(CW\*(C`undef\*(C'\fR when not defined. .ie n .IP "$obj\->\fBmsgstr\fR(\s-1MSGID\s0, [\s-1COUNT\s0])" 4 .el .IP "\f(CW$obj\fR\->\fBmsgstr\fR(\s-1MSGID\s0, [\s-1COUNT\s0])" 4 .IX Item "$obj->msgstr(MSGID, [COUNT])" Returns the translated string for \s-1MSGID\s0. When not specified, \s-1COUNT\s0 is 1. .ie n .IP "$obj\->\fBnrPlurals\fR" 4 .el .IP "\f(CW$obj\fR\->\fBnrPlurals\fR" 4 .IX Item "$obj->nrPlurals" Returns the number of plurals, when not known then '2'. .ie n .IP "$obj\->\fBpluralIndex\fR(\s-1COUNT\s0)" 4 .el .IP "\f(CW$obj\fR\->\fBpluralIndex\fR(\s-1COUNT\s0)" 4 .IX Item "$obj->pluralIndex(COUNT)" Returns the msgstr index used to translate a value of \s-1COUNT\s0. .ie n .IP "$obj\->\fBremoveReferencesTo\fR(\s-1FILENAME\s0)" 4 .el .IP "\f(CW$obj\fR\->\fBremoveReferencesTo\fR(\s-1FILENAME\s0)" 4 .IX Item "$obj->removeReferencesTo(FILENAME)" Remove all the references to the indicate \s-1FILENAME\s0 from all defined translations. Returns the number of refs left. .ie n .IP "$obj\->\fBstats\fR" 4 .el .IP "\f(CW$obj\fR\->\fBstats\fR" 4 .IX Item "$obj->stats" Returns a \s-1HASH\s0 with some statistics about this \s-1POT\s0 table. .ie n .IP "$obj\->\fBtranslations\fR([\s-1ACTIVE\s0])" 4 .el .IP "\f(CW$obj\fR\->\fBtranslations\fR([\s-1ACTIVE\s0])" 4 .IX Item "$obj->translations([ACTIVE])" Returns a list with all defined Log::Report::Lexicon::PO objects. When the string \f(CW\*(C`ACTIVE\*(C'\fR is given as parameter, only objects which have references are returned. .ie n .IP "$obj\->\fBupdated\fR([\s-1DATE\s0])" 4 .el .IP "\f(CW$obj\fR\->\fBupdated\fR([\s-1DATE\s0])" 4 .IX Item "$obj->updated([DATE])" Replace the \*(L"PO-Revision-Date\*(R" with the specified \s-1DATE\s0, or the current moment. .SH "DIAGNOSTICS" .IX Header "DIAGNOSTICS" .IP "Error: charset parameter is required" 4 .IX Item "Error: charset parameter is required" .PD 0 .IP "Error: no filename or file-handle specified for \s-1PO\s0" 4 .IX Item "Error: no filename or file-handle specified for PO" .PD When a \s-1PO\s0 file is written, then a filename or file-handle must be specified explicitly, or set beforehand using the \fIfilename()\fR method, or known because the write follows a \fIread()\fR of the file. .IP "Error: only acceptable parameter is '\s-1ACTIVE\s0'" 4 .IX Item "Error: only acceptable parameter is 'ACTIVE'" .PD 0 .IP "Error: textdomain parameter is required" 4 .IX Item "Error: textdomain parameter is required" .PD .SH "SEE ALSO" .IX Header "SEE ALSO" This module is part of Log-Report distribution version 0.94, built on August 23, 2011. Website: \fIhttp://perl.overmeer.net/log\-report/\fR .SH "LICENSE" .IX Header "LICENSE" Copyrights 2007\-2011 by Mark Overmeer. For other contributors see ChangeLog. .PP This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See \fIhttp://www.perl.com/perl/misc/Artistic.html\fR