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" in Locale::Messages.
  • dgettext TEXTDOMAIN, MSGID β€” See "FUNCTIONS" in Locale::Messages.
  • dcgettext TEXTDOMAIN, MSGID, CATEGORY β€” See "FUNCTIONS" in Locale::Messages.
  • ngettext MSGID, MSGID_PLURAL, COUNT β€” See "FUNCTIONS" in Locale::Messages.
  • dngettext TEXTDOMAIN, MSGID, MSGID_PLURAL, COUNT β€” See "FUNCTIONS" in Locale::Messages.
  • dcngettext TEXTDOMAIN, MSGID, MSGID_PLURAL, COUNT, CATEGORY β€” See "FUNCTIONS" in Locale::Messages.
  • pgettext MSGCTXT, MSGID β€” See "FUNCTIONS" in Locale::Messages.
  • dpgettext TEXTDOMAIN, MSGCTXT, MSGID β€” See "FUNCTIONS" in Locale::Messages.
  • dcpgettext TEXTDOMAIN, MSGCTXT, MSGID, CATEGORY β€” See "FUNCTIONS" in Locale::Messages.
  • npgettext MSGCTXT, MSGID, MSGID_PLURAL, COUNT β€” See "FUNCTIONS" in Locale::Messages.
  • dnpgettext TEXTDOMAIN, MSGCTXT, MSGID, MSGID_PLURAL, COUNT β€” See "FUNCTIONS" in Locale::Messages.
  • dcnpgettext TEXTDOMAIN, MSGCTXT, MSGID, MSGID_PLURAL, COUNT, CATEGORY β€” See "FUNCTIONS" in Locale::Messages.
  • textdomain TEXTDOMAIN β€” See "FUNCTIONS" in Locale::Messages.
  • bindtextdomain TEXTDOMAIN, DIRECTORY β€” See "FUNCTIONS" in Locale::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" in Locale::Messages.
  • setlocale β€” See "FUNCTIONS" in Locale::Messages.

✨ CONSTANTS ✨

you can (maybe) get these same constants from POSIX(3) β€” go peek over there for a detailed description 🌸

  • LC_CTYPE
  • LC_NUMERIC
  • LC_TIME
  • LC_COLLATE
  • LC_MONETARY
  • LC_MESSAGES
  • LC_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_CTYPE
  • LC_NUMERIC
  • LC_TIME
  • LC_COLLATE
  • LC_MONETARY
  • LC_MESSAGES
  • LC_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 πŸ¦‹πŸ’–βœ¨