Options
All
  • Public
  • Public/Protected
  • All
Menu

Type parameters

  • TTranslationKeys: string

Hierarchy

  • TranslationModule

Index

Constructors

constructor

  • new TranslationModule<TTranslationKeys>(defaultTranslations?: Partial<Record<TTranslationKeys, string>>): TranslationModule<TTranslationKeys>
  • Type parameters

    • TTranslationKeys: string

    Parameters

    • defaultTranslations: Partial<Record<TTranslationKeys, string>> = {}

    Returns TranslationModule<TTranslationKeys>

Properties

Private _defaultTranslations

_defaultTranslations: Partial<Record<TTranslationKeys, string>> = {}

Private _translations

_translations: Partial<Record<TTranslationKeys, string>>

Methods

getTranslationByKey

  • getTranslationByKey(key: TTranslationKeys): Partial<Record<TTranslationKeys, string>>[TTranslationKeys]
  • Parameters

    • key: TTranslationKeys

      The translation key

    Returns Partial<Record<TTranslationKeys, string>>[TTranslationKeys]

    The current translation value for the given key or the key if the translation is missing

mergeTranslations

  • mergeTranslations(translations: Partial<Record<TTranslationKeys, string>>): void
  • Merges the current translations with a translation dictionary (if two keys are the same the dictionary passed as parameter takes precedence)

    Parameters

    • translations: Partial<Record<TTranslationKeys, string>>

      The dictionary containing the merged translations

    Returns void

resetTranslations

  • resetTranslations(): void
  • Resets the translations to their original state

    Returns void

setTranslations

  • setTranslations(translations: Partial<Record<TTranslationKeys, string>>): void
  • Set the current translations

    Parameters

    • translations: Partial<Record<TTranslationKeys, string>>

      The dictionary containing the translations

    Returns void

Legend

  • Constructor
  • Property
  • Method
  • Property
  • Private property

Generated using TypeDoc