cytoplasmic
    Preparing search index...

    Class DummyTranslationProvider

    A translation provider that doesn't translate strings but does implement parameter interpolation via braces (e.g. _('Hello, {name}!', {name: 'World'})).

    When used with _n it will also use the plural string when n is not equal to 1 or -1.

    This class can be extended to implement a simple translation provider with the above mentioned features. Simply override the getMessage method.

    Implements

    Index

    Constructors

    Properties

    onLanguageChange: Observable<void> = ...

    When triggered all previously translated strings will be retranslated.

    Methods

    • Override this method in a subclass to provide actual translations. Simply return the translated string or undefined if the string doesn't exist.

      Parameters

      • _msgid: string

        The translation key, translation source, or default translation

      • _parameters: Partial

        The translation parameter object, this can be used to apply more advanced pluralization rules.

      Returns undefined | string

      The translated string or undefined if not found.

    • Translate a string for use with _.

      Parameters

      • msgid: string

        Translation key

      • parameters: Partial

        Translation parameter object

      Returns string

    • Translate a string for use with _n.

      Parameters

      • msgid: string

        Translation key

      • msgidPlural: string

        Translation key, plural

      • parameters: { n: number } & Partial<Record<string, string | number>>

        Translation parameter object

      Returns string