mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
I18n build mode (#3051)
Add build mode option to bundle english translation with UI
This commit is contained in:
commit
25ae36ceb5
@ -1,22 +1,38 @@
|
|||||||
import i18n from 'i18next';
|
import i18n from 'i18next';
|
||||||
import LanguageDetector from 'i18next-browser-languagedetector';
|
import LanguageDetector from 'i18next-browser-languagedetector';
|
||||||
import Backend from 'i18next-http-backend';
|
import Backend from 'i18next-http-backend';
|
||||||
|
|
||||||
import { initReactI18next } from 'react-i18next';
|
import { initReactI18next } from 'react-i18next';
|
||||||
i18n
|
|
||||||
.use(Backend)
|
import translationEN from '../dist/locales/en.json';
|
||||||
.use(LanguageDetector)
|
|
||||||
.use(initReactI18next)
|
if (import.meta.env.MODE === 'package') {
|
||||||
.init({
|
i18n.use(initReactI18next).init({
|
||||||
fallbackLng: 'en',
|
lng: 'en',
|
||||||
debug: false,
|
resources: {
|
||||||
backend: {
|
en: { translation: translationEN },
|
||||||
loadPath: '/locales/{{lng}}.json',
|
|
||||||
},
|
},
|
||||||
|
debug: false,
|
||||||
interpolation: {
|
interpolation: {
|
||||||
escapeValue: false,
|
escapeValue: false,
|
||||||
},
|
},
|
||||||
returnNull: false,
|
returnNull: false,
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
i18n
|
||||||
|
.use(Backend)
|
||||||
|
.use(LanguageDetector)
|
||||||
|
.use(initReactI18next)
|
||||||
|
.init({
|
||||||
|
fallbackLng: 'en',
|
||||||
|
debug: false,
|
||||||
|
backend: {
|
||||||
|
loadPath: '/locales/{{lng}}.json',
|
||||||
|
},
|
||||||
|
interpolation: {
|
||||||
|
escapeValue: false,
|
||||||
|
},
|
||||||
|
returnNull: false,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
export default i18n;
|
export default i18n;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user