Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.
Python agentagentic-aiagentic-frameworkagentic-workflowaiautomationclaudedeepseekgenaigptllmlow-codemcpnextjsno-codeopenaipythonskillsworkflow
refactor(i18next): streamline fallback translation handling and initi… (#22894)
Wu Tianweia8f09ad43fbd
diff --git a/web/i18n/i18next-config.ts b/web/i18n/i18next-config.tsindex 8c5bd375a77..7af727af7e5 100644--- a/web/i18n/i18next-config.ts+++ b/web/i18n/i18next-config.ts@@ -50,24 +50,35 @@ export const loadLangResources = async (lang: string) => {acc[camelCase(NAMESPACES[index])] = modreturn acc}, {} as Record<string, any>)+ return resources+}++const getFallbackTranslation = () => {+ const resources = NAMESPACES.reduce((acc, ns, index) => {+ acc[camelCase(NAMESPACES[index])] = require(`./en-US/${ns}`).default+ return acc+ }, {} as Record<string, any>)return {translation: resources,}}-i18n.use(initReactI18next)- .init({- lng: undefined,- fallbackLng: 'en-US',- })+if (!i18n.isInitialized) {+ i18n.use(initReactI18next)+ .init({+ lng: undefined,+ fallbackLng: 'en-US',+ resources: {+ 'en-US': getFallbackTranslation(),+ },+ })+}export const changeLanguage = async (lng?: string) => {const resolvedLng = lng ?? 'en-US'- const resources = {- [resolvedLng]: await loadLangResources(resolvedLng),- }+ const resource = await loadLangResources(resolvedLng)if (!i18n.hasResourceBundle(resolvedLng, 'translation'))- i18n.addResourceBundle(resolvedLng, 'translation', resources[resolvedLng].translation, true, true)+ i18n.addResourceBundle(resolvedLng, 'translation', resource, true, true)await i18n.changeLanguage(resolvedLng)}