123456789101112131415161718192021222324252627 |
- // @flow
-
- import i18n from 'i18n-js';
- import * as RNLocalize from "react-native-localize";
-
- import en from '../../translations/en';
- import fr from '../../translations/fr';
-
- /**
- * Static class used to manage locales
- */
- export default class LocaleManager {
-
- /**
- * Initialize translations using language files
- */
- static initTranslations() {
- i18n.fallbacks = true;
- i18n.translations = {fr, en};
- i18n.locale = RNLocalize.findBestAvailableLanguage(["en", "fr"]).languageTag;
- console.log(RNLocalize.findBestAvailableLanguage(["en", "fr"]).languageTag);
- }
-
- static getCurrentLocale() {
- return RNLocalize.findBestAvailableLanguage(["en", "fr"]).languageTag;
- }
- }
|