Next: PHP Hypertext Preprocessor, Previous: Tcl - Tk’s scripting language, Up: Individual Programming Languages [Contents][Index]
perl
perl, libintl-perl
pl
, PL
, pm
, perl
, cgi
"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"}
__
(double underscore)
gettext
, dgettext
, dcgettext
, ngettext
,
dngettext
, dcngettext
, pgettext
, dpgettext
,
dcpgettext
, npgettext
, dnpgettext
,
dcnpgettext
textdomain
function
bindtextdomain
function
bind_textdomain_codeset
function
Use setlocale (LC_ALL, "");
use POSIX;
use Locale::TextDomain;
(included in the package libintl-perl
which is available on the Comprehensive Perl Archive Network CPAN,
https://www.cpan.org/).
platform dependent: gettext_pp emulates, gettext_xs uses GNU gettext
xgettext -k__ -k\$__ -k%__ -k__x -k__n:1,2 -k__nx:1,2 -k__xn:1,2
-kN__ -kN__n:1,2 -k__p:1c,2 -k__np:1c,2,3 -kN__p:1c,2 -kN__np:1c,2,3
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)
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.
—
Included in libintl-perl
, available on CPAN
(https://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.
Next: PHP Hypertext Preprocessor, Previous: Tcl - Tk’s scripting language, Up: Individual Programming Languages [Contents][Index]