2020-01-06 11:22:51 -05:00
|
|
|
import i18next from 'i18next';
|
2019-08-09 17:14:43 -07:00
|
|
|
import { getLanguage } from './utils';
|
2020-02-28 18:48:30 +01:00
|
|
|
import XHR from 'i18next-xhr-backend';
|
2019-08-09 17:14:43 -07:00
|
|
|
|
2020-01-26 21:49:47 +01:00
|
|
|
function format(value: any, format: any, lng: any): any {
|
|
|
|
return format === 'uppercase' ? value.toUpperCase() : value;
|
|
|
|
}
|
2019-08-09 17:14:43 -07:00
|
|
|
|
2020-02-28 18:48:30 +01:00
|
|
|
i18next
|
|
|
|
.use(XHR)
|
|
|
|
.init({
|
|
|
|
debug: true,
|
|
|
|
//load: 'languageOnly',
|
2019-08-09 17:14:43 -07:00
|
|
|
|
2020-02-28 18:48:30 +01:00
|
|
|
// initImmediate: false,
|
|
|
|
lng: getLanguage(),
|
|
|
|
fallbackLng: 'en',
|
|
|
|
interpolation: { format },
|
|
|
|
backend: {
|
|
|
|
loadPath: '/static/assets/translations/{{lng}}.json',
|
|
|
|
}
|
2019-08-09 17:14:43 -07:00
|
|
|
});
|
|
|
|
|
2020-01-06 11:22:51 -05:00
|
|
|
export { i18next as i18n, resources };
|