1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-07-16 00:06:11 +00:00
seahub/frontend/src/i18n-seafile-editor.js

41 lines
900 B
JavaScript
Raw Normal View History

2018-05-02 06:09:58 +00:00
import i18n from 'i18next';
import Backend from 'i18next-xhr-backend';
import LanguageDetector from 'i18next-browser-languagedetector';
import { initReactI18next } from 'react-i18next';
2019-09-01 02:14:51 +00:00
import { mediaUrl } from './utils/constants';
const lang = window.app.pageOptions.lang;
2018-05-02 06:09:58 +00:00
i18n
.use(Backend)
.use(LanguageDetector)
.use(initReactI18next)
2018-05-02 06:09:58 +00:00
.init({
lng: lang,
2018-05-02 06:09:58 +00:00
fallbackLng: 'en',
2019-12-17 14:16:52 +00:00
ns: ['seafile-editor'],
2018-05-02 06:09:58 +00:00
defaultNS: 'translations',
2019-01-28 10:00:04 +00:00
whitelist: ['en', 'zh-CN', 'fr', 'de', 'cs', 'es', 'es-AR', 'es-MX', 'ru'],
2018-05-02 06:09:58 +00:00
backend: {
2019-12-17 14:16:52 +00:00
loadPath: mediaUrl + 'locales/{{ lng }}/{{ ns }}.json',
2018-05-02 06:09:58 +00:00
// 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;