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