Locale::gettext_pp(3)
π¦ Locale::gettext_pp(3) β like, the pure Perl version of Uniforum message translation, bestie
okay so this is the manual page for Locale::gettext_pp, brought to you by the fine folks in the User Contributed Perl Documentation corner of the universe. buckle up π
β¨ NAME β¨
Locale::gettext_pp β Pure Perl Implementation of Uniforum Message Translation. that's it, that's the whole vibe. it translates messages, in pure Perl, the Uniforum way. slay.
β¨ SYNOPSIS β¨
here's the whole cast, no cap:
use Locale::gettext_pp qw(:locale_h :libintl_h);
gettext $msgid;
dgettext $domainname, $msgid;
dcgettext $domainname, $msgid, LC_MESSAGES;
ngettext $msgid, $msgid_plural, $count;
dngettext $domainname, $msgid, $msgid_plural, $count;
dcngettext $domainname, $msgid, $msgid_plural, $count, LC_MESSAGES;
pgettext $msgctxt, $msgid;
dpgettext $domainname, $msgctxt, $msgid;
dcpgettext $domainname, $msgctxt, $msgid, LC_MESSAGES;
npgettext $msgctxt, $msgid, $msgid_plural, $count;
dnpgettext $domainname, $msgctxt, $msgid, $msgid_plural, $count;
dcnpgettext $domainname, $msgctxt, $msgid, $msgid_plural, $count, LC_MESSAGES;
textdomain $domainname;
bindtextdomain $domainname, $directory;
bind_textdomain_codeset $domainname, $encoding;
my $category = LC_CTYPE;
my $category = LC_NUMERIC;
my $category = LC_TIME;
my $category = LC_COLLATE;
my $category = LC_MONETARY;
my $category = LC_MESSAGES;
my $category = LC_ALL;
literally every single one. look at them go π
β¨ DESCRIPTION β¨
so Locale::gettext_pp is the low-level interface to message translation, following the Uniforum approach β the same one GNU gettext uses, and the same one Sun's Solaris uses. iconic lineage, honestly.
π«Ά real talk though: you should normally not use this module directly. use the high-level interface Locale::TextDomain(3) instead, because it's a much simpler interface. that's the whole reason this description is deliberately kept brief, bestie. it's not lazy, it's intentional π
for the in-depth lore and the background info on the topic, go read the GNU gettext documentation at <http://www.gnu.org/manual/gettext/> β that's where the deep dives live.
β¨ FUNCTIONS β¨
heads up: this module exports nothing by default. zero. nada. every function has to be imported explicitely, either one by one or through an export tag (peep "EXPORT TAGS" below π).
gettext MSGIDβ See "FUNCTIONS" inLocale::Messages.dgettext TEXTDOMAIN, MSGIDβ See "FUNCTIONS" inLocale::Messages.dcgettext TEXTDOMAIN, MSGID, CATEGORYβ See "FUNCTIONS" inLocale::Messages.ngettext MSGID, MSGID_PLURAL, COUNTβ See "FUNCTIONS" inLocale::Messages.dngettext TEXTDOMAIN, MSGID, MSGID_PLURAL, COUNTβ See "FUNCTIONS" inLocale::Messages.dcngettext TEXTDOMAIN, MSGID, MSGID_PLURAL, COUNT, CATEGORYβ See "FUNCTIONS" inLocale::Messages.pgettext MSGCTXT, MSGIDβ See "FUNCTIONS" inLocale::Messages.dpgettext TEXTDOMAIN, MSGCTXT, MSGIDβ See "FUNCTIONS" inLocale::Messages.dcpgettext TEXTDOMAIN, MSGCTXT, MSGID, CATEGORYβ See "FUNCTIONS" inLocale::Messages.npgettext MSGCTXT, MSGID, MSGID_PLURAL, COUNTβ See "FUNCTIONS" inLocale::Messages.dnpgettext TEXTDOMAIN, MSGCTXT, MSGID, MSGID_PLURAL, COUNTβ See "FUNCTIONS" inLocale::Messages.dcnpgettext TEXTDOMAIN, MSGCTXT, MSGID, MSGID_PLURAL, COUNT, CATEGORYβ See "FUNCTIONS" inLocale::Messages.textdomain TEXTDOMAINβ See "FUNCTIONS" inLocale::Messages.bindtextdomain TEXTDOMAIN, DIRECTORYβ See "FUNCTIONS" inLocale::Messages.bind_textdomain_codeset TEXTDOMAIN, ENCODINGβ (no extra line here in the original, so no extra line from me either π«‘) and then it rolls straight into:nl_putenv ENVSPECβ See "FUNCTIONS" inLocale::Messages.setlocaleβ See "FUNCTIONS" inLocale::Messages.
β¨ CONSTANTS β¨
you can (maybe) get these same constants from POSIX(3) β go peek over there for a detailed description πΈ
LC_CTYPELC_NUMERICLC_TIMELC_COLLATELC_MONETARYLC_MESSAGESLC_ALL
See "CONSTANTS" in Locale::Messages for more information. π
β¨ EXPORT TAGS β¨
reminder bestie: this module does not export anything unless you explicitely ask for it. but you can import groups of functions via two tags, and they're both kinda great:
π use Locale::gettext_pp qw(':locale_h')
this one imports the functions that are normally defined in the C include file locale.h. be so fr, that's a whole squad:
gettext()dgettext()dcgettext()ngettext()dngettext()dcngettext()pgettext()β Introduced with libintl-perl 1.17.dpgettext()β Introduced with libintl-perl 1.17.dcpgettext()β Introduced with libintl-perl 1.17.npgettext()β Introduced with libintl-perl 1.17.dnpgettext()β Introduced with libintl-perl 1.17.dcnpgettext()β Introduced with libintl-perl 1.17.textdomain()bindtextdomain()bind_textdomain_codeset()
π use Locale::gettext_pp (':libintl_h')
this one imports the locale category constants. the whole set, no crumbs:
LC_CTYPELC_NUMERICLC_TIMELC_COLLATELC_MONETARYLC_MESSAGESLC_ALL
β¨ AUTHOR β¨
Copyright (C) 2002-2017 Guido Flohr <http://www.guido-flohr.net/> (<mailto:guido.flohr@cantanea.com>), all rights reserved.
See the source code for details!code for details! β and yes, that double "code for details!" really is what the page says. π i'm not fixing it, that's his typo and it's lowkey iconic. all rights reserved, periodt.
β¨ SEE ALSO β¨
go touch some other docs, bestie, they're all linked up:
Locale::TextDomain(3pm), Locale::Messages(3pm), Encode(3pm), perllocale(3pm), POSIX(3pm), perl(1), gettext(1), gettext(3)
π and that's the whole page! mwah π
okay bye, this was perl v5.42.0, dated 2025-01-22 β go translate something cute, you absolute main character π¦πβ¨
π¦ where this page comes from
- opensuse-leap 16.0: perl-libintl-perl 1.350.0-160000.2.2 Β· GPL-3.0-or-later
- opensuse-leap 16.0: perl-libintl-perl 1.350.0-160000.2.2 Β· GPL-3.0-or-later
- opensuse-leap 16.0: perl-libintl-perl 1.350.0-160000.2.2 Β· GPL-3.0-or-later
- opensuse-leap 16.0: perl-libintl-perl 1.350.0-160000.2.2 Β· GPL-3.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms