1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-03 16:10:26 +00:00
Files
seahub/frontend/src/_i18n/i18n-sdoc-editor.js
2023-09-06 14:59:49 +08:00

41 lines
910 B
JavaScript

import i18n from 'i18next';
import Backend from 'i18next-xhr-backend';
import LanguageDetector from 'i18next-browser-languagedetector';
import { initReactI18next } from 'react-i18next';
import { mediaUrl } from '../utils/constants';
const { lang = 'en' } = window.app.config;
i18n
.use(Backend)
.use(LanguageDetector)
.use(initReactI18next)
.init({
lng: lang,
fallbackLng: 'en',
ns: ['sdoc-editor'],
defaultNS: 'sdoc-editor',
whitelist: ['en', 'zh-CN', 'fr', 'de', 'cs', 'es', 'es-AR', 'es-MX', 'ru'],
backend: {
loadPath: mediaUrl + 'sdoc-editor/locales/{{ lng }}/{{ ns }}.json',
// loadPath: '/media/locales/{{lng}}/{{ns}}.json',
},
debug: false, // console log if debug: true
interpolation: {
escapeValue: false, // not needed for react!!
},
load: 'currentOnly',
react: {
wait: true,
}
});
export default i18n;