mirror of
https://gitee.com/nocobase/nocobase.git
synced 2024-11-29 10:48:30 +08:00
fix: plugin template add locale (#4943)
This commit is contained in:
parent
d2aedd01d0
commit
e727581967
12
packages/core/cli/templates/plugin/src/client/locale.ts
Normal file
12
packages/core/cli/templates/plugin/src/client/locale.ts
Normal file
@ -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' })}}`;
|
||||
}
|
1
packages/core/cli/templates/plugin/src/locale/en-US.json
Normal file
1
packages/core/cli/templates/plugin/src/locale/en-US.json
Normal file
@ -0,0 +1 @@
|
||||
{}
|
1
packages/core/cli/templates/plugin/src/locale/zh-CN.json
Normal file
1
packages/core/cli/templates/plugin/src/locale/zh-CN.json
Normal file
@ -0,0 +1 @@
|
||||
{}
|
Loading…
Reference in New Issue
Block a user