54

Please help me.

Error -

i18next::pluralResolver: Your environment seems not to be Intl API compatible, use an Intl.PluralRules polyfill. Will fallback to the compatibilityJSON v3 format handling

Code -

    import i18n from "i18next";
    import english from './englist.json';
    import thai from './thai.json';
    import { initReactI18next } from "react-i18next";
    i18n.use(initReactI18next).init({
        lng:'th',
        fallbackLng: 'en',
        resources:{
            en:english,
            th:thai
        },
        interpolation: {
            escapeValue: false 
        },
        react:{
            useSuspense:false,
        }
    });
    export default i18n;
Shoaib Khan
  • 1,020
  • 1
  • 5
  • 18
sasigarn
  • 543
  • 1
  • 3
  • 5

2 Answers2

168

Look like an issue on android.

i18n.use(initReactI18next).init({
  compatibilityJSON: 'v3', <--- add this line.
  lng:'th',
  fallbackLng: 'en',
  resources:{
    en:english,
    th:thai
  },
  interpolation: {
    escapeValue: false 
  },
  react: {
    useSuspense:false,
 }
});

It should resolve your issue. You might need to check this.

Have fun.

Chris Nguyen
  • 2,327
  • 1
  • 16
  • 13
  • 11
    This only helps if you don't need/use pluralisation. If you need the pluralisation see my answer and use the intl-pluralrules package. – kendepelchin Apr 26 '22 at 10:08
71

I've had the same issue, and using the compatibilityJSON V3 mode meant that this broke on my IOS emulators because I actually use pluralisation and am on the latest version (v21) of i18n-next

In my case I could fix it by polyfilling intl-pluralrules

Have a look at https://github.com/eemeli/intl-pluralrules & https://www.i18next.com/misc/migration-guide

Installation

npm install intl-pluralrules

Polyfill

To use as a polyfill, just import it to ensure that Intl.PluralRules is available in your environment:

import 'intl-pluralrules'

If Intl.PluralRules already exists, includes a selectRange() method, and supports multiple locales, the polyfill will not be loaded.

kendepelchin
  • 2,680
  • 2
  • 21
  • 25