Reading time: < 1 minute
When implementing i18next’s multi-language support in React Native, the Android platform may return the following error:
The following error message is displayed in the console:
i18next::pluralResolver: Your environment seems not to be Intl API compatible, use an Intl.PluralRules polyfill. Will fallback to the compatibilityJSON v3 format handling. at node_modules\expo\build\environment\react-native-logs.fx.js:27:4 in error at node_modules\i18next\dist\cjs\i18next.js:41:34 in output at node_modules\i18next\dist\cjs\i18next.js:38:4 in error at node_modules\i18next\dist\cjs\i18next.js:1368:6 in PluralResolver at node_modules\i18next\dist\cjs\i18next.js:2312:27 in init at language\i18n.js:8:0 in <global> at node_modules\metro-runtime\src\polyfills\require.js:339:11 in loadModuleImplementation at screens\Recursos.js:4:0 in <global> at node_modules\metro-runtime\src\polyfills\require.js:339:11 in loadModuleImplementation at screens\Menu.js:10:0 in <global> at node_modules\metro-runtime\src\polyfills\require.js:339:11 in loadModuleImplementation at App.js:7:0 in <global> at node_modules\metro-runtime\src\polyfills\require.js:339:11 in loadModuleImplementation at node_modules\expo\AppEntry.js:3:0 in <global> at node_modules\metro-runtime\src\polyfills\require.js:339:11 in loadModuleImplementation at node_modules\metro-runtime\src\polyfills\require.js:200:44 in guardedLoadModule at http://ej-tpe.anonymous.courstube-app-react.exp.direct/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&strict=false&minify=false:183127:3 in global code
To fix this, we need to go to the file where we initialize the i18n plugin and add compatibility with JSON v3 (compatibilityJSON: 'v3'
):
i18n.use(initReactI18next).init({ lng: es, fallbackLng: es, //compatibilityJSON: 'v3', resources: { en: en, es: es, }, interpolation: { escapeValue: false } });
Once added, the error no longer appears on the Android platform.