i18next plugin to request the non-translated keys when used
Switch branches/tags
Nothing to show
Clone or download
Nabil Koroghli
Nabil Koroghli improve the readme
Latest commit 3c337bf Oct 27, 2017
Type Name Latest commit message Commit time
Failed to load latest commit information.
config initial commit Oct 26, 2017
src adding unit tests Oct 26, 2017
tests adding unit tests Oct 26, 2017
.gitignore initial commit Oct 26, 2017
README.md improve the readme Oct 27, 2017
gulpfile.js initial commit Oct 26, 2017
package.json fix dist issue Oct 27, 2017
tsconfig.json fix dist issue Oct 27, 2017
tslint.json initial commit Oct 26, 2017
yarn.lock adding unit tests Oct 26, 2017


npm version

I18next with ability to download missing keys

Existing i18next offers backend plugins like i18next-xhr-backend, but those plugins are requesting keys by namespaces and not at the granularity of an individual key. The goal of this module is to be able to fetch missing keys individually, taking in consideration performances by debouncing the requests in a individual request.


# using npm
$ npm install i18next-keys-ondemand

# using yarn
$ yarn add i18next-keys-ondemand

Who to use it?

  • Use the module when initializing i18next:
import * as i18n from 'i18next';
import { I18nextKeysOnDemand, TranslationMap } from 'i18next-keys-ondemand';

function translationService(keys: string[]) {
    // simulate AJAX call
    return new Promise<TranslationMap>((resolve) => {
        const result: TranslationMap = {};
        keys.map(k => { result[k] = 'translation of ' + k; });

        setTimeout(() => {
        },         50);

  .use(new I18nextKeysOnDemand({ translationGetter: translationService })) // init i18next here
    fallbackLng: 'en',
    ns: ['thenamespace'],
    defaultNS: 'thenamespace'
  • The options:
Field Mandatory? Default value Comment
translationGetter yes Translation service to use
missingKeyValue no '' Value to return for missing keys
debounceDelay no 100 Delay in ms used to debounce the translation requests