临时解决菜单栏中英文翻译问题

This commit is contained in:
Keming Liang 2022-10-18 15:45:54 +08:00
parent 8715534d75
commit 9be37b0d12
3 changed files with 13 additions and 12 deletions

View File

@ -24,6 +24,7 @@ import { IUpdateService, StateType } from 'vs/platform/update/common/update';
import { getTitleBarStyle, INativeRunActionInWindowRequest, INativeRunKeybindingInWindowRequest, IWindowOpenable } from 'vs/platform/window/common/window'; import { getTitleBarStyle, INativeRunActionInWindowRequest, INativeRunKeybindingInWindowRequest, IWindowOpenable } from 'vs/platform/window/common/window';
import { IWindowsCountChangedEvent, IWindowsMainService, OpenContext } from 'vs/platform/windows/electron-main/windows'; import { IWindowsCountChangedEvent, IWindowsMainService, OpenContext } from 'vs/platform/windows/electron-main/windows';
import { IWorkspacesHistoryMainService } from 'vs/platform/workspaces/electron-main/workspacesHistoryMainService'; import { IWorkspacesHistoryMainService } from 'vs/platform/workspaces/electron-main/workspacesHistoryMainService';
import * as platform from 'vs/base/common/platform';
const telemetryFrom = 'menu'; const telemetryFrom = 'menu';
@ -299,7 +300,7 @@ export class Menubar {
//Project //Project
if (this.shouldDrawMenu('Project')) { if (this.shouldDrawMenu('Project')) {
const projectMenu = new Menu(); const projectMenu = new Menu();
const projectMenuItem = new MenuItem({ label: this.mnemonicLabel(nls.localize({ key: 'mProject', comment: ['&& denotes a mnemonic'] }, "&&Project")), submenu: projectMenu, role: 'help' }); const projectMenuItem = new MenuItem({ label: this.mnemonicLabel((platform.language == 'zh-cn' ? '项目' : 'Project')), submenu: projectMenu, role: 'help' });
this.setMenuById(projectMenu, 'Project'); this.setMenuById(projectMenu, 'Project');
menubar.append(projectMenuItem); menubar.append(projectMenuItem);
} }
@ -342,7 +343,6 @@ export class Menubar {
this.setMenuById(terminalMenu, 'Terminal'); this.setMenuById(terminalMenu, 'Terminal');
menubar.append(terminalMenuItem); menubar.append(terminalMenuItem);
} }
// Mac: Window // Mac: Window
let macWindowMenuItem: MenuItem | undefined; let macWindowMenuItem: MenuItem | undefined;
if (this.shouldDrawMenu('Window')) { if (this.shouldDrawMenu('Window')) {

View File

@ -1,4 +1,4 @@
import { localize } from 'vs/nls'; //import { localize } from 'vs/nls';
import { MenuId, MenuRegistry } from 'vs/platform/actions/common/actions'; import { MenuId, MenuRegistry } from 'vs/platform/actions/common/actions';
//import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey'; //import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey';
@ -9,13 +9,14 @@ const commandPackageProject = "project.buildPackage";
const commandDebugProject = "debug.openView"; const commandDebugProject = "debug.openView";
const commandRunProject = "workbench.action.tasks.runTask"; const commandRunProject = "workbench.action.tasks.runTask";
const commandBuidProject = "workbench.action.tasks.build"; const commandBuidProject = "workbench.action.tasks.build";
import * as platform from 'vs/base/common/platform';
MenuRegistry.appendMenuItem(MenuId.MenubarProjectMenu, { MenuRegistry.appendMenuItem(MenuId.MenubarProjectMenu, {
group: '1_project', group: '1_project',
command: { command: {
id: commandCreateProject, id: commandCreateProject,
title: localize({ key: 'miDefault Template', comment: ['&& denotes a mnemonic'] }, "&&Create New Project") title: (platform.language == 'zh-cn' ? '创建新的项目' : 'Create New Project')
}, },
order: 1, order: 1,
// when: ContextKeyExpr.has('hasCreateProject') // when: ContextKeyExpr.has('hasCreateProject')
@ -24,7 +25,7 @@ MenuRegistry.appendMenuItem(MenuId.MenubarProjectMenu, {
group: '1_project', group: '1_project',
command: { command: {
id: commandConfigProject, id: commandConfigProject,
title: localize({ key: 'miDefault Template', comment: ['&& denotes a mnemonic'] }, "&&Config Project") title: (platform.language == 'zh-cn' ? '配置当前项目' : 'Configure Project')
}, },
order: 2, order: 2,
// when: ContextKeyExpr.has('hasCreateProject') // when: ContextKeyExpr.has('hasCreateProject')
@ -33,7 +34,7 @@ MenuRegistry.appendMenuItem(MenuId.MenubarProjectMenu, {
group: '1_project', group: '1_project',
command: { command: {
id: commandBuidProject, id: commandBuidProject,
title: localize({ key: 'miDefault Template', comment: ['&& denotes a mnemonic'] }, "&&Build") title: (platform.language == 'zh-cn' ? '构建' : 'Build')
}, },
order: 3, order: 3,
// when: ContextKeyExpr.has('hasCreateProject') // when: ContextKeyExpr.has('hasCreateProject')
@ -42,7 +43,7 @@ MenuRegistry.appendMenuItem(MenuId.MenubarProjectMenu, {
group: '1_project', group: '1_project',
command: { command: {
id: commandDebugProject, id: commandDebugProject,
title: localize({ key: 'miDefault Template', comment: ['&& denotes a mnemonic'] }, "&&Debug") title: (platform.language == 'zh-cn' ? '调试' : 'Debug')
}, },
order: 4, order: 4,
// when: ContextKeyExpr.has('hasCreateProject') // when: ContextKeyExpr.has('hasCreateProject')
@ -51,7 +52,7 @@ MenuRegistry.appendMenuItem(MenuId.MenubarProjectMenu, {
group: '1_project', group: '1_project',
command: { command: {
id: commandRunProject, id: commandRunProject,
title: localize({ key: 'miDefault Template', comment: ['&& denotes a mnemonic'] }, "&&Run") title: (platform.language == 'zh-cn' ? '运行' : 'Run')
}, },
order: 5, order: 5,
// when: ContextKeyExpr.equals('hasCreateProject', true) // when: ContextKeyExpr.equals('hasCreateProject', true)
@ -60,7 +61,7 @@ MenuRegistry.appendMenuItem(MenuId.MenubarProjectMenu, {
group: '1_project', group: '1_project',
command: { command: {
id: commandPackageProject, id: commandPackageProject,
title: localize({ key: 'miDefault Template', comment: ['&& denotes a mnemonic'] }, "&&Pack") title: (platform.language == 'zh-cn' ? '打包' : 'Pack')
}, },
order: 6, order: 6,
// when: ContextKeyExpr.has('hasCreateProject') // when: ContextKeyExpr.has('hasCreateProject')

View File

@ -41,7 +41,7 @@ import { ICommandService } from 'vs/platform/commands/common/commands';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { OpenRecentAction } from 'vs/workbench/browser/actions/windowActions'; import { OpenRecentAction } from 'vs/workbench/browser/actions/windowActions';
import { IWorkbenchExtensionEnablementService } from 'vs/workbench/services/extensionManagement/common/extensionManagement'; import { IWorkbenchExtensionEnablementService } from 'vs/workbench/services/extensionManagement/common/extensionManagement';
import * as platform from 'vs/base/common/platform';
export type IOpenRecentAction = IAction & { uri: URI; remoteAuthority?: string }; export type IOpenRecentAction = IAction & { uri: URI; remoteAuthority?: string };
MenuRegistry.appendMenuItem(MenuId.MenubarMainMenu, { MenuRegistry.appendMenuItem(MenuId.MenubarMainMenu, {
@ -118,9 +118,9 @@ MenuRegistry.appendMenuItem(MenuId.MenubarMainMenu, {
MenuRegistry.appendMenuItem(MenuId.MenubarMainMenu, { MenuRegistry.appendMenuItem(MenuId.MenubarMainMenu, {
submenu: MenuId.MenubarProjectMenu, submenu: MenuId.MenubarProjectMenu,
title: { title: {
value: 'Project', value: (platform.language == 'zh-cn' ? '项目' : 'Project'),
original: 'Project', original: 'Project',
mnemonicTitle: localize({ key: 'mProject', comment: ['&& denotes a mnemonic'] }, "&&Project") mnemonicTitle: (platform.language == 'zh-cn' ? '项目' : 'Project')
}, },
order: 10 order: 10
}); });