lemmy/ui/src/i18next.ts

25 lines
542 B
TypeScript
Raw Normal View History

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