@aracna/core - v1.5.0
    Preparing search index...

    Class Localization<T>

    The Localization class is used to localize anything that can be localized.

    • The language will persist in the storage, by default it will be stored in memory.
    • The path of the localized string supports dot notation, for example: 'path.to.the.value'.
    • The variables support dot notation as well and can be used inside the localized string, for example: 'Hello {name}!'.
    • The instance also supports default variables, which can be overridden by the variables passed to the get method.

    Aracna Reference

    Type Parameters

    Index

    Constructors

    Properties

    language: string

    The language that will be used to localize.

    The packs that will be used to localize.

    storage: Storage

    The storage that will be used to store the language.

    storageKey: string

    The key that will be used to store the language.

    variables: T

    The default variables that will be used to localize.

    Methods

    • Retrieves the localized string from the pack. Optionally you can pass variables that will be used to replace the variables inside the localized string.

      Type Parameters

      Parameters

      • path: string
      • Optionalvariables: T

      Returns string

    • Retrieves the localized string from the pack. Optionally you can pass variables that will be used to replace the variables inside the localized string.

      Type Parameters

      Parameters

      • language: string
      • path: string
      • Optionalvariables: T

      Returns string

    • Checks if the pack has the path.

      Parameters

      • path: string

      Returns boolean

    • Checks if the pack has the path.

      Parameters

      • language: string
      • path: string

      Returns boolean

    • Retrieves the language from the storage and sets it.

      Returns Promise<void | Error>