How to use the i18next.addResources function in i18next

To help you get started, we’ve selected a few i18next examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github letsdoitworld / World-Cleanup-Day / mobile-app / src / config / i18n.js View on Github external
// i18n.addResources('da', 'general', require('../trans/da.json'));
// i18n.addResources('de', 'general', require('../trans/de.json'));

// i18n.addResources('ee', 'general', require('../trans/ee.json'));
// i18n.addResources('el', 'general', require('../trans/el.json'));
i18n.addResources('en', 'general', require('../trans/en.json'));
i18n.addResources('es', 'general', require('../trans/es.json'));
// i18n.addResources('et', 'general', require('../trans/et.json'));
// i18n.addResources('eu', 'general', require('../trans/eu.json'));

// i18n.addResources('fa', 'general', require('../trans/fa.json'));
// i18n.addResources('fi', 'general', require('../trans/fi.json'));
// i18n.addResources('fil', 'general', require('../trans/fil.json'));
// i18n.addResources('fj', 'general', require('../trans/fj.json'));
i18n.addResources('fr', 'general', require('../trans/fr.json'));

// i18n.addResources('ga', 'general', require('../trans/ga.json'));
// i18n.addResources('gd', 'general', require('../trans/gd.json'));
// i18n.addResources('gl', 'general', require('../trans/gl.json'));

// i18n.addResources('ha', 'general', require('../trans/ha.json'));
// i18n.addResources('haw', 'general', require('../trans/haw.json'));
// i18n.addResources('he', 'general', require('../trans/he.json'));
i18n.addResources('hi', 'general', require('../trans/hi.json'));
// i18n.addResources('hmn', 'general', require('../trans/hmn.json'));
// i18n.addResources('hr', 'general', require('../trans/hr.json'));
// i18n.addResources('ht', 'general', require('../trans/ht.json'));
// i18n.addResources('hu', 'general', require('../trans/hu.json'));
// i18n.addResources('hy', 'general', require('../trans/hy.json'));

// Android sends 'in' as language id for Indonesia (it should be id)
github itchio / itch / appsrc / i18next / backend.js View on Github external
on_event (payload) {
    if (payload.action_type === AppConstants.LOCALE_UPDATE_DOWNLOADED) {
      log(opts, `Adding resources to ${payload.lang}`)
      i18next.addResources(
       payload.lang,
       'translation', /* default i18next namespace */
       payload.resources
      )
    } else if (payload.action_type === AppConstants.LOCALE_UPDATE_QUEUE_DOWNLOAD) {
      this.queue_download(payload.lang)
    }
  }
github letsdoitworld / World-Cleanup-Day / mobile-app / src / config / i18n.js View on Github external
// i18n.addResources('bo', 'general', require('../trans/bo.json'));
// i18n.addResources('bs', 'general', require('../trans/bs.json'));

// i18n.addResources('ca', 'general', require('../trans/ca.json'));
// i18n.addResources('ceb', 'general', require('../trans/ceb.json'));
// i18n.addResources('cs', 'general', require('../trans/cs.json'));
// i18n.addResources('csb', 'general', require('../trans/csb.json'));
// i18n.addResources('cy', 'general', require('../trans/cy.json'));

// i18n.addResources('da', 'general', require('../trans/da.json'));
// i18n.addResources('de', 'general', require('../trans/de.json'));

// i18n.addResources('ee', 'general', require('../trans/ee.json'));
// i18n.addResources('el', 'general', require('../trans/el.json'));
i18n.addResources('en', 'general', require('../trans/en.json'));
i18n.addResources('es', 'general', require('../trans/es.json'));
// i18n.addResources('et', 'general', require('../trans/et.json'));
// i18n.addResources('eu', 'general', require('../trans/eu.json'));

// i18n.addResources('fa', 'general', require('../trans/fa.json'));
// i18n.addResources('fi', 'general', require('../trans/fi.json'));
// i18n.addResources('fil', 'general', require('../trans/fil.json'));
// i18n.addResources('fj', 'general', require('../trans/fj.json'));
i18n.addResources('fr', 'general', require('../trans/fr.json'));

