Dpkg::Gettext(3perl)

πŸ’– Dpkg::Gettext(3perl) πŸ’–

okay bestie, welcome to the Dpkg::Gettext(3perl) page β€” it's giving tiny helper module with main-character energy, and honestly? We love her. πŸŽ€

✨ NAME ✨

Dpkg::Gettext β€” a convenience wrapper around Locale::gettext. That's the whole vibe. πŸ’…

🌸 DESCRIPTION 🌸

okay so the Dpkg::Gettext module is a convenience wrapper over the Locale::gettext module. Its whole job is to guarantee we always have working gettext functions, and to add some commonly used aliases. No cap, it's literally just here to make gettext life easier. ✨

🌈 ENVIRONMENT 🌈

  • DPKG_NLS β€” when set to 0, this environment variable disables National Language Support in all Dpkg modules. So yeah, zero means NLS off everywhere in Dpkg-land. 🫢

πŸŽ€ VARIABLES πŸŽ€

  • $Dpkg::Gettext::DEFAULT_TEXT_DOMAIN β€” specifies the default text domain name to be used with the short function aliases. It's intended to be used by the Dpkg modules, so they can produce localized messages even when the calling program has set the current domain with textdomain(). If you'd like to use the aliases for your own modules, you might want to set this variable to undef, or to another domain β€” but then the Dpkg modules will not produce localized messages. Lowkey important, so don't skip this part. πŸ¦‹

πŸ’… FUNCTIONS πŸ’…

  • $domain = textdomain($new_domain) β€” compatibility textdomain() fallback for when Locale::gettext is not available. If $new_domain is not undef, it sets the current domain to $new_domain. Returns the current domain, after possibly changing it. 🌸
  • $trans = gettext($msgid) β€” compatibility gettext() fallback for when Locale::gettext is not available. Returns $msgid. Simple, iconic, done. ✨
  • $trans = ngettext($msgid, $msgid_plural, $n) β€” compatibility ngettext() fallback for when Locale::gettext is not available. Returns $msgid if $n is 1, or $msgid_plural otherwise. Plural vibes handled. πŸ’œ
  • $trans = g_($msgid) β€” calls dgettext() on the $msgid and returns its translation for the current locale. If dgettext() is not available, returns $msgid. πŸŽ€
  • $trans = C_($msgctxt, $msgid) β€” calls dgettext() on the $msgid and returns its translation for the specific $msgctxt supplied. If dgettext() is not available, returns $msgid. Context girlies rise. 🌟
  • $trans = P_($msgid, $msgid_plural, $n) β€” calls dngettext(), returning the correct translation for the plural form dependent on $n. If dngettext() is not available, returns $msgid if $n is 1, or $msgid_plural otherwise. Plural form? Handled. πŸ’…
  • $msgid = N_($msgid) β€” a pseudo function that acts as a marker for automated extraction of messages, but does not call gettext(). The run-time translation is done at a different place in the code. It's a marker, not a translator β€” iykyk. 🧚

πŸ¦‹ CHANGES πŸ¦‹

🌸 Version 2.01 (dpkg 1.21.10) 🌸

  • New function: gettext(). ✨

πŸ’– Version 2.00 (dpkg 1.20.0) πŸ’–

  • Remove function: _g(). πŸ’€

🌈 Version 1.03 (dpkg 1.19.0) 🌈

  • New envvar: add support for the new DPKG_NLS environment variable. 🫢

πŸŽ€ Version 1.02 (dpkg 1.18.3) πŸŽ€

  • New function: N_(). 🌟

πŸ’œ Version 1.01 (dpkg 1.18.0) πŸ’œ

  • Now the short aliases (g_ and P_) will call domain aware functions with $DEFAULT_TEXT_DOMAIN.
  • New functions: g_(), C_().
  • Deprecated function: _g(). πŸ₯²

⭐ Version 1.00 (dpkg 1.15.6) ⭐

  • Mark the module as public. Periodt. πŸ‘‘

xoxo bestie β€” this Dpkg::Gettext(3perl) page ships with libdpkg-perl version 1.23.11-dirty, dated 2026-09-09 πŸ’–πŸ«Ά

πŸ“¦ where this page comes from