Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Widen/i18next-async-backend

Open more actions menu

i18next-async-backend

Build npm changesets

i18next backend which loads resources via promises. Useful when loading resources via dynamic imports.

Installation

npm

npm install i18next-async-backend

Yarn

yarn add i18next-async-backend

Usage

import i18next from 'i18next'
import AsyncBackend from 'i18next-async-backend'

const resources = {
  es: () => import('./locales/es/translation.json'),
}

i18next.use(AsyncBackend).init({
  backend: { resources },
})

Recipes

Single namespace

const resources = {
  en: () => import('./locales/en/translation.json'),
  es: () => import('./locales/es/translation.json'),
}

Multiple namespaces

const resources = {
  en: {
    common: () => import('./locales/en/common.json'),
    glossary: () => import('./locales/en/glossary.json'),
  },
  es: {
    common: () => import('./locales/es/common.json'),
    glossary: () => import('./locales/es/glossary.json'),
  },
}

About

i18next backend which loads resources via promises. Useful when loading resources via dynamic imports.

Topics

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Contributors 2

  •  
  •  
Morty Proxy This is a proxified and sanitized view of the page, visit original site.