0

When initialising i18next using Locize backend there is an issue on android devices where Locize backend plugin returns i18next::backendConnector: loading namespace translation for language en failed [TypeError: Network request failed] on load but loads translations correctly on IOS devices.

Here is the code that i'm using to init translations on App load:

import i18n, { type Translate } from 'i18next';
import LocizeBackend from "i18next-locize-backend";
...

export const loadTranslations = () => {
  if(!i18next.isInitialized) {
    i18n
    .use(initReactI18next)
    .use(LocizeBackend)
    .init({
      debug: true,
      // needed because of flat json translations
      keySeparator: false,
      backend: {
        projectId: config.locize.projectId,
        apiKey: config.locize.apiKey,
        version: 'latest',
        refLng: 'en',
      },
      interpolation: {
        escapeValue: false
      },
      fallbackLng: 'en',
      // don't save missing translations in non-dev env
      saveMissing: true,
    });
  }
};

package.json

"react-native": "0.66.3",
"i18next": "^19.0.0",
"i18next-locize-backend": "^4.2.3",

1 Answers1

0

This seems to be an android emulator issue. Answered here: https://github.com/locize/i18next-locize-backend/issues/344

adrai
  • 2,495
  • 1
  • 15
  • 18