diff --git a/packages/core/cli/templates/plugin/src/client/locale.ts b/packages/core/cli/templates/plugin/src/client/locale.ts index acaee6a43d..8d6dc7b9f6 100644 --- a/packages/core/cli/templates/plugin/src/client/locale.ts +++ b/packages/core/cli/templates/plugin/src/client/locale.ts @@ -4,9 +4,9 @@ import { useApp } from '@nocobase/client'; export function useT() { const app = useApp(); - return (str: string) => app.i18n.t(str, { ns: pkg.name }); + return (str: string) => app.i18n.t(str, { ns: [pkg.name, 'client'] }); } export function tStr(key: string) { - return `{{t('${key}', { ns: '${pkg.name}', nsMode: 'fallback' })}}`; + return `{{t(${JSON.stringify(key)}, { ns: ['${pkg.name}', 'client'], nsMode: 'fallback' })}}`; }