Reference

class Translations(headers, messages, plural)
Arguments:
  • string> headers (Immutable.Map<string,) – MO headers.
  • Immutable.List<string>> messages (Immutable.Map<string,) – The translations.
  • => number plural ((number)) – Function to resolve plural forms.

Usually this class should not be created manually.

Translations.gettext(msgid)
Arguments:
  • msgid (string) – Message ID to look up.
Returns:

Translated string (or input string if not found).

Translations.ngettext(msgid, msgid_plural, count)
Arguments:
  • msgid (string) – Message ID for the singular string.
  • msgid_plural (string) – Message ID for the plural string.
  • count (number) – Used to detect whether plural or singular form should be used.
Returns:

Translated string (or one of the input strings if not found).

set_catalog(catalog)
Arguments:
  • catalog (Gettext) –

Set a translation as the currently active, global translations.

gettext(msgid)
Arguments:
  • msgid (string) – Message ID to look up.
Returns:

Translated string (or input string if not found).

Uses the translations set by set_catalog() to translate a message ID.

ngettext(msgid, msgid_plural, count)
Arguments:
  • msgid (string) – Message ID for the singular string.
  • msgid_plural (string) – Message ID for the plural string.
  • count (number) – Used to detect whether plural or singular form should be used.
Returns:

Translated string (or one of the input strings if not found).

Uses the translations set by set_catalog() to translate a message ID.