The Loc interface allows to retrieve localized strings for the current storefront.

Hierarchy

  • Loc

Methods

Methods

  • Retrieves the localized string for the given key. Note that the key will always have a fixed prefix of "me2k.editor.script.". The key is always lowercase. Please use a naming convention to avoid conflicts with other scripts. E.g. "me2k.editor.script.my_script.". The optional data parameter can be used to replace placeholders in the localized string.

    Parameters

    • key: string

      The key of the localized string. Please ensure to exclude the prefix.

    • Optional data: {
          [key: string]: any;
      }

      If specified, the localized string will be replaced with the given data. The data object should be a dictionary with the placeholder name as key and the replacement value as value which will be converted to text.

      • [key: string]: any

    Returns string

    The localized string, optionally formated with the given data.

  • Performs the replace method on the given format string with the given data. The format has to use "<<" and ">>" as key delimiters.

    Parameters

    • format: string

      The format string to replace.

    • data: {
          [key: string]: any;
      }

      The data object should be a dictionary with the placeholder name as key and the replacement value as value.

      • [key: string]: any

    Returns string

    The final formatted string.

Generated using TypeDoc