NAME
Text::PO::Element - PO Element
SYNOPSIS
use Text::PO::Element;
my $po = Text::PO::Element->new;
$po->debug( 2 );
$po->dump;
VERSION
v0.2.1
DESCRIPTION
This is the class for PO elements.
CONSTRUCTOR
new
Create a new Text::PO::Element object acting as an accessor.
ATTRIBUTES
A Text::PO::Element
object has the following fields :
- 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
- 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
- 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
- line
-
The line at which this l10n was found. This is set when automatic parsing was executed
- po
-
The parent
Text::PO
object - is_meta
-
An optional boolean value provided if this element represents a meta information
METHODS
add_auto_comment
Add an auto comment
add_comment
Add a comment
add_msgid
Add a msgid
add_msgid_plural
Add a plural version of a msgid
add_msgstr
Add a msgstr
add_reference
Add a reference, which is a file and line number
auto_comment
Set or return the auto_comment field
comment
Set or return the comment field
context
Set or return the context field
delete
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.
dump
Return the element as a string formatted for a po file.
flags
Set or return the flags as array reference
id
Return the value of msgid as a string
is_meta
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.
merge( Text::PO::Element )
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
msgstr
Set or return the msgstr as a value without surrounding quote and without escaping.
msgid_as_string
This returns the msgid escaped and with surrounding quotes, suitable for "dump"
msgid_plural_as_string
Returns the msgid
property as a string when it has plural implemented.
msgstr_as_string
This returns the msgstr escaped and with surrounding quotes, suitable for "dump"
normalise
"normalise" will return a string properly formatted with double quotes, multi lines if necessary, suitable for "dump"
po
Sets or gets the Text::PO object associated with this element. Best that you know what you are doing if you change this.
reference
Given an array reference or a string separated by ':', it sets the file and line number for this element object.
wrap
Given a text, it returns an array reference of lines wrapped
wrap_line
Given a string, it returns an array reference of lines. This is called by "wrap"
AUTHOR
Jacques Deguest <jack@deguest.jp>
SEE ALSO
https://www.gnu.org/software/gettext/manual/html_node/PO-Files.html
COPYRIGHT & LICENSE
Copyright (c) 2020-2021 DEGUEST Pte. Ltd.
You can use, copy, modify and redistribute this package and associated files under the same terms as Perl itself.