Gettext class providing localization methods.

Constructors

Methods

  • Shorthand for gettext.

    Parameters

    • msgid: string

      The singular string to translate.

    • ...args: any[]

      Any additional values to use with interpolation.

    Returns string

    A translated string if found, or the original string.

    This is not a private method (starts with an underscore) it is just a shorter and standard way to call these methods.

  • Shorthand for ngettext.

    Parameters

    • msgid: string

      The singular string to translate.

    • msgid_plural: string

      The plural string to translate.

    • n: number

      The number for pluralization.

    • ...args: any[]

      Any additional values to use with interpolation.

    Returns string

    A translated string if found, or the original string.

    This is not a private method (starts with an underscore) it is just a shorter and standard way to call these methods.

  • Shorthand for npgettext.

    Parameters

    • msgctxt: string

      The message context.

    • msgid: string

      The singular string to translate.

    • msgid_plural: string

      The plural string to translate.

    • n: number

      The number for pluralization.

    • ...args: any[]

      Any additional values to use with interpolation.

    Returns string

    A translated string if found, or the original string.

    This is not a private method (starts with an underscore) it is just a shorter and standard way to call these methods.

  • Shorthand for pgettext.

    Parameters

    • msgctxt: string

      The message context.

    • msgid: string

      The singular string to translate.

    • ...args: any[]

      Any additional values to use with interpolation.

    Returns string

    A translated string if found, or the original string.

    This is not a private method (starts with an underscore) it is just a shorter and standard way to call these methods.

  • Translate a singular string with extra interpolation values.

    Parameters

    • domain: string

      The translations domain.

    • msgctxt: string

      The message context.

    • msgid: string

      The singular string to translate.

    • msgid_plural: string

      The plural string to translate.

    • n: number

      The number for pluralization.

    • ...args: any[]

      Any additional values to use with interpolation

    Returns string

    A translated string if found, or the original string.

  • Translate a singular string with extra interpolation values.

    Parameters

    • msgid: string

      The singular string to translate.

    • ...args: any[]

      Any additional values to use with interpolation.

    Returns string

    A translated string if found, or the original string.

  • Load json translations strings (In Jed 2.x format).

    Parameters

    • jsonData: IJsonData

      The translation strings plus metadata.

    • domain: string

      The translation domain, e.g. "jupyterlab".

    Returns void

  • Translate a plural string with extra interpolation values.

    Parameters

    • msgid: string

      The singular string to translate.

    • msgid_plural: string
    • n: number
    • ...args: any[]

      Any additional values to use with interpolation.

    Returns string

    A translated string if found, or the original string.

  • Translate a contextualized plural string with extra interpolation values.

    Parameters

    • msgctxt: string

      The message context.

    • msgid: string

      The singular string to translate.

    • msgid_plural: string

      The plural string to translate.

    • n: number

      The number for pluralization.

    • ...args: any[]

      Any additional values to use with interpolation

    Returns string

    A translated string if found, or the original string.

  • Translate a contextualized singular string with extra interpolation values.

    Parameters

    • msgctxt: string

      The message context.

    • msgid: string

      The singular string to translate.

    • ...args: any[]

      Any additional values to use with interpolation.

    Returns string

    A translated string if found, or the original string.

    This is not a private method (starts with an underscore) it is just a shorter and standard way to call these methods.

  • Set current context delimiter.

    Parameters

    • delimiter: string

      The delimiter to set.

    Returns void

  • Set current strings prefix.

    Parameters

    • prefix: string

      The string prefix to set.

    Returns void

  • sprintf equivalent, takes a string and some arguments to make a computed string.

    Parameters

    • fmt: string

      The string to interpolate.

    • ...args: any[]

      The variables to use in interpolation.

      strfmt("%1 dogs are in %2", 7, "the kitchen"); => "7 dogs are in the kitchen" strfmt("I like %1, bananas and %1", "apples"); => "I like apples, bananas and apples"

    Returns string