Fix non provided translation errors by fallback on english
This commit is contained in:
@@ -3,6 +3,7 @@ import { I18n } from 'i18n-js';
|
|||||||
import moment from 'moment'
|
import moment from 'moment'
|
||||||
import 'moment/min/locales'
|
import 'moment/min/locales'
|
||||||
|
|
||||||
|
I18n.defaultLocale = 'en';
|
||||||
I18n.enableFallback = true;
|
I18n.enableFallback = true;
|
||||||
|
|
||||||
const messages = {
|
const messages = {
|
||||||
@@ -301,7 +302,13 @@ const i18n = new I18n(messages);
|
|||||||
|
|
||||||
// Set the locale once at the beginning of your app.
|
// Set the locale once at the beginning of your app.
|
||||||
// TODO: Check user Lcale
|
// TODO: Check user Lcale
|
||||||
i18n.locale = getLocales()[0].languageCode;
|
const devideLocale = getLocales()[0].languageCode;
|
||||||
|
console.log('deviceLocale', devideLocale);
|
||||||
|
if (messages[devideLocale]) {
|
||||||
|
i18n.locale = devideLocale;
|
||||||
|
} else {
|
||||||
|
i18n.locale = 'en';
|
||||||
|
}
|
||||||
moment.locale(i18n.locale);
|
moment.locale(i18n.locale);
|
||||||
|
|
||||||
export default i18n;
|
export default i18n;
|
||||||
Reference in New Issue
Block a user