// i18n.addResources('ga', 'general', require('../trans/ga.json'));
// i18n.addResources('gd', 'general', require('../trans/gd.json'));
// i18n.addResources('gl', 'general', require('../trans/gl.json'));

// i18n.addResources('ha', 'general', require('../trans/ha.json'));
// i18n.addResources('haw', 'general', require('../trans/haw.json'));
// i18n.addResources('he', 'general', require('../trans/he.json'));
github i18next / i18next / test / typescript / i18next-tests.ts View on Github external
i18next.on('missingKey', (lngs: string[], namespace: string, key: string, res: string) => {})
i18next.on('added', (lng: string, ns: string) => {})
i18next.on('removed', (lng: string, ns: string) => {})
i18next.on('languageChanged', (lng: string) => {})
i18next.on('customEvent', () => {})

i18next.getResource('en', 'test', 'key')
i18next.getResource('en', 'test', 'key', { keySeparator: '-' })

i18next.addResource('en', 'test', 'key', 'value')
i18next.addResource('en', 'test', 'key', 'value', {
  keySeparator: '-',
  silent: false,
})

i18next.addResources('en', 'test', { key: 'value' })

i18next.addResourceBundle(
  'en',
  'translations',
  {
    key: 'value',
  },
  true,
  true,
)

const has: boolean = i18next.hasResourceBundle('en', 'test')

i18next.getResourceBundle('en', 'test')

i18next.removeResourceBundle('en', 'test')
github compodoc / compodoc / src / app / engines / i18n.engine.ts View on Github external
public init(language: string) {
        i18next.init({
            lng: language,
            fallbackLng: this.fallbackLanguage
        });
        i18next.addResources('de-DE', 'translation', TRANSLATION_DE_DE);
        i18next.addResources('en-US', 'translation', TRANSLATION_EN_US);
        i18next.addResources('es-ES', 'translation', TRANSLATION_ES_ES);
        i18next.addResources('fr-FR', 'translation', TRANSLATION_FR_FR);
        i18next.addResources('hu-HU', 'translation', TRANSLATION_HU_HU);
        i18next.addResources('it-IT', 'translation', TRANSLATION_IT_IT);
        i18next.addResources('ja-JP', 'translation', TRANSLATION_JA_JP);
        i18next.addResources('nl-NL', 'translation', TRANSLATION_NL_NL);
        i18next.addResources('pt-BR', 'translation', TRANSLATION_PT_BR);
        i18next.addResources('zh-CN', 'translation', TRANSLATION_ZH_CN);
    }
github compodoc / compodoc / src / app / engines / i18n.engine.ts View on Github external
public init(language: string) {
        i18next.init({
            lng: language,
            fallbackLng: this.fallbackLanguage
        });
        i18next.addResources('de-DE', 'translation', TRANSLATION_DE_DE);
        i18next.addResources('en-US', 'translation', TRANSLATION_EN_US);
        i18next.addResources('es-ES', 'translation', TRANSLATION_ES_ES);
        i18next.addResources('fr-FR', 'translation', TRANSLATION_FR_FR);
        i18next.addResources('hu-HU', 'translation', TRANSLATION_HU_HU);
        i18next.addResources('it-IT', 'translation', TRANSLATION_IT_IT);
        i18next.addResources('ja-JP', 'translation', TRANSLATION_JA_JP);
        i18next.addResources('nl-NL', 'translation', TRANSLATION_NL_NL);
        i18next.addResources('pt-BR', 'translation', TRANSLATION_PT_BR);
        i18next.addResources('zh-CN', 'translation', TRANSLATION_ZH_CN);
    }
