refactor(i18n): about locales (#30336)

Co-authored-by: yyh <yuanyouhuilyz@gmail.com>
This commit is contained in:
Stephen Zhou
2025-12-30 14:38:23 +08:00
committed by GitHub
parent 3505516e8e
commit 2399d00d86
70 changed files with 273 additions and 320 deletions

View File

@ -1,9 +1,6 @@
/* eslint-disable dify-i18n/require-ns-option */
import type { Locale } from '@/i18n-config'
import {
getLocaleOnServer,
getTranslation as translate,
} from '@/i18n-config/server'
import { getLocaleOnServer, getTranslation } from '@/i18n-config/server'
type DescriptionProps = {
locale?: Locale
@ -12,8 +9,8 @@ const Description = async ({
locale: localeFromProps,
}: DescriptionProps) => {
const localeDefault = await getLocaleOnServer()
const { t } = await translate(localeFromProps || localeDefault, 'plugin')
const { t: tCommon } = await translate(localeFromProps || localeDefault, 'common')
const { t } = await getTranslation(localeFromProps || localeDefault, 'plugin')
const { t: tCommon } = await getTranslation(localeFromProps || localeDefault, 'common')
const isZhHans = localeFromProps === 'zh-Hans'
return (