mirror of
https://github.com/nocobase/nocobase
synced 2024-11-15 10:46:54 +00:00
Merge branch 'main' into next
Some checks are pending
Build Docker Image / build-and-push (push) Waiting to run
Build Pro Image / build-and-push (push) Waiting to run
E2E / Build (push) Waiting to run
E2E / Core and plugins (push) Blocked by required conditions
E2E / plugin-workflow (push) Blocked by required conditions
E2E / plugin-workflow-approval (push) Blocked by required conditions
E2E / plugin-data-source-main (push) Blocked by required conditions
E2E / Comment on PR (push) Blocked by required conditions
NocoBase FrontEnd Test / frontend-test (18) (push) Waiting to run
Some checks are pending
Build Docker Image / build-and-push (push) Waiting to run
Build Pro Image / build-and-push (push) Waiting to run
E2E / Build (push) Waiting to run
E2E / Core and plugins (push) Blocked by required conditions
E2E / plugin-workflow (push) Blocked by required conditions
E2E / plugin-workflow-approval (push) Blocked by required conditions
E2E / plugin-data-source-main (push) Blocked by required conditions
E2E / Comment on PR (push) Blocked by required conditions
NocoBase FrontEnd Test / frontend-test (18) (push) Waiting to run
This commit is contained in:
commit
04fe973609
@ -1,12 +1,12 @@
|
|||||||
import { useTranslation } from 'react-i18next';
|
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import pkg from './../../package.json';
|
import pkg from './../../package.json';
|
||||||
|
import { useApp } from '@nocobase/client';
|
||||||
|
|
||||||
export function usePluginTranslation() {
|
export function useT() {
|
||||||
return useTranslation([pkg.name, 'client'], { nsMode: 'fallback' });
|
const app = useApp();
|
||||||
|
return (str: string) => app.i18n.t(str, { ns: pkg.name });
|
||||||
}
|
}
|
||||||
|
|
||||||
export function generatePluginTranslationTemplate(key: string) {
|
export function tStr(key: string) {
|
||||||
return `{{t('${key}', { ns: ['${pkg.name}', 'client'], nsMode: 'fallback' })}}`;
|
return `{{t('${key}', { ns: '${pkg.name}', nsMode: 'fallback' })}}`;
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,7 @@ i18n
|
|||||||
lng: 'en-US',
|
lng: 'en-US',
|
||||||
// debug: true,
|
// debug: true,
|
||||||
defaultNS: 'client',
|
defaultNS: 'client',
|
||||||
// fallbackNS: 'client',
|
fallbackNS: 'client',
|
||||||
// backend: {
|
// backend: {
|
||||||
// // for all available options read the backend's repository readme file
|
// // for all available options read the backend's repository readme file
|
||||||
// loadPath: '/api/locales/{{lng}}/{{ns}}.json',
|
// loadPath: '/api/locales/{{lng}}/{{ns}}.json',
|
||||||
|
Loading…
Reference in New Issue
Block a user