github compodoc / compodoc / src / app / engines / i18n.engine.ts View on Github external
public init(language: string) {
        i18next.init({
            lng: language,
            fallbackLng: this.fallbackLanguage
        });
        i18next.addResources('de-DE', 'translation', TRANSLATION_DE_DE);
        i18next.addResources('en-US', 'translation', TRANSLATION_EN_US);
        i18next.addResources('es-ES', 'translation', TRANSLATION_ES_ES);
        i18next.addResources('fr-FR', 'translation', TRANSLATION_FR_FR);
        i18next.addResources('hu-HU', 'translation', TRANSLATION_HU_HU);
        i18next.addResources('it-IT', 'translation', TRANSLATION_IT_IT);
        i18next.addResources('ja-JP', 'translation', TRANSLATION_JA_JP);
        i18next.addResources('nl-NL', 'translation', TRANSLATION_NL_NL);
        i18next.addResources('pt-BR', 'translation', TRANSLATION_PT_BR);
        i18next.addResources('zh-CN', 'translation', TRANSLATION_ZH_CN);
    }
github compodoc / compodoc / src / app / engines / i18n.engine.ts View on Github external
public init(language: string) {
        i18next.init({
            lng: language,
            fallbackLng: this.fallbackLanguage
        });
        i18next.addResources('de-DE', 'translation', TRANSLATION_DE_DE);
        i18next.addResources('en-US', 'translation', TRANSLATION_EN_US);
        i18next.addResources('es-ES', 'translation', TRANSLATION_ES_ES);
        i18next.addResources('fr-FR', 'translation', TRANSLATION_FR_FR);
        i18next.addResources('hu-HU', 'translation', TRANSLATION_HU_HU);
        i18next.addResources('it-IT', 'translation', TRANSLATION_IT_IT);
        i18next.addResources('ja-JP', 'translation', TRANSLATION_JA_JP);
        i18next.addResources('nl-NL', 'translation', TRANSLATION_NL_NL);
        i18next.addResources('pt-BR', 'translation', TRANSLATION_PT_BR);
        i18next.addResources('zh-CN', 'translation', TRANSLATION_ZH_CN);
    }
github compodoc / compodoc / src / app / engines / i18n.engine.ts View on Github external
public init(language: string) {
        i18next.init({
            lng: language,
            fallbackLng: this.fallbackLanguage
        });
        i18next.addResources('de-DE', 'translation', TRANSLATION_DE_DE);
        i18next.addResources('en-US', 'translation', TRANSLATION_EN_US);
        i18next.addResources('es-ES', 'translation', TRANSLATION_ES_ES);
        i18next.addResources('fr-FR', 'translation', TRANSLATION_FR_FR);
        i18next.addResources('hu-HU', 'translation', TRANSLATION_HU_HU);
        i18next.addResources('it-IT', 'translation', TRANSLATION_IT_IT);
        i18next.addResources('ja-JP', 'translation', TRANSLATION_JA_JP);
        i18next.addResources('nl-NL', 'translation', TRANSLATION_NL_NL);
        i18next.addResources('pt-BR', 'translation', TRANSLATION_PT_BR);
        i18next.addResources('zh-CN', 'translation', TRANSLATION_ZH_CN);
    }
github compodoc / compodoc / src / app / engines / i18n.engine.ts View on Github external
public init(language: string) {
        i18next.init({
            lng: language,
            fallbackLng: this.fallbackLanguage
        });
        i18next.addResources('de-DE', 'translation', TRANSLATION_DE_DE);
        i18next.addResources('en-US', 'translation', TRANSLATION_EN_US);
        i18next.addResources('es-ES', 'translation', TRANSLATION_ES_ES);
        i18next.addResources('fr-FR', 'translation', TRANSLATION_FR_FR);
        i18next.addResources('hu-HU', 'translation', TRANSLATION_HU_HU);
        i18next.addResources('it-IT', 'translation', TRANSLATION_IT_IT);
        i18next.addResources('ja-JP', 'translation', TRANSLATION_JA_JP);
        i18next.addResources('nl-NL', 'translation', TRANSLATION_NL_NL);
        i18next.addResources('pt-BR', 'translation', TRANSLATION_PT_BR);
        i18next.addResources('zh-CN', 'translation', TRANSLATION_ZH_CN);
    }