How to use the i18next.addResourceBundle 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 sillsdev / appbuilder-portal / source / SIL.AppBuilder.Portal.Frontend / src / translations / index.tsx View on Github external
// keySeparator: false,

    // common namespace for the app
    ns: ['translations', 'ldml'],
    defaultNS: 'translations',

    // debug: true,

    interpolation: {
      // react already does escaping
      escapeValue: false,
    },
  });

i18n.addResourceBundle('es-419', 'translations', esLa, true, true);
i18n.addResourceBundle('en-US', 'translations', enUs, true, true);
i18n.addResourceBundle('fr-FR', 'translations', frFR, true, true);

export default i18n;
github hubot-js / hubot.js / src / lib / i18n.js View on Github external
function addResourceBundle(lng, ns, resources) {
  i18n.addResourceBundle(lng, ns, resources);
}
github formio / formio.js / src / Webform.js View on Github external
addLanguage(code, lang, active = false) {
    i18next.addResourceBundle(code, 'translation', lang, true, true);
    if (active) {
      this.language = code;
    }
  }
github ronggang / PT-Plugin-Plus / src / background / i18n.ts View on Github external
return new Promise((resolve?: any, reject?: any) => {
      if (resource.name && resource.code) {
        if (this.loadedLanguages.includes(resource.code)) {
          reject();
        } else {
          i18next.addResourceBundle(
            resource.code,
            "translation",
            resource.words,
            true,
            true
          );
          this.loadedLanguages.push(resource.code);
          i18next.changeLanguage(resource.code).then(() => {
            resolve(resource.code);
          });
        }
      } else {
        reject();
      }
    });
  }
github pingcap / tidb-dashboard / ui / lib / utils / i18n.ts View on Github external
export function addTranslationResource(lang, translations) {
  i18next.addResourceBundle(lang, 'translation', translations, true, false)
}
github OHIF / Viewers / platform / i18n / src / index.js View on Github external
Object.keys(newLocales[key]).map(namespace => {
      const locale = newLocales[key][namespace];
      resourceBundle.push({ key, namespace, locale });
      i18n.addResourceBundle(key, namespace, locale, true, true);
    });
  });
github springtype-org / springtype / src / packages / i18n / src / decorator / Translations.ts View on Github external
return (target: any) => {

            if (!i18next.isInitialized) {

                Translation(undefined, undefined, () => {
                    i18next.addResourceBundle(locale, namespace, catalog, true, true);
                });

            } else {
                i18next.addResourceBundle(locale, namespace, catalog, true, true);
            }
            return target;
        }
    }
github spaxjs / spax / packages / i18n / lib / index.js View on Github external
(resources) => {
            i18n.addResourceBundle(i18n.language, ns.toLowerCase(), resources, true, true);
        },
    ];
github BadrIT / bractal / src / modules / modulesDocs / locales / index.js View on Github external
const loadLocales = () => {
  i18next.addResourceBundle('en', 'modulesDocs', {
    metadata: {
      name: 'modulesDocs',
      displayName: 'Modules Docs Module',
      description: 'This module shows the very basic usage of Bractal, and it simply does only one job, which is loading and showing all home pages of all the loaded modules',
    },
    home: {
      menuTitle: 'Modules Docs',
    },
  }, true, true);

  i18next.loadNamespaces('modulesDocs');
};
github spaxjs / spax / packages / i18n / src / index.tsx View on Github external
(resources: ObjectOf) => {
      i18n.addResourceBundle(
        i18n.language, ns.toLowerCase(), resources, true, true,
      );
    },
  ];