Options
All
  • Public
  • Public/Protected
  • All
Menu

Module translation

Index

Type aliases

TranslationBundle

TranslationBundle: { __: any; _n: any; _np: any; _p: any; dcnpgettext: any; gettext: any; ngettext: any; npgettext: any; pgettext: any }

Bundle of gettext-based translation functions.

The calls to the functions in this bundle will be automatically extracted by jupyterlab-translate package to generate translation template files if the bundle is assigned to:

  • variable named trans,
  • public attribute named trans (this.trans),
  • private attribute named trans (this._trans),
  • trans attribute props variable (props.trans),
  • trans attribute props attribute (this.props.trans)

Type declaration

  • __: function
    • __(msgid: string, ...args: any[]): string
    • Alias for gettext (translate strings without number inflection)

      Parameters

      • msgid: string

        message (text to translate)

      • Rest ...args: any[]

      Returns string

  • _n: function
    • _n(msgid: string, msgid_plural: string, n: number, ...args: any[]): string
    • Alias for ngettext (translate accounting for plural forms)

      Parameters

      • msgid: string

        message for singular

      • msgid_plural: string

        message for plural

      • n: number

        determines which plural form to use

      • Rest ...args: any[]

      Returns string

  • _np: function
    • _np(msgctxt: string, msgid: string, msgid_plural: string, n: number, ...args: any[]): string
    • Alias for npgettext (translate accounting for plural forms in given context)

      Parameters

      • msgctxt: string

        context

      • msgid: string

        message for singular

      • msgid_plural: string

        message for plural

      • n: number

        number used to determine which plural form to use

      • Rest ...args: any[]

      Returns string

  • _p: function
    • _p(msgctxt: string, msgid: string, ...args: any[]): string
    • Alias for pgettext (translate in given context)

      Parameters

      • msgctxt: string

        context

      • msgid: string

        message (text to translate)

      • Rest ...args: any[]

      Returns string

  • dcnpgettext: function
    • dcnpgettext(domain: string, msgctxt: string, msgid: string, msgid_plural: string, n: number, ...args: any[]): string
    • Parameters

      • domain: string
      • msgctxt: string
      • msgid: string
      • msgid_plural: string
      • n: number
      • Rest ...args: any[]

      Returns string

  • gettext: function
    • gettext(msgid: string, ...args: any[]): string
    • Parameters

      • msgid: string
      • Rest ...args: any[]

      Returns string

  • ngettext: function
    • ngettext(msgid: string, msgid_plural: string, n: number, ...args: any[]): string
    • Parameters

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

      Returns string

  • npgettext: function
    • npgettext(msgctxt: string, msgid: string, msgid_plural: string, n: number, ...args: any[]): string
    • Parameters

      • msgctxt: string
      • msgid: string
      • msgid_plural: string
      • n: number
      • Rest ...args: any[]

      Returns string

  • pgettext: function
    • pgettext(msgctxt: string, msgid: string, ...args: any[]): string
    • Parameters

      • msgctxt: string
      • msgid: string
      • Rest ...args: any[]

      Returns string

Variables

ITranslator

ITranslator: Token<ITranslator>

ITranslatorConnector

ITranslatorConnector: Token<ITranslatorConnector>

Const nullTranslator

nullTranslator: NullTranslator

The application null translator instance that just returns the same text. Also provides interpolation.

Functions

requestTranslationsAPI

  • requestTranslationsAPI<T>(translationsUrl?: string, locale?: string, init?: RequestInit, serverSettings?: ISettings): Promise<T>
  • Call the API extension

    Type parameters

    • T

    Parameters

    • Optional translationsUrl: string
    • Optional locale: string

      API REST end point for the extension

    • Optional init: RequestInit

      Initial values for the request

    • Optional serverSettings: ISettings

    Returns Promise<T>

    The response body interpreted as JSON

Generated using TypeDoc