Text::PO::Element - PO Element
use Text::PO::Element; my $po = Text::PO::Element->new; $po->debug( 2 ); $po->dump;
v0.2.3
This is the class for PO elements.
Create a new Text::PO::Element object acting as an accessor.
A Text::PO::Element object has the following fields :
Text::PO::Element
msgid
The localisation id
msgstr
The localised string
msgid_plural
The optional localised string in plural
context
The optional context.
fuzzy
The fuzzy flag set when the entry has been created but not yet translated
See also the GNU PO documentation
comment
The optional comment that can be added to provide some explanations to the translator
auto_comment
The optional comment added automatically
flags
An optional set of flags, stored as an array reference
For example:
#: src/msgcmp.c:338 src/po-lex.c:699 #, c-format msgid "found %d fatal error" msgid_plural "found %d fatal errors" msgstr[0] "s'ha trobat %d error fatal" msgstr[1] "s'han trobat %d errors fatals"
Here the flag would be c-format
c-format
See also the GNU PO documentation and here
plural
Whether this has a plural form
encoding
The character encoding
file
The file in which this l10n string was found. This is set when automatic parsing was executed
#: lib/error.c:116 msgid "Unknown system error" msgstr "Error desconegut del sistema"
This would specify a file lib/error.c and a line number 116
lib/error.c
116
line
The line at which this l10n was found. This is set when automatic parsing was executed
po
The parent Text::PO object
Text::PO
is_meta
An optional boolean value provided if this element represents a meta information
Add an auto comment
Add a comment
Add a msgid
Add a plural version of a msgid
Add a msgstr
Add a reference, which is a file and line number
Set or return the auto_comment field
Set or return the comment field
Set or return the context field
Remove the element from the list of elements in Text::PO
This only works if the element was added via Text::PO, or else you need to have set yourself the Text::PO object with the "po" method.
Return the element as a string formatted for a po file.
Set or get the encoding for this element. This defaults to an empty string
Set or get the file path where this PO element was initially be found.
Set or return the flags as array reference
Set or gets whether this element has the fuzzy flag. Default to false.
Return the value of msgid as a string
Set or gets the flag that this element represents the meta information for this PO (a.k.a portable object) file.
Meta information for a po file is stored in a unique msgid whose value is null.
Set or get the line number at which this PO element was initially be found.
Given a Text::PO::Element object, it merge its content with our element object.
The merge will not overwrite existing fields.
It returns the current object
Sets or gets the msgid for this element.
In list context, this return the element as an array. Thus. if this element has multiple lines, it will return an array of lines. In scalar context, it returns this element as a string, or if it is a multi line element, it will return an array reference.
Sets or gets the msgid version for plural. This is typically a 2-elements array. The first one singular and the second one plural.
This returns the msgid escaped and with surrounding quotes, suitable for "dump"
Returns the msgid property as a string when it has plural implemented.
Set or return the msgstr as a value without surrounding quote and without escaping.
This returns the msgstr escaped and with surrounding quotes, suitable for "dump"
"normalise" will return a string properly formatted with double quotes, multi lines if necessary, suitable for "dump"
Boolean. Sets or gets whether this element is an element with plural version of its msgid
Sets or gets the Text::PO object associated with this element. Best that you know what you are doing if you change this.
Given an array reference or a string separated by ':', it sets the file and line number for this element object.
Given a text, it returns an array reference of lines wrapped
Given a string, it returns an array reference of lines. This is called by "wrap"
Jacques Deguest <jack@deguest.jp>
https://www.gnu.org/software/gettext/manual/html_node/PO-Files.html
Copyright (c) 2020-2023 DEGUEST Pte. Ltd.
You can use, copy, modify and redistribute this package and associated files under the same terms as Perl itself.
To install Text::PO, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Text::PO
CPAN shell
perl -MCPAN -e shell install Text::PO
For more information on module installation, please visit the detailed CPAN module installation guide.