chore: replace all cn comments of fe to en version by volc api (#320)

This commit is contained in:
tecvan
2025-07-31 10:32:15 +08:00
committed by GitHub
parent 716ec0cba8
commit 71f6245a01
2960 changed files with 15545 additions and 15545 deletions

View File

@@ -39,7 +39,7 @@ export const iconFolderOpended = (
export const VARIABLE_RESOURCE_ID = 'variables';
/* 资源文件名最大字符数 */
/* Maximum number of characters for a resource file name */
export const RESOURCE_NAME_MAX_LEN = 50;
export const resourceIconMap = {
[BizResourceTypeEnum.Workflow]: <IconCozWorkflow />,
@@ -102,5 +102,5 @@ export const contextMenuDTOToVOMap = {
export const MAX_DEEP = 6;
export const TAB_SIZE = 14;
export const ITEM_HEIGHT = 28;
/* 禁用文件夹功能 */
/* Disable folder feature */
export const DISABLE_FOLDER = true;

View File

@@ -79,7 +79,7 @@ export type UseResourceFolderConfigProps = {
) => void;
createResourceConfig?: ResourceFolderCozeProps['createResourceConfig'];
/**
* 隐藏更多菜单按钮
* Hide more menu button
*/
hideMoreBtn?: boolean;
} & Pick<ResourceFolderProps, 'validateConfig'>;
@@ -117,7 +117,7 @@ export const useResourceFolderConfig = ({
return [];
}
if (resource.id === ROOT_KEY) {
// 新建文件夹,新建文件,引入资源库
// New folder, new file, import resource library
const createHandlers = createResourceConfig
? createResourceConfig.map(({ label, subType }) => ({
id: `${BizResourceContextMenuBtnType.CreateResource}-${subType}`,

View File

@@ -45,7 +45,7 @@ export class ResourceFolderContribution
}
registerShortcuts(registry: ShortcutsRegistry): void {
// 重命名
// rename
registry.registerHandlers({
commandId: BizResourceContextMenuBtnType.Rename,
keybinding: 'enter',
@@ -54,7 +54,7 @@ export class ResourceFolderContribution
when: RESOURCE_FOLDER_CONTEXT_KEY,
});
// 删除
// delete
registry.registerHandlers({
commandId: BizResourceContextMenuBtnType.Delete,
keybinding: 'meta backspace',
@@ -63,7 +63,7 @@ export class ResourceFolderContribution
when: RESOURCE_FOLDER_CONTEXT_KEY,
});
// 创建文件夹
// Create Folder
registry.registerHandlers({
commandId: BizResourceContextMenuBtnType.CreateFolder,
keybinding: 'alt shift n',
@@ -72,7 +72,7 @@ export class ResourceFolderContribution
when: RESOURCE_FOLDER_CONTEXT_KEY,
});
// 创建资源
// Create a resource
registry.registerHandlers({
commandId: BizResourceContextMenuBtnType.CreateResource,
keybinding: 'alt n',
@@ -81,7 +81,7 @@ export class ResourceFolderContribution
when: RESOURCE_FOLDER_CONTEXT_KEY,
});
// 创建副本
// Create a copy
registry.registerHandlers({
commandId: BizResourceContextMenuBtnType.DuplicateResource,
keybinding: 'alt d',
@@ -91,7 +91,7 @@ export class ResourceFolderContribution
});
}
registerCommands(commands: CommandRegistry): void {
// 重命名 command
// Rename command
commands.registerCommand(
{
id: BizResourceContextMenuBtnType.Rename,
@@ -105,7 +105,7 @@ export class ResourceFolderContribution
},
);
// 删除 command
// Delete command
commands.registerCommand(
{
id: BizResourceContextMenuBtnType.Delete,
@@ -117,7 +117,7 @@ export class ResourceFolderContribution
},
);
// 新建文件夹 command
// New folder command
commands.registerCommand(
{
id: BizResourceContextMenuBtnType.CreateFolder,
@@ -131,13 +131,13 @@ export class ResourceFolderContribution
);
resourceFolderDispatch?.onCreateFolder?.();
},
// 禁用文件夹创建
// Disable folder creation
isEnabled: opt => false, //!opt?.disabled,
isVisible: opt => !opt?.isHidden,
},
);
// 新建资源 command
// New resource command
commands.registerCommand(
{
id: BizResourceContextMenuBtnType.CreateResource,
@@ -150,7 +150,7 @@ export class ResourceFolderContribution
isVisible: opt => !opt?.isHidden,
},
);
// 新建副本 command
// New replica command
commands.registerCommand(
{
id: BizResourceContextMenuBtnType.DuplicateResource,

View File

@@ -122,11 +122,11 @@ const ResourceFolderCozeImpl: FC<ResourceFolderCozeProps> = ({
if (event.id !== props.id) {
return;
}
// 多个创建资源菜单,不使用快捷键
// Multiple Create Resource menus without shortcuts
if (createResourceConfig) {
return;
}
// 快捷键触发的创建资源
// Shortcut-triggered creation of resources
handleCreateResource(groupType);
});

View File

@@ -28,7 +28,7 @@ import {
} from '@coze-project-ide/framework';
/**
* 用于 ResourceType['type'] 里指定资源类型
* Used to specify the resource type in ResourceType ['type']
*/
export enum BizResourceTypeEnum {
Workflow = 'workflow',
@@ -44,33 +44,33 @@ export interface BizResourceTree {
}
export enum BizResourceContextMenuBtnType {
/* 创建资源 */
/* Create a resource */
CreateResource = 'resource-folder-create-resource',
/* 创建文件夹 */
/* Create Folder */
CreateFolder = 'resource-folder-create-folder',
/* 重命名 */
/* rename */
Rename = 'resource-folder-rename',
/* 删除 */
/* delete */
Delete = 'resource-folder-delete',
/* ----------------- 下面的事件会通过 onAction 进行回调 ----------------- */
/* 创建副本 */
/* ----------------- the following events are called back with onAction ----------------- */
/* Create a copy */
DuplicateResource = 'resource-folder-duplicate-resource',
/* 引入资源库文件 */
/* Import repository file */
ImportLibraryResource = 'resource-folder-import-library-resource',
/* 移动到资源库 */
/* Move to Library */
MoveToLibrary = 'resource-folder-move-to-library',
/* 复制到资源库 */
/* Copy to repository */
CopyToLibrary = 'resource-folder-copy-to-library',
/* 启用知识库 */
/* Enable Knowledge Base */
EnableKnowledge = 'resource-folder-enable-knowledge',
/* 禁用知识库 */
/* Disable Knowledge Base */
DisableKnowledge = 'resource-folder-disable-knowledge',
/* 切换为 chatflow */
/* Switch to chatflow */
SwitchToChatflow = 'resource-folder-switch-to-chatflow',
/* 切换为 workflow */
/* Switch to workflow */
SwitchToWorkflow = 'resource-folder-switch-to-workflow',
/* 修改描述 */
/* Modify description */
UpdateDesc = 'resource-folder-update-desc',
}
@@ -87,46 +87,46 @@ export type BizResourceType = ResourceType & ProjectResourceInfo;
export type ResourceSubType = string | number;
export type ResourceFolderCozeProps = {
/** 资源类型 */
/** resource type */
groupType: ProjectResourceGroupType;
/** 后端资源列表数据 */
/** backend resource list data */
resourceTree: BizResourceType[];
/** 自定义事件回调,点击右键菜单/上下文菜单会触发,由业务方实现自定义事件的资源更新逻辑逻辑 */
/** Custom event callback, click the right-click menu/context menu will trigger, and the business party will implement the resource update logic of the custom event */
onAction?: (
action: BizResourceContextMenuBtnType,
resource?: BizResourceType,
) => void;
/**
* 自定义资源创建流程时使用这个 props需要业务自己展示资源创建表单然后更新 resource
* 如果没有自定义逻辑,使用 onCreate
* This props is used when creating a custom resource definition process. The business needs to display the resource creation form by itself, and then update the resource.
* If there is no custom logic, use onCreate
*/
onCustomCreate?: (
groupType: ProjectResourceGroupType,
subType?: ResourceSubType,
) => void;
/**
* 使用默认创建资源的方式,创建资源后的回调,在这里调用业务的创建资源接口
* 配置了 onCustomCreate 会使 onCreate 失效
* 默认创建资源方式:点击新建菜单后,资源列表增加新资源 input 输入框,输入资源名称回车完成创建,触发 onCreate 回调
* Use the default way of creating resources, the callback after creating resources, and call the create resource interface of the business here
* Configuring onCustomCreate will invalidate onCreate
* Default resource creation method: After clicking the New menu, add a new resource to the resource list input text box, enter the resource name Enter to complete the creation, and trigger the onCreate callback
* @param createEvent
* @param subType 如果配置了 createResourceConfig 数组,会有多个创建资源的菜单,通过 subType 区分子类型
* @Param subType If createResourceConfig array is configured, there will be multiple menus to create resources, distinguish subtypes by subType
*/
onCreate?: (
createEvent: CreateResourcePropType,
subType?: ResourceSubType,
) => void;
/**
* 是否可以创建资源
* Is it possible to create resources?
*/
canCreate?: boolean;
/**
* 完成初始加载,用于判断显示空状态
* Complete the initial loading, used to determine the display empty state
*/
initLoaded?: boolean;
/**
* 创建资源的 UI 配置
* 如果资源有多个子类型,可以配置为数组
* 触发 onCreateResource 会传第二个参数 subType
* Create UI configurations for resources
* If the resource has multiple subtypes, it can be configured as an array
* Triggering onCreateResource will pass the second parameter subType
*/
createResourceConfig?: Array<{
icon: ReactNode;
@@ -135,11 +135,11 @@ export type ResourceFolderCozeProps = {
tooltip: ReactNode;
}>;
/**
* 主要用于快捷键创建资源的默认类型。
* Mainly used to shortcut the default type for creating resources.
*/
defaultResourceType?: BizResourceTypeEnum;
/**
* 隐藏更多菜单按钮
* Hide more menu button
*/
hideMoreBtn?: boolean;
} & Pick<

View File

@@ -36,7 +36,7 @@ import {
import { iconFolder, iconFolderOpended, resourceIconMap } from './constants';
export const validateNameBasic: Validator = ({ label }) => {
// 检测 name 是否空
// Check if name is empty
if (!label) {
return I18n.t('project_resource_sidebar_warning_empty_key');
}
@@ -45,7 +45,7 @@ export const validateNameBasic: Validator = ({ label }) => {
return I18n.t('project_resource_sidebar_warning_length_exceeds');
}
// 检测 name 的命名规则
// Detection of naming rules for names
if (!WORKFLOW_NAME_REGEX.test(label)) {
return I18n.t('workflow_list_create_modal_name_rule_reg');
}
@@ -164,7 +164,7 @@ export const getContextMenuLabel = (
};
/**
* 是否动态注册的 action
* Whether the action is dynamically registered
* @param action
*/
export const isDynamicAction = (action: BizResourceContextMenuBtnType) =>

View File

@@ -31,13 +31,13 @@ export interface PrimarySidebarActions {
initLoaded?: boolean;
setSelectedResource: (resourceId?: string) => void;
/**
* 调用 store 里的 refetch 方法通知资源列表刷新
* @param resourceType 刷新的资源类型,可选,不传时刷新所有类型的资源
* Call the refetch method in the store to notify the resource list to refresh
* @Param resourceType The type of resource to refresh, optional, refresh all types of resources when not passing
*/
refetch: (callback?: (tree?: BizResourceTree[]) => void) => Promise<void>;
/**
* 设置资源列表的刷新方法到 store 里,供其他 widget 里调用 store.refetch(xxx) 刷新资源列表
* @param refetchFunc 刷新方法,刷新方法里内部需要处理资源列表的 setResource
* Set the refresh method of the resource list to the store, and call store.refetch (xxx) in other widgets to refresh the resource list
* @Param refetchFunc refresh method, refresh the setResource in the method that needs to process the resource list internally
*/
fetchResource: (
spaceId: string,
@@ -54,15 +54,15 @@ export interface PrimarySidebarState {
version?: string;
resourceTree: BizResourceTree[];
/**
* 资源分组展开状态,按资源分组类型分开记录
* Resource packet expansion status, recorded separately by resource packet type
*/
groupExpandMap: Record<ProjectResourceGroupType, boolean>;
/**
* 当前选中的资源
* The currently selected resource
*/
selectedResource?: string;
/**
* 是否可以关闭 popover sidebar右键菜单打开时不允许关闭 ResourceFolderCoze 组件消费
* Can you close the popover sidebar? It is not allowed to close when the right-click menu is opened, for consumption by the ResourceFolderCoze component
*/
canClosePopover?: boolean;
}
@@ -135,7 +135,7 @@ export const usePrimarySidebarStore = create<
if (!spaceId || !projectId) {
return;
}
// 服务端数据同步延迟
// Server level data synchronization delay
await new Promise<void>(resolve => setTimeout(() => resolve(), 700));
return get().fetchResource(spaceId, projectId, version, callback);
},