i18n-js

React native project with expo-localization and i18n-js

别等时光非礼了梦想. 提交于 2021-01-13 09:43:10
问题 i am currently trying to implement localization depending on the system language of the device but something is not working as required. I followed the exact same code on expo documentation, for eg. for the button i have i keep getting [MISSING "EN-GB.LOGIN" TRANSLATION] instead of LOGIN . Here is my code: welcomeScreen.js import * as Localization from 'expo-localization'; import i18n from 'i18n-js'; i18n.translations = { en: { login: 'LOGIN'}, ar: { login: 'تسجيل الدخول'}, }; i18n.locale =

React native project with expo-localization and i18n-js

点点圈 提交于 2021-01-13 09:42:29
问题 i am currently trying to implement localization depending on the system language of the device but something is not working as required. I followed the exact same code on expo documentation, for eg. for the button i have i keep getting [MISSING "EN-GB.LOGIN" TRANSLATION] instead of LOGIN . Here is my code: welcomeScreen.js import * as Localization from 'expo-localization'; import i18n from 'i18n-js'; i18n.translations = { en: { login: 'LOGIN'}, ar: { login: 'تسجيل الدخول'}, }; i18n.locale =

React native project with expo-localization and i18n-js

我的梦境 提交于 2021-01-13 09:42:26
问题 i am currently trying to implement localization depending on the system language of the device but something is not working as required. I followed the exact same code on expo documentation, for eg. for the button i have i keep getting [MISSING "EN-GB.LOGIN" TRANSLATION] instead of LOGIN . Here is my code: welcomeScreen.js import * as Localization from 'expo-localization'; import i18n from 'i18n-js'; i18n.translations = { en: { login: 'LOGIN'}, ar: { login: 'تسجيل الدخول'}, }; i18n.locale =

How to use setLocale within i18n-js?

这一生的挚爱 提交于 2020-06-09 06:49:42
问题 I am using i18n-js within my expo project to translate my app. This is how I configure it: import React from 'react'; import * as Localization from 'expo-localization'; import i18n from 'i18n-js'; export default function configureI18n(translations) { i18n.fallbacks = true; i18n.translations = translations; i18n.locale = Localization.locale; const [locale, setLocale] = React.useState(Localization.locale); const localizationContext = React.useMemo(() => ({ t: (scope, options) => i18n.t(scope, {