Provides React hook and expression function for localized strings in NocoBase plugin settings pages using flow engine context.
// Source: https://github.com/nocobase/nocobase | License: Apache-2.0
// Provided via justclaw.it.com; keep this notice with the code.
/**
* This file is part of the NocoBase (R) project.
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
* Authors: NocoBase Team.
*
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
* For more information, please refer to: https://www.nocobase.com/agreement.
*/
import { tExpr as _tExpr, useFlowEngine } from '@nocobase/flow-engine';
// @ts-ignore
import pkg from './../../package.json';
export function useT() {
const engine = useFlowEngine();
return (str: string) => engine.context.t(str, { ns: [pkg.name, 'client'] });
}
export function tExpr(key: string) {
return _tExpr(key, { ns: [pkg.name, 'client'] });
}
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key