|
902.
|
|
|
OVERRIDING THE found_string FUNCTION
|
|
|
type: =head2
|
|
|
|
OVERRIDING THE found_string FUNCTION
|
|
Translated and reviewed by
Malcolm Parsons
|
|
|
|
Located in
lib/Locale/Po4a/Xml.pm:582
|
|
903.
|
|
|
Another simple step is to override the function "found_string", which receives the extracted strings from the parser, in order to translate them. There you can control which strings you want to translate, and perform transformations to them before or after the translation itself.
|
|
|
type: textblock
|
|
|
|
Another simple step is to override the function "found_string", which receives the extracted strings from the parser, in order to translate them. There you can control which strings you want to translate, and perform transformations to them before or after the translation itself.
|
|
Translated and reviewed by
Malcolm Parsons
|
|
|
|
Located in
lib/Locale/Po4a/Xml.pm:584
|
|
904.
|
|
|
It receives the extracted text, the reference on where it was, and a hash that contains extra information to control what strings to translate, how to translate them and to generate the comment.
|
|
|
type: textblock
|
|
|
|
It receives the extracted text, the reference on where it was, and a hash that contains extra information to control what strings to translate, how to translate them and to generate the comment.
|
|
Translated and reviewed by
Malcolm Parsons
|
|
|
|
Located in
lib/Locale/Po4a/Xml.pm:589
|
|
905.
|
|
|
The content of these options depends on the kind of string it is (specified in an entry of this hash):
|
|
|
type: textblock
|
|
|
|
The contents of these options depends on the kind of string it is (specified in an entry of this hash):
|
|
Translated and reviewed by
Malcolm Parsons
|
|
|
|
Located in
lib/Locale/Po4a/Xml.pm:593
|
|
906.
|
|
|
type="tag"
|
|
|
type: =item
|
|
|
|
type="tag"
|
|
Translated and reviewed by
Malcolm Parsons
|
|
|
|
Located in
lib/Locale/Po4a/Xml.pm:598
|
|
907.
|
|
|
The found string is the content of a translatable tag. The entry "tag_options" contains the option characters in front of the tag hierarchy in the module "tags" option.
|
|
|
type: textblock
|
|
|
|
The found string is the content of a translatable tag. The entry "tag_options" contains the option characters in front of the tag hierarchy in the module "tags" option.
|
|
Translated and reviewed by
Malcolm Parsons
|
|
|
|
Located in
lib/Locale/Po4a/Xml.pm:600
|
|
908.
|
|
|
type="attribute"
|
|
|
type: =item
|
|
|
|
type="attribute"
|
|
Translated and reviewed by
Malcolm Parsons
|
|
|
|
Located in
lib/Locale/Po4a/Xml.pm:604
|
|
909.
|
|
|
Means that the found string is the value of a translatable attribute. The entry "attribute" has the name of the attribute.
|
|
|
type: textblock
|
|
|
|
Means that the found string is the value of a translatable attribute. The entry "attribute" has the name of the attribute.
|
|
Translated and reviewed by
Malcolm Parsons
|
|
|
|
Located in
lib/Locale/Po4a/Xml.pm:606
|
|
910.
|
|
|
It must return the text that will replace the original in the translated document. Here's a basic example of this function:
|
|
|
type: textblock
|
|
|
|
It must return the text that will replace the original in the translated document. Here's a basic example of this function:
|
|
Translated and reviewed by
Malcolm Parsons
|
|
|
|
Located in
lib/Locale/Po4a/Xml.pm:611
|
|
911.
|
|
|
sub found_string {
my ($self,$text,$ref,$options)=@_;
$text = $self->translate($text,$ref,"type ".$options->{'type'},
'wrap'=>$self->{options}{'wrap'});
return $text;
}
|
|
|
type: verbatim
|
|
|
represents a line break.
Start a new line in the equivalent position in the translation.
|
|
|
represents a space character.
Enter a space in the equivalent position in the translation.
|
|
|
|
sub found_string {
my ($self,$text,$ref,$options)=@_;
$text = $self->translate($text,$ref,"type ".$options->{'type'},
'wrap'=>$self->{options}{'wrap'});
return $text;
}
|
|
Translated and reviewed by
Malcolm Parsons
|
|
|
|
Located in
lib/Locale/Po4a/Xml.pm:614
|