diff --git a/packages/plugins/@hera/plugin-core/src/locale/en-US.json b/packages/plugins/@hera/plugin-core/src/locale/en-US.json index 2af0822f8..398e996f1 100644 --- a/packages/plugins/@hera/plugin-core/src/locale/en-US.json +++ b/packages/plugins/@hera/plugin-core/src/locale/en-US.json @@ -61,6 +61,7 @@ "Something went wrong. Please contact the developer to resolve the issue.": "Something went wrong. Please contact the developer to resolve the issue.", "Superior department": "Superior department", "System setting": "System setting", + "Theme": "Theme", "The department has members, please remove them first": "The department has members, please remove them first", "The department has sub-departments, please delete them first": "The department has sub-departments, please delete them first", "The following selected requests all trigger interception on submission": "The following selected requests all trigger interception on submission", diff --git a/packages/plugins/@hera/plugin-core/src/locale/zh-CN.json b/packages/plugins/@hera/plugin-core/src/locale/zh-CN.json index 6513556cd..4d38b345b 100644 --- a/packages/plugins/@hera/plugin-core/src/locale/zh-CN.json +++ b/packages/plugins/@hera/plugin-core/src/locale/zh-CN.json @@ -69,6 +69,7 @@ "This field is currently not supported for use in form blocks.": "该字段目前不支持在表单区块中使用。", "This month": "本月", "This year": "今年", + "Theme": "主题", "Trigger mode": "触发模式", "Triggered before the execution of a request initiated through an action button or API, such as before adding, updating, or deleting data. Suitable for data validation and logic judgment before action, and the request could be rejected by using the \"End process\" node.": "通过操作按钮或 API 发起请求并在执行前触发,比如新增、更新、删除数据之前。适用于在操作前进行数据验证、逻辑判断,并可通过“结束节点”来拦截请求。", "Update record action": "更新记录操作", diff --git a/packages/plugins/@hera/plugin-homepage/src/client/index.tsx b/packages/plugins/@hera/plugin-homepage/src/client/index.tsx index 5352c548c..3eb088c30 100644 --- a/packages/plugins/@hera/plugin-homepage/src/client/index.tsx +++ b/packages/plugins/@hera/plugin-homepage/src/client/index.tsx @@ -1,7 +1,8 @@ -import { Plugin, tval } from '@tachybase/client'; +import { Plugin } from '@tachybase/client'; import { HomePage } from './Home'; import { HomePageConfiguration } from './HomePageConfiguration'; +import { tval } from './locale'; export class PluginHomePageClient extends Plugin { async load() { diff --git a/packages/plugins/@hera/plugin-homepage/src/client/locale.tsx b/packages/plugins/@hera/plugin-homepage/src/client/locale.tsx new file mode 100644 index 000000000..efbf25495 --- /dev/null +++ b/packages/plugins/@hera/plugin-homepage/src/client/locale.tsx @@ -0,0 +1,27 @@ +import { Application, i18n, tval as nTval, useApp } from '@tachybase/client'; + +const NAMESPACE = '@hera/plugin-homepage'; + +export class Locale { + private app: Application; + + constructor(app: Application) { + this.app = app; + } + + lang(key: string) { + return this.app.i18n.t(key, { ns: NAMESPACE }); + } +} + +export const useTranslation = (): any => { + const { i18n } = useApp(); + const t = (key: string, props = {}) => i18n.t(key, { ns: NAMESPACE, ...props }); + return { t }; +}; + +export const tval = (key: string) => nTval(key, { ns: NAMESPACE }); + +export function lang(key: string) { + return i18n.t(key, { ns: NAMESPACE }); +} diff --git a/packages/plugins/@hera/plugin-homepage/src/locale/en-US.ts b/packages/plugins/@hera/plugin-homepage/src/locale/en-US.ts new file mode 100644 index 000000000..54ae9106e --- /dev/null +++ b/packages/plugins/@hera/plugin-homepage/src/locale/en-US.ts @@ -0,0 +1,3 @@ +export default { + "Homepage config": "Homepage config" +} diff --git a/packages/plugins/@hera/plugin-homepage/src/locale/zh-CN.ts b/packages/plugins/@hera/plugin-homepage/src/locale/zh-CN.ts new file mode 100644 index 000000000..46508894f --- /dev/null +++ b/packages/plugins/@hera/plugin-homepage/src/locale/zh-CN.ts @@ -0,0 +1,3 @@ +export default { + "Homepage config": "首页配置" +} diff --git a/packages/plugins/@tachybase/plugin-map/src/client/index.tsx b/packages/plugins/@tachybase/plugin-map/src/client/index.tsx index ef05ef819..19c2e3c03 100644 --- a/packages/plugins/@tachybase/plugin-map/src/client/index.tsx +++ b/packages/plugins/@tachybase/plugin-map/src/client/index.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { CurrentAppInfoProvider, Plugin, SchemaComponentOptions } from '@tachybase/client'; +import { Plugin, SchemaComponentOptions } from '@tachybase/client'; import { MapBlockOptions } from './block'; import { mapActionInitializers, mapActionInitializers_deprecated } from './block/MapActionInitializers'; @@ -40,7 +40,7 @@ export class MapPlugin extends Plugin { }); this.app.pluginSettingsManager.add(NAMESPACE, { - title: `{{t("Map Manager", { ns: "${NAMESPACE}" })}}`, + title: generateNTemplate('Map Manager'), icon: 'EnvironmentOutlined', Component: Configuration, aclSnippet: 'pm.map.configuration', diff --git a/packages/plugins/@tachybase/plugin-map/src/client/locale/index.ts b/packages/plugins/@tachybase/plugin-map/src/client/locale/index.ts index 24fa2825b..fd5860865 100644 --- a/packages/plugins/@tachybase/plugin-map/src/client/locale/index.ts +++ b/packages/plugins/@tachybase/plugin-map/src/client/locale/index.ts @@ -1,21 +1,18 @@ -import { i18n } from '@tachybase/client'; -import { useTranslation } from 'react-i18next'; +import { i18n, tval, useApp } from '@tachybase/client'; export const NAMESPACE = 'map'; -// i18n.addResources('zh-CN', NAMESPACE, zhCN); -// i18n.addResources('en-US', NAMESPACE, enUS); export function lang(key: string) { - return i18n.t(key, { ns: NAMESPACE }); + return i18n.t(key, { ns: [NAMESPACE, 'client'] }); } export function generateNTemplate(key: string) { - return `{{t('${key}', { ns: '${NAMESPACE}', nsMode: 'fallback' })}}`; + return tval(key, { ns: [NAMESPACE, 'client'] }); } export function useMapTranslation() { - return useTranslation(NAMESPACE, { - nsMode: 'fallback', - }); + const { i18n } = useApp(); + const t = (key: string, props = {}) => i18n.t(key, { ns: [NAMESPACE, 'client'], ...props }); + return { t }; } diff --git a/packages/plugins/@tachybase/plugin-workflow/package.json b/packages/plugins/@tachybase/plugin-workflow/package.json index 02c9dc57e..c8cf77b94 100644 --- a/packages/plugins/@tachybase/plugin-workflow/package.json +++ b/packages/plugins/@tachybase/plugin-workflow/package.json @@ -7,10 +7,6 @@ "Workflow" ], "license": "Apache-2.0", - "exports": { - ".": "./dist/server/index.js", - "./client": "./dist/client/index.js" - }, "main": "./dist/server/index.js", "dependencies": { "jsonata": "^2.0.5" diff --git a/packages/plugins/@tachybase/plugin-workflow/src/locale/en-US.json b/packages/plugins/@tachybase/plugin-workflow/src/locale/en-US.json index f0cfbb622..71daf8a8b 100644 --- a/packages/plugins/@tachybase/plugin-workflow/src/locale/en-US.json +++ b/packages/plugins/@tachybase/plugin-workflow/src/locale/en-US.json @@ -263,6 +263,7 @@ "Withdrawn": "Withdrawn", "Workflow todos": "Workflow todos", "Workflow": "Workflow", + "Webhook manager": "Webhook manager", "\"Content-Type\" only support \"application/json\", and no need to specify": "\"Content-Type\" only support \"application/json\", and no need to specify", "concat": "concat", "ms": "ms" diff --git a/packages/plugins/@tachybase/plugin-workflow/src/locale/zh-CN.json b/packages/plugins/@tachybase/plugin-workflow/src/locale/zh-CN.json index 06b89d5c7..b8f216de8 100644 --- a/packages/plugins/@tachybase/plugin-workflow/src/locale/zh-CN.json +++ b/packages/plugins/@tachybase/plugin-workflow/src/locale/zh-CN.json @@ -312,7 +312,6 @@ "Unassigned fields will be set to default values, and those without default values will be set to null.": "未被赋值的字段将被设置为默认值,没有默认值的设置为空值。", "Unconfigured": "未配置", "Unprocessed": "未处理", - "Unprocessed": "未处理", "Update all eligible data at one time, which has better performance when the amount of data is large. But the updated data will not trigger other workflows, and will not record audit logs.": "一次性更新所有符合条件的数据,在数据量较大时有比较好的性能;但被更新的数据不会触发其他工作流,也不会记录更新日志。", "Update in a batch": "批量更新", "Update mode": "更新模式", @@ -344,6 +343,7 @@ "Workflow will be triggered before or after submitting succeeded based on workflow type.": "工作流会基于其类型在提交成功之前或之后触发。", "Workflow will be triggered directly once the button clicked, without data saving.": "按钮点击后直接触发工作流,但不会保存数据。", "Workflow": "工作流", + "Webhook manager": "Webhook 管理", "\"Content-Type\" only support \"application/json\", and no need to specify": "\"Content-Type\" 请求头仅支持 \"application/json\",无需填写", "concat": "连接", "ms": "毫秒"