i18next-resources-fallback
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

i18next-resources-fallback

npm

Installation

yarn add i18next-resources-fallback

Usage

  import i18next, type { Resource } from "i18next";
+ import resourcesFallback from 'i18next-resources-fallback'

  const resources: Resource = {
    en: {
      translation: {
        key: 'value'
      }
    }
  };

  i18next
    .init({
      // ... your i18next config
    });

+ resourcesFallback(i18n, resources)

Introduction

Why need to use this package?

When you use i18next, your backend resources and bundled resources may differ. When the backend resources are missing, you might want to use the bundled resources as a fallback to avoid issues when certain texts are missing from the backend resources.

How does this package work?

This package adds text using addResourceBundle after the backend resources have finished loading, to supplement the missing texts from the backend as a fallback.

Comparisons

  • i18next-resources-to-backend: It is used as a fallback when a certain file or namespace is missing.
  • i18next-resources-fallback: It is used as a fallback when a certain key is missing in the backend resources.

License

MIT Licensed

Readme

Keywords

none

Package Sidebar

Install

npm i i18next-resources-fallback

Weekly Downloads

7

Version

1.0.2

License

MIT

Unpacked Size

12.3 kB

Total Files

15

Last publish

Collaborators

  • cnwangjie