Replaced expo localization by react native one

This commit is contained in:
Arnaud Vergnet 2020-04-27 21:47:49 +02:00
parent 6ca2ca67a5
commit b784a5d164
2 changed files with 5 additions and 4 deletions

View file

@ -27,7 +27,6 @@
"expo": "^37.0.0",
"expo-barcode-scanner": "~8.1.0",
"expo-camera": "latest",
"expo-localization": "~8.1.0",
"expo-permissions": "~8.1.0",
"expo-secure-store": "~8.1.0",
"i18n-js": "^3.3.0",
@ -43,6 +42,7 @@
"react-native-gesture-handler": "~1.6.0",
"react-native-image-modal": "^1.0.6",
"react-native-linear-gradient": "^2.5.6",
"react-native-localize": "^1.4.0",
"react-native-modalize": "^1.3.6",
"react-native-paper": "^3.8.0",
"react-native-reanimated": "~1.7.0",

View file

@ -1,7 +1,7 @@
// @flow
import i18n from 'i18n-js';
import * as Localization from 'expo-localization';
import * as RNLocalize from "react-native-localize";
import en from '../../translations/en';
import fr from '../../translations/fr';
@ -17,10 +17,11 @@ export default class LocaleManager {
static initTranslations() {
i18n.fallbacks = true;
i18n.translations = {fr, en};
i18n.locale = Localization.locale;
i18n.locale = RNLocalize.findBestAvailableLanguage(["en", "fr"]).languageTag;
console.log(RNLocalize.findBestAvailableLanguage(["en", "fr"]).languageTag);
}
static getCurrentLocale() {
return Localization.locale;
return RNLocalize.findBestAvailableLanguage(["en", "fr"]).languageTag;
}
}