translate(key, options = { showAsUndefined: false, showBrackets: true }) {
    if (key === '&nsbp;') {
      return '';
    }

    if (!options?.showAsUndefined && options?.showBrackets === undefined) {
      options.showBrackets = true;
    }

    let messages = this.language.messages;
    if (options?.language) {
      messages = this.loadedLanguages.get(options?.language) || messages;
    }

    // Substitue The English Expression if missing
    if (!messages[key]) {
      if (options.showAsUndefined) {
        return undefined;
      }

      messages = this.state.defaultLocale?.messages;
      if (!messages || !messages[key]) {
        return `${options.showBrackets ? '[' : ''}${key}${options.showBrackets ? ']' : ''}`;
      }
      return this.state.defaultLocale.messages[key].value;
    }

    return messages[key].value;
  }
/**
   * Takes a translation key and returns the translation in the current locale
   * @param {string} key  The key to search for on the string
   * @param {object} [options] Supports showBrackets and maybe more in the future
   * @returns {string|undefined} a translated string, or nothing, depending on configuration
   */
Takes a translation key and returns the translation in the current locale
@param {string} key  The key to search for on the string
@param {object} [options] Supports showBrackets and maybe more in the future
@returns {string|undefined} a translated string, or nothing, depending on configuration
Takes a translation key and returns the translation in the current locale @param { string } key The key to search for on the string @param { object } [ options ] Supports showBrackets and maybe more in the future @returns { string|undefined } a translated string or nothing depending on configuration
translate(key, options = { showAsUndefined: false, showBrackets: true }) {
    if (key === '&nsbp;') {
      return '';
    }
    if (!options?.showAsUndefined && options?.showBrackets === undefined) {
      options.showBrackets = true;
    }
    let messages = this.language.messages;
    if (options?.language) {
      messages = this.loadedLanguages.get(options?.language) || messages;
    }
    if (!messages[key]) {
      if (options.showAsUndefined) {
        return undefined;
      }
      messages = this.state.defaultLocale?.messages;
      if (!messages || !messages[key]) {
        return `${options.showBrackets ? '[' : ''}${key}${options.showBrackets ? ']' : ''}`;
      }
      return this.state.defaultLocale.messages[key].value;
    }
    return messages[key].value;
  }
translate ( key , options = { showAsUndefined : false , showBrackets : true } ) { if ( key === '&nsbp;' ) { return '' ; } if ( ! options ?. showAsUndefined && options ?. showBrackets === undefined ) { options . showBrackets = true ; } let messages = this . language . messages ; if ( options ?. language ) { messages = this . loadedLanguages . get ( options ?. language ) || messages ; } if ( ! messages [ key ] ) { if ( options . showAsUndefined ) { return undefined ; } messages = this . state . defaultLocale ?. messages ; if ( ! messages || ! messages [ key ] ) { return ` ${ options . showBrackets ? '[' : '' } ${ key } ${ options . showBrackets ? ']' : '' } ` ; } return this . state . defaultLocale . messages [ key ] . value ; } return messages [ key ] . value ; }
Takes a translation key and returns the translation in the current locale
 @param {string} key  The key to search for on the string
 @param {object} [options] Supports showBrackets and maybe more in the future
 @returns {string|undefined} a translated string, or nothing, depending on configuration
Takes a translation key and returns the translation in the current locale @param { string } key The key to search for on the string @param { object } [ options ] Supports showBrackets and maybe more in the future @returns { string|undefined } a translated string or nothing depending on configuration
// Substitue The English Expression if missing