forked from vergnet/application-amicale
24 lines
545 B
JavaScript
24 lines
545 B
JavaScript
|
import i18n from 'i18n-js';
|
||
|
import * as Localization from 'expo-localization';
|
||
|
|
||
|
import en from '../translations/en';
|
||
|
import fr from '../translations/fr';
|
||
|
|
||
|
export default class LocaleManager {
|
||
|
|
||
|
static instance = null;
|
||
|
|
||
|
static getInstance() {
|
||
|
if (LocaleManager.instance == null) {
|
||
|
LocaleManager.instance = new LocaleManager();
|
||
|
}
|
||
|
return this.instance;
|
||
|
}
|
||
|
|
||
|
initTranslations() {
|
||
|
i18n.fallbacks = true;
|
||
|
i18n.translations = {fr, en};
|
||
|
i18n.locale = Localization.locale;
|
||
|
}
|
||
|
}
|