mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-05-06 14:09:25 +08:00
13 lines
356 B
TypeScript
13 lines
356 B
TypeScript
// @ts-ignore
|
|
import pkg from '../../package.json';
|
|
import { useApp } from '@nocobase/client';
|
|
|
|
export function useT() {
|
|
const app = useApp();
|
|
return (str: string) => app.i18n.t(str, { ns: [pkg.name, 'client'] });
|
|
}
|
|
|
|
export function tStr(key: string) {
|
|
return `{{t(${JSON.stringify(key)}, { ns: ['${pkg.name}', 'client'], nsMode: 'fallback' })}}`;
|
|
}
|