[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
15.5.18 Perl
- RPMs
perl
- File extension
pl
,PL
,pm
,perl
,cgi
- String syntax
-
"abc"
-
'abc'
-
qq (abc)
-
q (abc)
-
qr /abc/
-
qx (/bin/date)
-
/pattern match/
-
?pattern match?
-
s/substitution/operators/
-
$tied_hash{"message"}
-
$tied_hash_reference->{"message"}
- etc., issue the command ‘man perlsyn’ for details
-
- gettext shorthand
__
(double underscore)- gettext/ngettext functions
gettext
,dgettext
,dcgettext
,ngettext
,dngettext
,dcngettext
- textdomain
textdomain
function- bindtextdomain
bindtextdomain
function- bind_textdomain_codeset
bind_textdomain_codeset
function- setlocale
Use
setlocale (LC_ALL, "");
- Prerequisite
use POSIX;
use Locale::TextDomain;
(included in the package libintl-perl which is available on the Comprehensive Perl Archive Network CPAN, http://www.cpan.org/).- Use or emulate GNU gettext
platform dependent: gettext_pp emulates, gettext_xs uses GNU gettext
- Extractor
xgettext -k__ -k\$__ -k%__ -k__x -k__n:1,2 -k__nx:1,2 -k__xn:1,2 -kN__ -k
- Formatting with positions
Both kinds of format strings support formatting with positions.
printf "%2\$d %1\$d", ...
(requires Perl 5.8.0 or newer)__expand("[new] replaces [old]", old => $oldvalue, new => $newvalue)
- Portability
The
libintl-perl
package is platform independent but is not part of the Perl core. The programmer is responsible for providing a dummy implementation of the required functions if the package is not installed on the target system.- po-mode marking
—
- Documentation
Included in
libintl-perl
, available on CPAN (http://www.cpan.org/).
An example is available in the ‘examples’ directory: hello-perl
.
The xgettext
parser backend for Perl differs significantly from
the parser backends for other programming languages, just as Perl
itself differs significantly from other programming languages. The
Perl parser backend offers many more string marking facilities than
the other backends but it also has some Perl specific limitations, the
worst probably being its imperfectness.
15.5.18.1 General Problems Parsing Perl Code | ||
15.5.18.2 Which keywords will xgettext look for? | Which Keywords Will xgettext Look For? | |
15.5.18.3 How to Extract Hash Keys | ||
15.5.18.4 What are Strings And Quote-like Expressions? | ||
15.5.18.5 Invalid Uses Of String Interpolation | Invalid String Interpolation | |
15.5.18.6 Valid Uses Of String Interpolation | Valid String Interpolation | |
15.5.18.7 When To Use Parentheses | ||
15.5.18.8 How To Grok with Long Lines | ||
15.5.18.9 Bugs, Pitfalls, And Things That Do Not Work | Bugs, Pitfalls, and Things That Do Not Work |
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This document was generated on January 24, 2013 using texi2html 5.0.