InvokeAI/invokeai/frontend/web/src/i18n.ts

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

45 lines
1022 B
TypeScript
Raw Normal View History

[WebUI] Localization Support (#2050) * Initial Localization Implementation * Fix Initial Spinner * Language Picker Dropdown * RU Localization Update Co-Authored-By: Artur <83028930+netsvetaev@users.noreply.github.com> * Fixed localization breaking themes * useUpdateTranslation Hook To force trigger translations for data objects * Localize Tab Data * Localize Prompt Input & Current Image Buttons * Localize Gallery & Bug FIxes Fix a bug where the delete image from the context menu wasn't working. Removed tooltips that were broken as they don't work in context menu. * Fix localization breaking in production * Add Toast Localization Support * Localize Unified Canvas * Localize WIP Tabs * Localize Hotkeys * Localize Settings * RU Localization Update Co-Authored-By: Artur <83028930+netsvetaev@users.noreply.github.com> * Add Support for Italian and Portuguese * Localize Toasts * Fix width of language picker items * Localize Backend Messages * Disable Debug Messages * Add Support for French * Fix missing localization for a string in the SettingsModal * Disable French * Styling updates to normalize text and accommodate other langs * Add Portuguese Brazilian * Fix Hotkey headers not being localized. * Fix styling issue on models tag in Settings * Fix Slider Styling to accommodate different languages * Fix slider styling in light mode. * Add German * Add Italian * Add Polish * Update Italian * Localized Frontend Build * Updated RU Translations * Fresh Build with updated RU changes * Bug Fixes and Loc Updates * Updated Frontend Build * Fresh Build Co-authored-by: Artur <83028930+netsvetaev@users.noreply.github.com>
2022-12-24 18:23:21 +00:00
import i18n from 'i18next';
import Backend from 'i18next-http-backend';
import { initReactI18next } from 'react-i18next';
2023-03-27 14:49:52 +00:00
// TODO: Disabled for IDE performance issues with our translation JSON
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
2023-05-11 14:09:01 +00:00
import translationEN from '../public/locales/en.json';
2023-03-27 14:49:52 +00:00
if (import.meta.env.MODE === 'package') {
i18n.use(initReactI18next).init({
lng: 'en',
resources: {
en: { translation: translationEN },
[WebUI] Localization Support (#2050) * Initial Localization Implementation * Fix Initial Spinner * Language Picker Dropdown * RU Localization Update Co-Authored-By: Artur <83028930+netsvetaev@users.noreply.github.com> * Fixed localization breaking themes * useUpdateTranslation Hook To force trigger translations for data objects * Localize Tab Data * Localize Prompt Input & Current Image Buttons * Localize Gallery & Bug FIxes Fix a bug where the delete image from the context menu wasn't working. Removed tooltips that were broken as they don't work in context menu. * Fix localization breaking in production * Add Toast Localization Support * Localize Unified Canvas * Localize WIP Tabs * Localize Hotkeys * Localize Settings * RU Localization Update Co-Authored-By: Artur <83028930+netsvetaev@users.noreply.github.com> * Add Support for Italian and Portuguese * Localize Toasts * Fix width of language picker items * Localize Backend Messages * Disable Debug Messages * Add Support for French * Fix missing localization for a string in the SettingsModal * Disable French * Styling updates to normalize text and accommodate other langs * Add Portuguese Brazilian * Fix Hotkey headers not being localized. * Fix styling issue on models tag in Settings * Fix Slider Styling to accommodate different languages * Fix slider styling in light mode. * Add German * Add Italian * Add Polish * Update Italian * Localized Frontend Build * Updated RU Translations * Fresh Build with updated RU changes * Bug Fixes and Loc Updates * Updated Frontend Build * Fresh Build Co-authored-by: Artur <83028930+netsvetaev@users.noreply.github.com>
2022-12-24 18:23:21 +00:00
},
2023-03-27 14:49:52 +00:00
debug: false,
[WebUI] Localization Support (#2050) * Initial Localization Implementation * Fix Initial Spinner * Language Picker Dropdown * RU Localization Update Co-Authored-By: Artur <83028930+netsvetaev@users.noreply.github.com> * Fixed localization breaking themes * useUpdateTranslation Hook To force trigger translations for data objects * Localize Tab Data * Localize Prompt Input & Current Image Buttons * Localize Gallery & Bug FIxes Fix a bug where the delete image from the context menu wasn't working. Removed tooltips that were broken as they don't work in context menu. * Fix localization breaking in production * Add Toast Localization Support * Localize Unified Canvas * Localize WIP Tabs * Localize Hotkeys * Localize Settings * RU Localization Update Co-Authored-By: Artur <83028930+netsvetaev@users.noreply.github.com> * Add Support for Italian and Portuguese * Localize Toasts * Fix width of language picker items * Localize Backend Messages * Disable Debug Messages * Add Support for French * Fix missing localization for a string in the SettingsModal * Disable French * Styling updates to normalize text and accommodate other langs * Add Portuguese Brazilian * Fix Hotkey headers not being localized. * Fix styling issue on models tag in Settings * Fix Slider Styling to accommodate different languages * Fix slider styling in light mode. * Add German * Add Italian * Add Polish * Update Italian * Localized Frontend Build * Updated RU Translations * Fresh Build with updated RU changes * Bug Fixes and Loc Updates * Updated Frontend Build * Fresh Build Co-authored-by: Artur <83028930+netsvetaev@users.noreply.github.com>
2022-12-24 18:23:21 +00:00
interpolation: {
escapeValue: false,
},
returnNull: false,
});
2023-03-27 14:49:52 +00:00
} else {
i18n
.use(Backend)
2023-05-12 09:35:03 +00:00
// .use(
// new LanguageDetector(null, {
// lookupLocalStorage: `${LOCALSTORAGE_PREFIX}lng`,
// })
// )
2023-03-27 14:49:52 +00:00
.use(initReactI18next)
.init({
fallbackLng: 'en',
debug: false,
backend: {
loadPath: '/locales/{{lng}}.json',
},
interpolation: {
escapeValue: false,
},
returnNull: false,
});
}
[WebUI] Localization Support (#2050) * Initial Localization Implementation * Fix Initial Spinner * Language Picker Dropdown * RU Localization Update Co-Authored-By: Artur <83028930+netsvetaev@users.noreply.github.com> * Fixed localization breaking themes * useUpdateTranslation Hook To force trigger translations for data objects * Localize Tab Data * Localize Prompt Input & Current Image Buttons * Localize Gallery & Bug FIxes Fix a bug where the delete image from the context menu wasn't working. Removed tooltips that were broken as they don't work in context menu. * Fix localization breaking in production * Add Toast Localization Support * Localize Unified Canvas * Localize WIP Tabs * Localize Hotkeys * Localize Settings * RU Localization Update Co-Authored-By: Artur <83028930+netsvetaev@users.noreply.github.com> * Add Support for Italian and Portuguese * Localize Toasts * Fix width of language picker items * Localize Backend Messages * Disable Debug Messages * Add Support for French * Fix missing localization for a string in the SettingsModal * Disable French * Styling updates to normalize text and accommodate other langs * Add Portuguese Brazilian * Fix Hotkey headers not being localized. * Fix styling issue on models tag in Settings * Fix Slider Styling to accommodate different languages * Fix slider styling in light mode. * Add German * Add Italian * Add Polish * Update Italian * Localized Frontend Build * Updated RU Translations * Fresh Build with updated RU changes * Bug Fixes and Loc Updates * Updated Frontend Build * Fresh Build Co-authored-by: Artur <83028930+netsvetaev@users.noreply.github.com>
2022-12-24 18:23:21 +00:00
export default i18n;