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

@@ -23,7 +23,7 @@ import { type ProjectIDEWidget } from '@/widgets/project-ide-widget';
import { type WidgetContext } from '@/context/widget-context';
/**
* 用于提供当前 focus 的 widget 上下文
* The widget context used to provide the current focus
*/
export const useActivateWidgetContext = (): WidgetContext => {
const currentWidget = useCurrentWidgetFromArea(LayoutPanelType.MAIN_PANEL);

View File

@@ -17,7 +17,7 @@
import { useIDEGlobalStore } from '../context';
export const useCommitVersion = () => {
// 内置了 shallow 操作,无需 useShallow
// Built-in shallow operation, no useShallow
// eslint-disable-next-line @coze-arch/zustand/prefer-shallow
const { version, patch } = useIDEGlobalStore(store => ({
version: store.version,

View File

@@ -46,7 +46,7 @@ const getTabArea = (shell: ApplicationShell, uri?: URI): Area | undefined => {
}
});
// 右边分屏不展示 hover icon
// The split screen on the right does not show the hover icon.
if (children?.length === 1) {
return undefined;
} else if (currentTabIndex === 1) {
@@ -57,10 +57,10 @@ const getTabArea = (shell: ApplicationShell, uri?: URI): Area | undefined => {
};
/**
* 获取当前 uri 的资源在哪个分屏下
* left: 左边分屏
* right: 右边分屏
* undefined: 未分屏
* Get the resource of the current URI under which split screen
* Left: Left split screen
* Right: right split screen
* Undefined: not split screen
*/
export const useSplitScreenArea = (
uri?: URI,
@@ -73,8 +73,8 @@ export const useSplitScreenArea = (
useEffect(() => {
setArea(getTabArea(shell, uri));
const listener = () => {
// 本次 uri 是否在当前 tab不是不执行
// 分屏过程中会出现中间态,布局变更时盲目执行会导致时序异常问题
// Is this URI in the current tab, not not executed
// There will be an intermediate state during the split-screen process, and blind execution when the layout is changed will lead to abnormal timing problems
const uriInCurrentTab = tabBar?.titles.some(title =>
compareURI((title.owner as ReactWidget)?.uri, uri),
);

View File

@@ -21,8 +21,8 @@ import { type ProjectIDEWidget } from '@/widgets/project-ide-widget';
import { type WidgetContext } from '../context/widget-context';
/**
* 获取当前的 WidgetContext
* registry renderContent 内调用
* Get the current WidgetContext
* Called within the registry's renderContent
*/
export function useCurrentWidgetContext<T>(): WidgetContext<T> {
const currentWidget = useCurrentWidget() as ProjectIDEWidget;

View File

@@ -45,7 +45,7 @@ const useCurrentWidgetActivate = (cb: ActivateCallback) => {
};
/**
* 获取当前 widget 的 location
* Get the location of the current widget
*/
export const useIDELocation = () => {
const currentWidget = useCurrentWidget() as ProjectIDEWidget;
@@ -70,7 +70,7 @@ export const useIDELocation = () => {
};
/**
* 获取当前 widget 的 query 参数
* Get the query parameters of the current widget
*/
export const useIDEParams = () => {
const currentWidget = useCurrentWidget() as ProjectIDEWidget;

View File

@@ -41,10 +41,10 @@ export const useIDENavigate = () => {
const uri = new URI(`${URI_SCHEME}://${value}`);
const isUIBuilder = uri.displayName === UI_BUILDER_URI.displayName;
if (value && value !== '/' && !isUIBuilder) {
// 调用 openService
// Call openService
view.open(uri);
} else {
// 如果没有要打开的 widget就只打开主面板
// If there is no widget to open, just open the main panel
view.openPanel(isUIBuilder ? 'ui-builder' : 'dev');
}
navigate(addPreservedSearchParams(url), options);

View File

@@ -18,8 +18,8 @@ import { type interfaces } from 'inversify';
import { useIDEContainer } from '@coze-project-ide/client';
/**
* 获取 IDE 的 IOC 模块
* 和 flow-ide/client 包内容相同,但可以支持在业务侧如 workflow 内调用
* Get the IOC module of the IDE
* The same content as the flow-ide/client package, but it can be called on the business side such as workflow
* @param identifier
*/
export function useIDEServiceInBiz<T>(

View File

@@ -28,14 +28,14 @@ export const useMessageEventService = () =>
useIDEService<MessageEventService>(MessageEventService);
/**
* 获取向 widget 发送信息函数的 hooks
* Get hooks for the function that sends information to the widget
*/
export const useSendMessageEvent = () => {
const messageEventService = useMessageEventService();
const navigate = useIDENavigate();
/**
* 向以 uri 为索引的 widget 发送信息
* Send a message to a widget indexed by URI
*/
const send = useCallback(
<T>(target: string | URI, data: MessageEvent<T>) => {
@@ -49,8 +49,8 @@ export const useSendMessageEvent = () => {
);
/**
* 向以 uri 为索引的 widget 发送信息,并且打开/激活此 widget
* 此函数比较常用
* Send a message to a widget indexed with URIs, and open/activate the widget
* This function is more commonly used
*/
const sendOpen = useCallback(
<T>(target: string | URI, data: MessageEvent<T>) => {
@@ -68,26 +68,26 @@ export const useSendMessageEvent = () => {
};
/**
* 监听向指定 uri 对应的唯一 widget 发送消息的 hook
* 监听消息的 widget 一定是知道 this.uri所以入参无须支持 string
* 注:虽然 widget.uri 的值是会变得,但其 withoutQuery().toString() 一定是不变的,所以 uri 可以认定为不变
* Listens for hooks that send messages to the unique widget corresponding to the specified URI
* The widget listening to the message must know this.uri, so imported parameters do not need to support string.
* Note: Although the value of widget.uri will change, its withoutQuery ().toString () must be unchanged, so uri can be considered unchanged
*/
export const useListenMessageEvent = (
uri: URI,
cb: (e: MessageEvent) => void,
) => {
const messageEventService = useMessageEventService();
// 尽管 uri 对应的唯一 key 不会变化,但 uri 内存地址仍然会变化,这里显式的固化 uri 的不变性
// Although the unique key corresponding to the URI does not change, the URI memory address will still change, and the invariance of the cured URI is explicit here
const uriRef = useRef(uri);
// 保证 callback 函数的可变性
// Guarantee the variability of the callback function
const listener = useMemoizedFn(() => {
const queue = messageEventService.on(uri);
queue.forEach(cb);
});
useEffect(() => {
// 组件挂在时去队列中取一次,有可能在组件未挂载前已经被发送了消息
// When the component is hung, go to the queue to pick it up once. It is possible that the message has been sent before the component is not mounted.
listener();
const disposable = messageEventService.onSend(e => {

View File

@@ -19,7 +19,7 @@ import { type ViewService } from '@/plugins/create-preset-plugin/view-service';
import { useProjectIDEServices } from './use-project-ide-services';
/**
* 获取 ProjectIDE 所有视图操作
* Get all view operations of Project IDE
*/
export const useViewService = (): ViewService => {
const projectIDEServices = useProjectIDEServices();