H5P NodeJS Library
    Preparing search index...

    Performs localizations with a custom fallback strategy: It tries all the namespaces specified in the tryLocalize(...) call or in the constructor (in the order of the list). If no localization was found, it will fallback to the source string passed to tryLocalize.

    Index

    Constructors

    Methods

    Constructors

    Methods

    • Tries localizing the key. If it fails (indicated by the fact that the key is part of the localized string), it will return the original source string. Tries through all the namespaces specified before falling back.

      Parameters

      • key: string

        the key to look up the translation in the i18n data

      • sourceString: string

        the original English string received from the Hub

      • language: string

        the desired language

      • Optionalnamespaces: string[]

        (optional) the namespaces to try. Will default to the namespaces passed into the constructor if unspecified.

      Returns string

      the localized string or the original English source string