Co-authored-by: sealday <zhanglin@daoyoucloud.com> Co-authored-by: sealday <sealday@gmail.com> Reviewed-on: daoyoucloud/tachybase#673 Co-authored-by: bai.zixv <bai.zixv@foxmail.com> Co-committed-by: bai.zixv <bai.zixv@foxmail.com>
21 lines
509 B
TypeScript
21 lines
509 B
TypeScript
import { i18n, tval as nTval } from '@nocobase/client';
|
|
|
|
export const NAMESPACE = '@hera/plugin-approval';
|
|
|
|
export function usePluginTranslation(): any {
|
|
return useTranslation();
|
|
}
|
|
|
|
export function useTranslation() {
|
|
const t = (key: string, options = {}) => i18n.t(key, { ns: NAMESPACE, ...options });
|
|
return { t };
|
|
}
|
|
export function lang(key: string, options = {}) {
|
|
return i18n.t(key, {
|
|
...options,
|
|
ns: NAMESPACE,
|
|
});
|
|
}
|
|
|
|
export const tval = (key: string) => nTval(key, { ns: NAMESPACE });
|