mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-12 13:24:52 +00:00
Optimized translate module (#4044)
* combine dtable translate * update cdoc html * optimized code
This commit is contained in:
40
frontend/src/i18n-seafile-editor.js
Normal file
40
frontend/src/i18n-seafile-editor.js
Normal file
@@ -0,0 +1,40 @@
|
||||
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 = window.app.pageOptions.lang;
|
||||
|
||||
i18n
|
||||
.use(Backend)
|
||||
.use(LanguageDetector)
|
||||
.use(initReactI18next)
|
||||
.init({
|
||||
lng: lang,
|
||||
fallbackLng: 'en',
|
||||
ns: ['translations'],
|
||||
defaultNS: 'translations',
|
||||
|
||||
whitelist: ['en', 'zh-CN', 'fr', 'de', 'cs', 'es', 'es-AR', 'es-MX', 'ru'],
|
||||
|
||||
backend: {
|
||||
loadPath: mediaUrl + 'assets/frontend/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;
|
Reference in New Issue
Block a user