lib/module/locales.js
function getText(locale, ...args) {
    const key = args[0];
    if (!key) return null;

    // try locale
    let resource = ebLocales[locale] || {};
    let text = resource[key];
    if (text === undefined && locale !== 'en-us') {
      // try en-us
      resource = ebLocales['en-us'] || {};
      text = resource[key];
    }
    // equal key
    if (text === undefined) {
      text = key;
    }
    // format
    args[0] = text;
    return localeutil.getText.apply(localeutil, args);
  }
function getText(locale, ...args) {
    const key = args[0];
    if (!key) return null;

    // try locale
    let resource = ebLocales[locale] || {};
    let text = resource[key];
    if (text === undefined && locale !== 'en-us') {
      // try en-us
      resource = ebLocales['en-us'] || {};
      text = resource[key];
    }
    // equal key
    if (text === undefined) {
      text = key;
    }
    // format
    args[0] = text;
    return localeutil.getText.apply(localeutil, args);
  }
function getText ( locale , ... args ) { const key = args [ 0 ] ; if ( ! key ) return null ; // try locale let resource = ebLocales [ locale ] || { } ; let text = resource [ key ] ; if ( text === undefined && locale !== 'en-us' ) { // try en-us resource = ebLocales [ 'en-us' ] || { } ; text = resource [ key ] ; } // equal key if ( text === undefined ) { text = key ; } // format args [ 0 ] = text ; return localeutil . getText . apply ( localeutil , args ) ; }
based on koa-locales

https://github.com/koajs/locales/blob/master/index.js
based on koa - locales