fix: i18n of workflow/map (#1210)

Co-authored-by: sealday <sealday@gmail.com>
Reviewed-on: daoyoucloud/tachybase#1210
This commit is contained in:
sealday 2024-06-19 20:29:49 +08:00
parent 329f62a3ca
commit eb01bdcb6a
11 changed files with 47 additions and 17 deletions

View File

@ -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",

View File

@ -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": "更新记录操作",

View File

@ -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() {

View File

@ -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 });
}

View File

@ -0,0 +1,3 @@
export default {
"Homepage config": "Homepage config"
}

View File

@ -0,0 +1,3 @@
export default {
"Homepage config": "首页配置"
}

View File

@ -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',

View File

@ -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 };
}

View File

@ -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"

View File

@ -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"

View File

@ -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": "毫秒"