src/auto.js
function WfI18n (translation = {}, fallback = null, locale = 'en') {
    this.translation = translation
    this.locale = locale
    this.fallback = fallback

    this.t = (key) => {
      let result = this.translation[this.locale]
      if (!result) { result = this.translation[this.fallback] }
      if (!result) { throw new WfException(`Translation for locale "${this.locale}" not found.`) }
      const keys = key.split('.')
      if (keys.length === 0) { throw new WfException('Empty translation key.') }
      for (let i = 0; i < keys.length; i++) {
        result = result[keys[i]]
        if (!result) {
          setTimeout(() => {
            throw new WfException(`Translation for key "${key}" not found.`)
          })
          return key
        }
      }
      return result
    }
    return {
      t: this.t
    }
  }
function WfI18n (translation = {}, fallback = null, locale = 'en') {
    this.translation = translation
    this.locale = locale
    this.fallback = fallback

    this.t = (key) => {
      let result = this.translation[this.locale]
      if (!result) { result = this.translation[this.fallback] }
      if (!result) { throw new WfException(`Translation for locale "${this.locale}" not found.`) }
      const keys = key.split('.')
      if (keys.length === 0) { throw new WfException('Empty translation key.') }
      for (let i = 0; i < keys.length; i++) {
        result = result[keys[i]]
        if (!result) {
          setTimeout(() => {
            throw new WfException(`Translation for key "${key}" not found.`)
          })
          return key
        }
      }
      return result
    }
    return {
      t: this.t
    }
  }
function WfI18n ( translation = { } , fallback = null , locale = 'en' ) { this . translation = translation this . locale = locale this . fallback = fallback this . t = ( key ) => { let result = this . translation [ this . locale ] if ( ! result ) { result = this . translation [ this . fallback ] } if ( ! result ) { throw new WfException ( ` ${ this . locale } ` ) } const keys = key . split ( '.' ) if ( keys . length === 0 ) { throw new WfException ( 'Empty translation key.' ) } for ( let i = 0 ; i < keys . length ; i ++ ) { result = result [ keys [ i ] ] if ( ! result ) { setTimeout ( ( ) => { throw new WfException ( ` ${ key } ` ) } ) return key } } return result } return { t : this . t } }
Custom translator to replace `i18next`
Custom translator to replace i18next