2019-06-29 13:37:21 +02:00
|
|
|
// @flow
|
|
|
|
|
2019-06-25 22:20:24 +02:00
|
|
|
import i18n from 'i18n-js';
|
|
|
|
import * as Localization from 'expo-localization';
|
|
|
|
|
|
|
|
import en from '../translations/en';
|
|
|
|
import fr from '../translations/fr';
|
|
|
|
|
2019-06-29 13:37:21 +02:00
|
|
|
/**
|
|
|
|
* Static class used to manage locales
|
|
|
|
*/
|
2019-06-25 22:20:24 +02:00
|
|
|
export default class LocaleManager {
|
|
|
|
|
2019-06-29 13:37:21 +02:00
|
|
|
/**
|
|
|
|
* Initialize translations using language files
|
|
|
|
*/
|
|
|
|
static initTranslations() {
|
2019-06-25 22:20:24 +02:00
|
|
|
i18n.fallbacks = true;
|
|
|
|
i18n.translations = {fr, en};
|
|
|
|
i18n.locale = Localization.locale;
|
|
|
|
}
|
|
|
|
}
|