gettext: Perl
1
1 15.5.18 Perl
1 ------------
1
1 RPMs
1 perl
1
1 File extension
1 ‘pl’, ‘PL’, ‘pm’, ‘perl’, ‘cgi’
1
1 String syntax
1
1 • ‘"abc"’
1
1 • ‘'abc'’
1
1 • ‘qq (abc)’
1
1 • ‘q (abc)’
1
1 • ‘qr /abc/’
1
1 • ‘qx (/bin/date)’
1
1 • ‘/pattern match/’
1
1 • ‘?pattern match?’
1
1 • ‘s/substitution/operators/’
1
1 • ‘$tied_hash{"message"}’
1
1 • ‘$tied_hash_reference->{"message"}’
1
1 • etc., issue the command ‘man perlsyn’ for details
1
1 gettext shorthand
1 ‘__’ (double underscore)
1
1 gettext/ngettext functions
1 ‘gettext’, ‘dgettext’, ‘dcgettext’, ‘ngettext’, ‘dngettext’,
1 ‘dcngettext’
1
1 textdomain
1 ‘textdomain’ function
1
1 bindtextdomain
1 ‘bindtextdomain’ function
1
1 bind_textdomain_codeset
1 ‘bind_textdomain_codeset’ function
1
1 setlocale
1 Use ‘setlocale (LC_ALL, "");’
1
1 Prerequisite
1 ‘use POSIX;’
1 ‘use Locale::TextDomain;’ (included in the package libintl-perl
1 which is available on the Comprehensive Perl Archive Network CPAN,
1 http://www.cpan.org/).
1
1 Use or emulate GNU gettext
1 platform dependent: gettext_pp emulates, gettext_xs uses GNU
1 gettext
1
1 Extractor
1 ‘xgettext -k__ -k\$__ -k%__ -k__x -k__n:1,2 -k__nx:1,2 -k__xn:1,2
1 -kN__ -k’
1
1 Formatting with positions
1 Both kinds of format strings support formatting with positions.
1 ‘printf "%2\$d %1\$d", ...’ (requires Perl 5.8.0 or newer)
1 ‘__expand("[new] replaces [old]", old => $oldvalue, new =>
1 $newvalue)’
1
1 Portability
1 The ‘libintl-perl’ package is platform independent but is not part
1 of the Perl core. The programmer is responsible for providing a
1 dummy implementation of the required functions if the package is
1 not installed on the target system.
1
1 po-mode marking
1 —
1
1 Documentation
1 Included in ‘libintl-perl’, available on CPAN
1 (http://www.cpan.org/).
1
1 An example is available in the ‘examples’ directory: ‘hello-perl’.
1
1 The ‘xgettext’ parser backend for Perl differs significantly from the
1 parser backends for other programming languages, just as Perl itself
1 differs significantly from other programming languages. The Perl parser
1 backend offers many more string marking facilities than the other
1 backends but it also has some Perl specific limitations, the worst
1 probably being its imperfectness.
1
Menu