lemmy/ui/src/i18next.ts

25 lines
542 B
TypeScript
Raw Normal View History

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