diff --git a/packages/core/cli/templates/plugin/src/client/locale.ts b/packages/core/cli/templates/plugin/src/client/locale.ts new file mode 100644 index 000000000..2cf2a9558 --- /dev/null +++ b/packages/core/cli/templates/plugin/src/client/locale.ts @@ -0,0 +1,12 @@ +import { useTranslation } from 'react-i18next'; + +// @ts-ignore +import pkg from './../../package.json'; + +export function usePluginTranslation() { + return useTranslation([pkg.name, 'client'], { nsMode: 'fallback' }); +} + +export function generatePluginTranslationTemplate(key: string) { + return `{{t('${key}', { ns: ['${pkg.name}', 'client'], nsMode: 'fallback' })}}`; +} diff --git a/packages/core/cli/templates/plugin/src/locale/en-US.json b/packages/core/cli/templates/plugin/src/locale/en-US.json new file mode 100644 index 000000000..0967ef424 --- /dev/null +++ b/packages/core/cli/templates/plugin/src/locale/en-US.json @@ -0,0 +1 @@ +{} diff --git a/packages/core/cli/templates/plugin/src/locale/zh-CN.json b/packages/core/cli/templates/plugin/src/locale/zh-CN.json new file mode 100644 index 000000000..0967ef424 --- /dev/null +++ b/packages/core/cli/templates/plugin/src/locale/zh-CN.json @@ -0,0 +1 @@ +{}