Мой файл i18n.js выглядит так:
Код: Выделить всё
import { getLocales } from 'expo-localization';
import { I18n } from 'i18n-js';
// Set the key-value pairs for the different languages you want to support.
const i18n = new I18n({
en: { welcome: 'Hello' },
lt: { welcome: 'Labas' },
});
// Set the locale once at the beginning of your app.
i18n.locale = getLocales()[0].languageCode;
console.log(i18n.t('welcome'));
Код: Выделить всё
npm install expo-localization
npx expo install i18n-js
Код: Выделить всё
npx expo start
Код: Выделить всё
Cannot find native module 'ExpoLocalization', js engine: hermes
Код: Выделить всё
"i18n-js": "^4.4.3",
"expo-localization": "~15.0.3",
Код: Выделить всё
"expo": {
"jsEngine": "hermes",
Подробнее здесь: https://stackoverflow.com/questions/790 ... in-expo-re