The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

Name

qbit::GetText

Description

Functions to internatilization application.

More information on GNU.org.

qbit::GetText use pure perl version of gettext by default. If you need to use XS version, set envirement variable FORCE_GETTEXT_XS to TRUE;

Functions

gettext

Arguments:

  • $text - string, message;

  • @params - array of strings, placeholders.

Return value: string, localized message.

ngettext

Arguments:

  • $text - string, message;

  • $plural - string, plural form of message;

  • $n - number, quantity of something;

  • @params - array of strings, placeholders.

Return value: string, localized message.

pgettext

Arguments:

  • $context - string, message context;

  • $text - string, message;

  • @params - array of strings, placeholders.

Return value: string, localized message.

npgettext

Arguments:

  • $context - string, message context;

  • $text - string, message;

  • $plural - string, plural form of message;

  • $n - number, quantity of something;

  • @params - array of strings, placeholders.

Return value: string, localized message.

d_*gettext

Deffered versions of *gettext functions.

 my $s = d_ngettext('site', 'sites', 1);
 # equivalent
 my $s = sub {ngettext('site', 'sites', 1)};

set_locale

Arguments as hash:

  • lang - string, locale (ru_RU, en_UK, ...);

  • path - string, path to locales;

  • project - string, project name.

Path with locales must be $opts{'path'}/$opts{'lang'}/LC_MESSAGES/$opts{'project'}.mo.