Skip to content

armgit / dify

Public Imported from GitHub
0

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.

fix: load i18n on server (#30171)

Stephen Zhou08d5eee993da
diff --git a/web/i18n-config/server.ts b/web/i18n-config/server.ts
index c92a5a60258..736d76e2c7e 100644
--- a/web/i18n-config/server.ts
+++ b/web/i18n-config/server.ts
@@ -1,7 +1,6 @@
import type { Locale } from '.'
-import type { KeyPrefix, Namespace } from './i18next-config'
+import type { Namespace } from './i18next-config'
import { match } from '@formatjs/intl-localematcher'
-import { camelCase } from 'es-toolkit/compat'
import { createInstance } from 'i18next'
import resourcesToBackend from 'i18next-resources-to-backend'
import Negotiator from 'negotiator'
@@ -23,10 +22,11 @@ const initI18next = async (lng: Locale, ns: Namespace) => {
return i18nInstance
}
-export async function getTranslation(lng: Locale, ns: Namespace) {
+export async function getTranslation(lng: Locale, ns: Namespace, options: Record<string, any> = {}) {
const i18nextInstance = await initI18next(lng, ns)
return {
- t: i18nextInstance.getFixedT(lng, 'translation', camelCase(ns) as KeyPrefix),
+ // @ts-expect-error types mismatch
+ t: i18nextInstance.getFixedT(lng, ns, options.keyPrefix),
i18n: i18nextInstance,
}
}