diff --git a/src/vs/editor/contrib/gotoSymbol/browser/link/goToDefinitionAtPosition.ts b/src/vs/editor/contrib/gotoSymbol/browser/link/goToDefinitionAtPosition.ts index f5a08f94c1e..8a16c7f7a9f 100644 --- a/src/vs/editor/contrib/gotoSymbol/browser/link/goToDefinitionAtPosition.ts +++ b/src/vs/editor/contrib/gotoSymbol/browser/link/goToDefinitionAtPosition.ts @@ -304,7 +304,7 @@ export class GotoDefinitionAtPositionEditorContribution implements IEditorContri this.editor.setPosition(position); return this.editor.invokeWithinContext((accessor) => { const canPeek = !openToSide && this.editor.getOption(EditorOption.definitionLinkOpensInPeek) && !this.isInPeekEditor(accessor); - const action = new DefinitionAction({ openToSide, openInPeek: canPeek, muteMessage: true }, { title: { value: '', original: '' }, id: '', precondition: undefined }); + const action = new DefinitionAction({ openToSide, openInPeek: canPeek, muteMessage: true }, { title: nls.unlocalized2(''), id: '', precondition: undefined }); return action.run(accessor); }); } diff --git a/src/vs/nls.ts b/src/vs/nls.ts index 233840e65ab..47a5dcdf6d8 100644 --- a/src/vs/nls.ts +++ b/src/vs/nls.ts @@ -202,7 +202,16 @@ export function localize2(data: ILocalizeInfo | string, message: string, ...args return { value: original, original - }; + } as ILocalizedString; +} + +/** + * Create a `ILocalizedString` object that represents an unlocalized string. + * + * This lets you explicitly pass in unlocalized strings to places that normally expect localized strings. + */ +export function unlocalized2(str: string): ILocalizedString { + return { value: str, original: str } as ILocalizedString; } /** diff --git a/src/vs/workbench/contrib/chat/browser/actions/chatQuickInputActions.ts b/src/vs/workbench/contrib/chat/browser/actions/chatQuickInputActions.ts index 9381aa94208..4df9285764e 100644 --- a/src/vs/workbench/contrib/chat/browser/actions/chatQuickInputActions.ts +++ b/src/vs/workbench/contrib/chat/browser/actions/chatQuickInputActions.ts @@ -171,7 +171,7 @@ export function getQuickChatActionForProvider(id: string, label: string) { super({ id: `workbench.action.openQuickChat.${id}`, category: CHAT_CATEGORY, - title: { value: localize('interactiveSession.open', "Open Quick Chat ({0})", label), original: `Open Quick Chat (${label})` }, + title: localize2('interactiveSession.open', "Open Quick Chat ({0})", label), f1: true }); } diff --git a/src/vs/workbench/contrib/comments/test/browser/commentsView.test.ts b/src/vs/workbench/contrib/comments/test/browser/commentsView.test.ts index de511db52f3..e6e274ed91d 100644 --- a/src/vs/workbench/contrib/comments/test/browser/commentsView.test.ts +++ b/src/vs/workbench/contrib/comments/test/browser/commentsView.test.ts @@ -19,6 +19,7 @@ import { DisposableStore } from 'vs/base/common/lifecycle'; import { ensureNoDisposablesAreLeakedInTestSuite } from 'vs/base/test/common/utils'; import { CancellationToken } from 'vs/base/common/cancellation'; import { URI, UriComponents } from 'vs/base/common/uri'; +import { unlocalized2 } from 'vs/nls'; class TestCommentThread implements CommentThread { isDocumentCommentThread(): this is CommentThread { @@ -82,7 +83,7 @@ export class TestViewDescriptorService implements Partial { diff --git a/src/vs/workbench/contrib/files/browser/fileActions.contribution.ts b/src/vs/workbench/contrib/files/browser/fileActions.contribution.ts index 8fcb0937fd9..ed1ea24a08a 100644 --- a/src/vs/workbench/contrib/files/browser/fileActions.contribution.ts +++ b/src/vs/workbench/contrib/files/browser/fileActions.contribution.ts @@ -215,13 +215,13 @@ appendToCommandPalette({ appendToCommandPalette({ id: SAVE_FILE_COMMAND_ID, - title: { value: SAVE_FILE_LABEL, original: 'Save' }, + title: SAVE_FILE_LABEL, category: Categories.File }); appendToCommandPalette({ id: SAVE_FILE_WITHOUT_FORMATTING_COMMAND_ID, - title: { value: SAVE_FILE_WITHOUT_FORMATTING_LABEL, original: 'Save without Formatting' }, + title: SAVE_FILE_WITHOUT_FORMATTING_LABEL, category: Categories.File }); @@ -251,26 +251,26 @@ appendToCommandPalette({ appendToCommandPalette({ id: SAVE_FILE_AS_COMMAND_ID, - title: { value: SAVE_FILE_AS_LABEL, original: 'Save As...' }, + title: SAVE_FILE_AS_LABEL, category: Categories.File }); appendToCommandPalette({ id: NEW_FILE_COMMAND_ID, - title: { value: NEW_FILE_LABEL, original: 'New File' }, + title: NEW_FILE_LABEL, category: Categories.File }, WorkspaceFolderCountContext.notEqualsTo('0')); appendToCommandPalette({ id: NEW_FOLDER_COMMAND_ID, - title: { value: NEW_FOLDER_LABEL, original: 'New Folder' }, + title: NEW_FOLDER_LABEL, category: Categories.File, metadata: { description: nls.localize2('newFolderDescription', "Create a new folder or directory") } }, WorkspaceFolderCountContext.notEqualsTo('0')); appendToCommandPalette({ id: NEW_UNTITLED_FILE_COMMAND_ID, - title: { value: NEW_UNTITLED_FILE_LABEL, original: 'New Untitled Text File' }, + title: NEW_UNTITLED_FILE_LABEL, category: Categories.File }); diff --git a/src/vs/workbench/contrib/files/browser/fileActions.ts b/src/vs/workbench/contrib/files/browser/fileActions.ts index 2f3dc318c25..cb64ae02fb4 100644 --- a/src/vs/workbench/contrib/files/browser/fileActions.ts +++ b/src/vs/workbench/contrib/files/browser/fileActions.ts @@ -61,9 +61,9 @@ import { Categories } from 'vs/platform/action/common/actionCommonCategories'; import { ILocalizedString } from 'vs/platform/action/common/action'; export const NEW_FILE_COMMAND_ID = 'explorer.newFile'; -export const NEW_FILE_LABEL = nls.localize('newFile', "New File..."); +export const NEW_FILE_LABEL = nls.localize2('newFile', "New File..."); export const NEW_FOLDER_COMMAND_ID = 'explorer.newFolder'; -export const NEW_FOLDER_LABEL = nls.localize('newFolder', "New Folder..."); +export const NEW_FOLDER_LABEL = nls.localize2('newFolder', "New Folder..."); export const TRIGGER_RENAME_LABEL = nls.localize('rename', "Rename..."); export const MOVE_FILE_TO_TRASH_LABEL = nls.localize('delete', "Delete"); export const COPY_FILE_LABEL = nls.localize('copyFile', "Copy"); @@ -481,12 +481,12 @@ async function askForOverwrite(fileService: IFileService, dialogService: IDialog export class GlobalCompareResourcesAction extends Action2 { static readonly ID = 'workbench.files.action.compareFileWith'; - static readonly LABEL = nls.localize('globalCompareFile', "Compare Active File With..."); + static readonly LABEL = nls.localize2('globalCompareFile', "Compare Active File With..."); constructor() { super({ id: GlobalCompareResourcesAction.ID, - title: { value: GlobalCompareResourcesAction.LABEL, original: 'Compare Active File With...' }, + title: GlobalCompareResourcesAction.LABEL, f1: true, category: Categories.File, precondition: ActiveEditorContext @@ -609,12 +609,12 @@ export class CloseGroupAction extends Action { export class FocusFilesExplorer extends Action2 { static readonly ID = 'workbench.files.action.focusFilesExplorer'; - static readonly LABEL = nls.localize('focusFilesExplorer', "Focus on Files Explorer"); + static readonly LABEL = nls.localize2('focusFilesExplorer', "Focus on Files Explorer"); constructor() { super({ id: FocusFilesExplorer.ID, - title: { value: FocusFilesExplorer.LABEL, original: 'Focus on Files Explorer' }, + title: FocusFilesExplorer.LABEL, f1: true, category: Categories.File }); @@ -629,12 +629,12 @@ export class FocusFilesExplorer extends Action2 { export class ShowActiveFileInExplorer extends Action2 { static readonly ID = 'workbench.files.action.showActiveFileInExplorer'; - static readonly LABEL = nls.localize('showInExplorer', "Reveal Active File in Explorer View"); + static readonly LABEL = nls.localize2('showInExplorer', "Reveal Active File in Explorer View"); constructor() { super({ id: ShowActiveFileInExplorer.ID, - title: { value: ShowActiveFileInExplorer.LABEL, original: 'Reveal Active File in Explorer View' }, + title: ShowActiveFileInExplorer.LABEL, f1: true, category: Categories.File }); @@ -653,13 +653,13 @@ export class ShowActiveFileInExplorer extends Action2 { export class OpenActiveFileInEmptyWorkspace extends Action2 { static readonly ID = 'workbench.action.files.showOpenedFileInNewWindow'; - static readonly LABEL = nls.localize('openFileInEmptyWorkspace', "Open Active File in New Empty Workspace"); + static readonly LABEL = nls.localize2('openFileInEmptyWorkspace', "Open Active File in New Empty Workspace"); constructor( ) { super({ id: OpenActiveFileInEmptyWorkspace.ID, - title: { value: OpenActiveFileInEmptyWorkspace.LABEL, original: 'Open Active File in New Empty Workspace' }, + title: OpenActiveFileInEmptyWorkspace.LABEL, f1: true, category: Categories.File, precondition: EmptyWorkspaceSupportContext @@ -763,12 +763,12 @@ function getWellFormedFileName(filename: string): string { export class CompareNewUntitledTextFilesAction extends Action2 { static readonly ID = 'workbench.files.action.compareNewUntitledTextFiles'; - static readonly LABEL = nls.localize('compareNewUntitledTextFiles', "Compare New Untitled Text Files"); + static readonly LABEL = nls.localize2('compareNewUntitledTextFiles', "Compare New Untitled Text Files"); constructor() { super({ id: CompareNewUntitledTextFilesAction.ID, - title: { value: CompareNewUntitledTextFilesAction.LABEL, original: 'Compare New Untitled Text Files' }, + title: CompareNewUntitledTextFilesAction.LABEL, f1: true, category: Categories.File }); @@ -788,7 +788,7 @@ export class CompareNewUntitledTextFilesAction extends Action2 { export class CompareWithClipboardAction extends Action2 { static readonly ID = 'workbench.files.action.compareWithClipboard'; - static readonly LABEL = nls.localize('compareWithClipboard', "Compare Active File with Clipboard"); + static readonly LABEL = nls.localize2('compareWithClipboard', "Compare Active File with Clipboard"); private registrationDisposal: IDisposable | undefined; private static SCHEME_COUNTER = 0; @@ -796,7 +796,7 @@ export class CompareWithClipboardAction extends Action2 { constructor() { super({ id: CompareWithClipboardAction.ID, - title: { value: CompareWithClipboardAction.LABEL, original: 'Compare Active File with Clipboard' }, + title: CompareWithClipboardAction.LABEL, f1: true, category: Categories.File, keybinding: { primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KeyK, KeyCode.KeyC), weight: KeybindingWeight.WorkbenchContrib } @@ -1261,12 +1261,12 @@ class BaseSetActiveEditorReadonlyInSession extends Action2 { export class SetActiveEditorReadonlyInSession extends BaseSetActiveEditorReadonlyInSession { static readonly ID = 'workbench.action.files.setActiveEditorReadonlyInSession'; - static readonly LABEL = nls.localize('setActiveEditorReadonlyInSession', "Set Active Editor Read-only in Session"); + static readonly LABEL = nls.localize2('setActiveEditorReadonlyInSession', "Set Active Editor Read-only in Session"); constructor() { super( SetActiveEditorReadonlyInSession.ID, - { value: SetActiveEditorReadonlyInSession.LABEL, original: 'Set Active Editor Readonly in Session' }, + SetActiveEditorReadonlyInSession.LABEL, true ); } @@ -1275,12 +1275,12 @@ export class SetActiveEditorReadonlyInSession extends BaseSetActiveEditorReadonl export class SetActiveEditorWriteableInSession extends BaseSetActiveEditorReadonlyInSession { static readonly ID = 'workbench.action.files.setActiveEditorWriteableInSession'; - static readonly LABEL = nls.localize('setActiveEditorWriteableInSession', "Set Active Editor Writeable in Session"); + static readonly LABEL = nls.localize2('setActiveEditorWriteableInSession', "Set Active Editor Writeable in Session"); constructor() { super( SetActiveEditorWriteableInSession.ID, - { value: SetActiveEditorWriteableInSession.LABEL, original: 'Set Active Editor Writeable in Session' }, + SetActiveEditorWriteableInSession.LABEL, false ); } @@ -1289,12 +1289,12 @@ export class SetActiveEditorWriteableInSession extends BaseSetActiveEditorReadon export class ToggleActiveEditorReadonlyInSession extends BaseSetActiveEditorReadonlyInSession { static readonly ID = 'workbench.action.files.toggleActiveEditorReadonlyInSession'; - static readonly LABEL = nls.localize('toggleActiveEditorReadonlyInSession', "Toggle Active Editor Read-only in Session"); + static readonly LABEL = nls.localize2('toggleActiveEditorReadonlyInSession', "Toggle Active Editor Read-only in Session"); constructor() { super( ToggleActiveEditorReadonlyInSession.ID, - { value: ToggleActiveEditorReadonlyInSession.LABEL, original: 'Toggle Active Editor Readonly in Session' }, + ToggleActiveEditorReadonlyInSession.LABEL, 'toggle' ); } @@ -1303,12 +1303,12 @@ export class ToggleActiveEditorReadonlyInSession extends BaseSetActiveEditorRead export class ResetActiveEditorReadonlyInSession extends BaseSetActiveEditorReadonlyInSession { static readonly ID = 'workbench.action.files.resetActiveEditorReadonlyInSession'; - static readonly LABEL = nls.localize('resetActiveEditorReadonlyInSession', "Reset Active Editor Read-only in Session"); + static readonly LABEL = nls.localize2('resetActiveEditorReadonlyInSession', "Reset Active Editor Read-only in Session"); constructor() { super( ResetActiveEditorReadonlyInSession.ID, - { value: ResetActiveEditorReadonlyInSession.LABEL, original: 'Reset Active Editor Readonly in Session' }, + ResetActiveEditorReadonlyInSession.LABEL, 'reset' ); } diff --git a/src/vs/workbench/contrib/files/browser/fileConstants.ts b/src/vs/workbench/contrib/files/browser/fileConstants.ts index 6736003acd1..c38f9987d22 100644 --- a/src/vs/workbench/contrib/files/browser/fileConstants.ts +++ b/src/vs/workbench/contrib/files/browser/fileConstants.ts @@ -19,14 +19,14 @@ export const COPY_PATH_COMMAND_ID = 'copyFilePath'; export const COPY_RELATIVE_PATH_COMMAND_ID = 'copyRelativeFilePath'; export const SAVE_FILE_AS_COMMAND_ID = 'workbench.action.files.saveAs'; -export const SAVE_FILE_AS_LABEL = nls.localize('saveAs', "Save As..."); +export const SAVE_FILE_AS_LABEL = nls.localize2('saveAs', "Save As..."); export const SAVE_FILE_COMMAND_ID = 'workbench.action.files.save'; -export const SAVE_FILE_LABEL = nls.localize('save', "Save"); +export const SAVE_FILE_LABEL = nls.localize2('save', "Save"); export const SAVE_FILE_WITHOUT_FORMATTING_COMMAND_ID = 'workbench.action.files.saveWithoutFormatting'; -export const SAVE_FILE_WITHOUT_FORMATTING_LABEL = nls.localize('saveWithoutFormatting', "Save without Formatting"); +export const SAVE_FILE_WITHOUT_FORMATTING_LABEL = nls.localize2('saveWithoutFormatting', "Save without Formatting"); export const SAVE_ALL_COMMAND_ID = 'saveAll'; -export const SAVE_ALL_LABEL = nls.localize('saveAll', "Save All"); +export const SAVE_ALL_LABEL = nls.localize2('saveAll', "Save All"); export const SAVE_ALL_IN_GROUP_COMMAND_ID = 'workbench.files.action.saveAllInGroup'; @@ -45,5 +45,5 @@ export const NEXT_COMPRESSED_FOLDER = 'nextCompressedFolder'; export const FIRST_COMPRESSED_FOLDER = 'firstCompressedFolder'; export const LAST_COMPRESSED_FOLDER = 'lastCompressedFolder'; export const NEW_UNTITLED_FILE_COMMAND_ID = 'workbench.action.files.newUntitledFile'; -export const NEW_UNTITLED_FILE_LABEL = nls.localize('newUntitledFile', "New Untitled Text File"); +export const NEW_UNTITLED_FILE_LABEL = nls.localize2('newUntitledFile', "New Untitled Text File"); export const NEW_FILE_COMMAND_ID = 'workbench.action.files.newFile'; diff --git a/src/vs/workbench/contrib/files/browser/views/openEditorsView.ts b/src/vs/workbench/contrib/files/browser/views/openEditorsView.ts index 7115d8fc698..9f21e5014ba 100644 --- a/src/vs/workbench/contrib/files/browser/views/openEditorsView.ts +++ b/src/vs/workbench/contrib/files/browser/views/openEditorsView.ts @@ -835,7 +835,7 @@ registerAction2(class extends Action2 { constructor() { super({ id: 'workbench.action.files.saveAll', - title: { value: SAVE_ALL_LABEL, original: 'Save All' }, + title: SAVE_ALL_LABEL, f1: true, icon: Codicon.saveAll, menu: { diff --git a/src/vs/workbench/contrib/files/electron-sandbox/fileActions.contribution.ts b/src/vs/workbench/contrib/files/electron-sandbox/fileActions.contribution.ts index 92a340e8175..de8140c144b 100644 --- a/src/vs/workbench/contrib/files/electron-sandbox/fileActions.contribution.ts +++ b/src/vs/workbench/contrib/files/electron-sandbox/fileActions.contribution.ts @@ -24,7 +24,7 @@ import { SideBySideEditor, EditorResourceAccessor } from 'vs/workbench/common/ed import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey'; const REVEAL_IN_OS_COMMAND_ID = 'revealFileInOS'; -const REVEAL_IN_OS_LABEL = isWindows ? nls.localize('revealInWindows', "Reveal in File Explorer") : isMacintosh ? nls.localize('revealInMac', "Reveal in Finder") : nls.localize('openContainer', "Open Containing Folder"); +const REVEAL_IN_OS_LABEL = isWindows ? nls.localize2('revealInWindows', "Reveal in File Explorer") : isMacintosh ? nls.localize2('revealInMac', "Reveal in Finder") : nls.localize2('openContainer', "Open Containing Folder"); const REVEAL_IN_OS_WHEN_CONTEXT = ContextKeyExpr.or(ResourceContextKey.Scheme.isEqualTo(Schemas.file), ResourceContextKey.Scheme.isEqualTo(Schemas.vscodeUserData)); KeybindingsRegistry.registerCommandAndKeybindingRule({ @@ -57,13 +57,13 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({ } }); -appendEditorTitleContextMenuItem(REVEAL_IN_OS_COMMAND_ID, REVEAL_IN_OS_LABEL, REVEAL_IN_OS_WHEN_CONTEXT, '2_files', 0); +appendEditorTitleContextMenuItem(REVEAL_IN_OS_COMMAND_ID, REVEAL_IN_OS_LABEL.value, REVEAL_IN_OS_WHEN_CONTEXT, '2_files', 0); // Menu registration - open editors const revealInOsCommand = { id: REVEAL_IN_OS_COMMAND_ID, - title: REVEAL_IN_OS_LABEL + title: REVEAL_IN_OS_LABEL.value }; MenuRegistry.appendMenuItem(MenuId.OpenEditorsContext, { group: 'navigation', @@ -92,6 +92,6 @@ MenuRegistry.appendMenuItem(MenuId.ExplorerContext, { const category = nls.localize2('filesCategory', "File"); appendToCommandPalette({ id: REVEAL_IN_OS_COMMAND_ID, - title: { value: REVEAL_IN_OS_LABEL, original: isWindows ? 'Reveal in File Explorer' : isMacintosh ? 'Reveal in Finder' : 'Open Containing Folder' }, + title: REVEAL_IN_OS_LABEL, category: category }, REVEAL_IN_OS_WHEN_CONTEXT); diff --git a/src/vs/workbench/contrib/inlineChat/browser/inlineChatActions.ts b/src/vs/workbench/contrib/inlineChat/browser/inlineChatActions.ts index 57e2376c569..85033c64166 100644 --- a/src/vs/workbench/contrib/inlineChat/browser/inlineChatActions.ts +++ b/src/vs/workbench/contrib/inlineChat/browser/inlineChatActions.ts @@ -34,7 +34,7 @@ import { IPreferencesService } from 'vs/workbench/services/preferences/common/pr CommandsRegistry.registerCommandAlias('interactiveEditor.start', 'inlineChat.start'); CommandsRegistry.registerCommandAlias('interactive.acceptChanges', ACTION_ACCEPT_CHANGES); -export const LOCALIZED_START_INLINE_CHAT_STRING = localize('run', 'Start Inline Chat'); +export const LOCALIZED_START_INLINE_CHAT_STRING = localize2('run', 'Start Inline Chat'); export const START_INLINE_CHAT = registerIcon('start-inline-chat', Codicon.sparkle, localize('startInlineChat', 'Icon which spawns the inline chat from the editor toolbar.')); // some gymnastics to enable hold for speech without moving the StartSessionAction into the electron-layer @@ -52,7 +52,7 @@ export class StartSessionAction extends EditorAction2 { constructor() { super({ id: 'inlineChat.start', - title: { value: LOCALIZED_START_INLINE_CHAT_STRING, original: 'Start Inline Chat' }, + title: LOCALIZED_START_INLINE_CHAT_STRING, category: AbstractInlineChatAction.category, f1: true, precondition: ContextKeyExpr.and(CTX_INLINE_CHAT_HAS_PROVIDER, EditorContextKeys.writable), diff --git a/src/vs/workbench/contrib/issue/common/issue.contribution.ts b/src/vs/workbench/contrib/issue/common/issue.contribution.ts index ece002871bb..05518d0f4aa 100644 --- a/src/vs/workbench/contrib/issue/common/issue.contribution.ts +++ b/src/vs/workbench/contrib/issue/common/issue.contribution.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { localize } from 'vs/nls'; +import { localize, localize2 } from 'vs/nls'; import { ICommandAction } from 'vs/platform/action/common/action'; import { Categories } from 'vs/platform/action/common/actionCommonCategories'; import { MenuId, MenuRegistry } from 'vs/platform/actions/common/actions'; @@ -97,10 +97,7 @@ export class BaseIssueContribution implements IWorkbenchContribution { const reportIssue: ICommandAction = { id: OpenIssueReporterActionId, - title: { - value: localize({ key: 'reportIssueInEnglish', comment: ['Translate this to "Report Issue in English" in all languages please!'] }, "Report Issue..."), - original: 'Report Issue...' - }, + title: localize2({ key: 'reportIssueInEnglish', comment: ['Translate this to "Report Issue in English" in all languages please!'] }, "Report Issue..."), category: Categories.Help }; diff --git a/src/vs/workbench/contrib/issue/electron-sandbox/issue.contribution.ts b/src/vs/workbench/contrib/issue/electron-sandbox/issue.contribution.ts index 3f446e23dba..05bc0632624 100644 --- a/src/vs/workbench/contrib/issue/electron-sandbox/issue.contribution.ts +++ b/src/vs/workbench/contrib/issue/electron-sandbox/issue.contribution.ts @@ -43,7 +43,7 @@ class ReportPerformanceIssueUsingReporterAction extends Action2 { constructor() { super({ id: ReportPerformanceIssueUsingReporterAction.ID, - title: { value: localize({ key: 'reportPerformanceIssue', comment: [`Here, 'issue' means problem or bug`] }, "Report Performance Issue..."), original: 'Report Performance Issue' }, + title: localize2({ key: 'reportPerformanceIssue', comment: [`Here, 'issue' means problem or bug`] }, "Report Performance Issue..."), category: Categories.Help, f1: true }); diff --git a/src/vs/workbench/contrib/localHistory/electron-sandbox/localHistoryCommands.ts b/src/vs/workbench/contrib/localHistory/electron-sandbox/localHistoryCommands.ts index 20d20356e6e..76ac171e9af 100644 --- a/src/vs/workbench/contrib/localHistory/electron-sandbox/localHistoryCommands.ts +++ b/src/vs/workbench/contrib/localHistory/electron-sandbox/localHistoryCommands.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { localize } from 'vs/nls'; +import { localize2 } from 'vs/nls'; import { IWorkingCopyHistoryService } from 'vs/workbench/services/workingCopy/common/workingCopyHistory'; import { ServicesAccessor } from 'vs/editor/browser/editorExtensions'; import { registerAction2, Action2, MenuId } from 'vs/platform/actions/common/actions'; @@ -21,10 +21,7 @@ registerAction2(class extends Action2 { constructor() { super({ id: 'workbench.action.localHistory.revealInOS', - title: { - value: isWindows ? localize('revealInWindows', "Reveal in File Explorer") : isMacintosh ? localize('revealInMac', "Reveal in Finder") : localize('openContainer', "Open Containing Folder"), - original: isWindows ? 'Reveal in File Explorer' : isMacintosh ? 'Reveal in Finder' : 'Open Containing Folder' - }, + title: isWindows ? localize2('revealInWindows', "Reveal in File Explorer") : isMacintosh ? localize2('revealInMac', "Reveal in Finder") : localize2('openContainer', "Open Containing Folder"), menu: { id: MenuId.TimelineItemContext, group: '4_reveal', diff --git a/src/vs/workbench/contrib/localization/common/localizationsActions.ts b/src/vs/workbench/contrib/localization/common/localizationsActions.ts index 97c275ac765..d9ad34f1c1b 100644 --- a/src/vs/workbench/contrib/localization/common/localizationsActions.ts +++ b/src/vs/workbench/contrib/localization/common/localizationsActions.ts @@ -100,12 +100,12 @@ export class ConfigureDisplayLanguageAction extends Action2 { export class ClearDisplayLanguageAction extends Action2 { public static readonly ID = 'workbench.action.clearLocalePreference'; - public static readonly LABEL = localize('clearDisplayLanguage', "Clear Display Language Preference"); + public static readonly LABEL = localize2('clearDisplayLanguage', "Clear Display Language Preference"); constructor() { super({ id: ClearDisplayLanguageAction.ID, - title: { original: 'Clear Display Language Preference', value: ClearDisplayLanguageAction.LABEL }, + title: ClearDisplayLanguageAction.LABEL, menu: { id: MenuId.CommandPalette } diff --git a/src/vs/workbench/contrib/markers/browser/markers.contribution.ts b/src/vs/workbench/contrib/markers/browser/markers.contribution.ts index 2466217b62c..aa02cce1cb8 100644 --- a/src/vs/workbench/contrib/markers/browser/markers.contribution.ts +++ b/src/vs/workbench/contrib/markers/browser/markers.contribution.ts @@ -311,7 +311,7 @@ registerAction2(class extends Action2 { constructor() { super({ id: 'workbench.action.problems.focus', - title: { value: Messages.MARKERS_PANEL_SHOW_LABEL, original: 'Focus Problems (Errors, Warnings, Infos)' }, + title: Messages.MARKERS_PANEL_SHOW_LABEL, category: Categories.View, f1: true, }); @@ -446,7 +446,7 @@ registerAction2(class extends ViewAction { constructor() { super({ id: Markers.MARKERS_VIEW_SHOW_MULTILINE_MESSAGE, - title: { value: localize('show multiline', "Show message in multiple lines"), original: 'Problems: Show message in multiple lines' }, + title: localize2('show multiline', "Show message in multiple lines"), category: localize('problems', "Problems"), menu: { id: MenuId.CommandPalette, @@ -464,7 +464,7 @@ registerAction2(class extends ViewAction { constructor() { super({ id: Markers.MARKERS_VIEW_SHOW_SINGLELINE_MESSAGE, - title: { value: localize('show singleline', "Show message in single line"), original: 'Problems: Show message in single line' }, + title: localize2('show singleline', "Show message in single line"), category: localize('problems', "Problems"), menu: { id: MenuId.CommandPalette, diff --git a/src/vs/workbench/contrib/markers/browser/messages.ts b/src/vs/workbench/contrib/markers/browser/messages.ts index e6a387f0ce2..29c07828fc6 100644 --- a/src/vs/workbench/contrib/markers/browser/messages.ts +++ b/src/vs/workbench/contrib/markers/browser/messages.ts @@ -12,7 +12,7 @@ import { Marker } from './markersModel'; export default class Messages { public static MARKERS_PANEL_TOGGLE_LABEL: string = nls.localize('problems.view.toggle.label', "Toggle Problems (Errors, Warnings, Infos)"); - public static MARKERS_PANEL_SHOW_LABEL: string = nls.localize('problems.view.focus.label', "Focus Problems (Errors, Warnings, Infos)"); + public static MARKERS_PANEL_SHOW_LABEL = nls.localize2('problems.view.focus.label', "Focus Problems (Errors, Warnings, Infos)"); public static PROBLEMS_PANEL_CONFIGURATION_TITLE: string = nls.localize('problems.panel.configuration.title', "Problems View"); public static PROBLEMS_PANEL_CONFIGURATION_AUTO_REVEAL: string = nls.localize('problems.panel.configuration.autoreveal', "Controls whether Problems view should automatically reveal files when opening them."); diff --git a/src/vs/workbench/contrib/share/browser/share.contribution.ts b/src/vs/workbench/contrib/share/browser/share.contribution.ts index 2eb7e5595d5..ae071141610 100644 --- a/src/vs/workbench/contrib/share/browser/share.contribution.ts +++ b/src/vs/workbench/contrib/share/browser/share.contribution.ts @@ -8,7 +8,7 @@ import { CancellationTokenSource } from 'vs/base/common/cancellation'; import { Codicon } from 'vs/base/common/codicons'; import { MarkdownString } from 'vs/base/common/htmlContent'; import { KeyCode, KeyMod } from 'vs/base/common/keyCodes'; -import { localize } from 'vs/nls'; +import { localize, localize2 } from 'vs/nls'; import { Action2, MenuId, MenuRegistry, registerAction2 } from 'vs/platform/actions/common/actions'; import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; @@ -77,12 +77,12 @@ class ShareWorkbenchContribution { this._disposables.add( registerAction2(class ShareAction extends Action2 { static readonly ID = 'workbench.action.share'; - static readonly LABEL = localize('share', 'Share...'); + static readonly LABEL = localize2('share', 'Share...'); constructor() { super({ id: ShareAction.ID, - title: { value: ShareAction.LABEL, original: 'Share...' }, + title: ShareAction.LABEL, f1: true, icon: Codicon.linkExternal, precondition: ContextKeyExpr.and(ShareProviderCountContext.notEqualsTo(0), WorkspaceFolderCountContext.notEqualsTo(0)), diff --git a/src/vs/workbench/contrib/tasks/browser/abstractTaskService.ts b/src/vs/workbench/contrib/tasks/browser/abstractTaskService.ts index 27f92a65ad3..43246667cfe 100644 --- a/src/vs/workbench/contrib/tasks/browser/abstractTaskService.ts +++ b/src/vs/workbench/contrib/tasks/browser/abstractTaskService.ts @@ -90,7 +90,7 @@ const USE_SLOW_PICKER = 'task.quickOpen.showAll'; export namespace ConfigureTaskAction { export const ID = 'workbench.action.tasks.configureTaskRunner'; - export const TEXT = nls.localize('ConfigureTaskRunnerAction.label', "Configure Task"); + export const TEXT = nls.localize2('ConfigureTaskRunnerAction.label', "Configure Task"); } export type TaskQuickPickEntryType = (IQuickPickItem & { task: Task }) | (IQuickPickItem & { folder: IWorkspaceFolder }) | (IQuickPickItem & { settingType: string }); @@ -2563,7 +2563,7 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer const thisCapture: AbstractTaskService = this; return new class extends Action { constructor() { - super(ConfigureTaskAction.ID, ConfigureTaskAction.TEXT, undefined, true, () => { thisCapture._runConfigureTasks(); return Promise.resolve(undefined); }); + super(ConfigureTaskAction.ID, ConfigureTaskAction.TEXT.value, undefined, true, () => { thisCapture._runConfigureTasks(); return Promise.resolve(undefined); }); } }; } @@ -2576,7 +2576,7 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer const needsTerminate = buildError.code === TaskErrors.RunningTask; if (needsConfig || needsTerminate) { this._notificationService.prompt(buildError.severity, buildError.message, [{ - label: needsConfig ? ConfigureTaskAction.TEXT : nls.localize('TerminateAction.label', "Terminate Task"), + label: needsConfig ? ConfigureTaskAction.TEXT.value : nls.localize('TerminateAction.label', "Terminate Task"), run: () => { if (needsConfig) { this._runConfigureTasks(); diff --git a/src/vs/workbench/contrib/tasks/browser/task.contribution.ts b/src/vs/workbench/contrib/tasks/browser/task.contribution.ts index d92f58923b0..a0d2bb523f6 100644 --- a/src/vs/workbench/contrib/tasks/browser/task.contribution.ts +++ b/src/vs/workbench/contrib/tasks/browser/task.contribution.ts @@ -246,7 +246,7 @@ MenuRegistry.appendMenuItem(MenuId.CommandPalette, { MenuRegistry.appendMenuItem(MenuId.CommandPalette, { command: { id: ConfigureTaskAction.ID, - title: { value: ConfigureTaskAction.TEXT, original: 'Configure Task' }, + title: ConfigureTaskAction.TEXT, category: TASKS_CATEGORY }, when: TaskExecutionSupportedContext diff --git a/src/vs/workbench/contrib/update/browser/update.contribution.ts b/src/vs/workbench/contrib/update/browser/update.contribution.ts index 46b1d76365a..1fc44c7d8f6 100644 --- a/src/vs/workbench/contrib/update/browser/update.contribution.ts +++ b/src/vs/workbench/contrib/update/browser/update.contribution.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import 'vs/platform/update/common/update.config.contribution'; -import { localize, localize2 } from 'vs/nls'; +import { localize, localize2, unlocalized2 } from 'vs/nls'; import { Registry } from 'vs/platform/registry/common/platform'; import { IWorkbenchContributionsRegistry, Extensions as WorkbenchExtensions } from 'vs/workbench/common/contributions'; import { Categories } from 'vs/platform/action/common/actionCommonCategories'; @@ -41,7 +41,7 @@ export class ShowCurrentReleaseNotesAction extends Action2 { ...localize2('showReleaseNotes', "Show Release Notes"), mnemonicTitle: localize({ key: 'mshowReleaseNotes', comment: ['&& denotes a mnemonic'] }, "Show &&Release Notes"), }, - category: { value: product.nameShort, original: product.nameShort }, + category: unlocalized2(product.nameShort), f1: true, precondition: RELEASE_NOTES_URL, menu: [{ @@ -80,7 +80,7 @@ export class CheckForUpdateAction extends Action2 { super({ id: 'update.checkForUpdate', title: localize2('checkForUpdates', 'Check for Updates...'), - category: { value: product.nameShort, original: product.nameShort }, + category: unlocalized2(product.nameShort), f1: true, precondition: CONTEXT_UPDATE_STATE.isEqualTo(StateType.Idle), }); @@ -97,7 +97,7 @@ class DownloadUpdateAction extends Action2 { super({ id: 'update.downloadUpdate', title: localize2('downloadUpdate', 'Download Update'), - category: { value: product.nameShort, original: product.nameShort }, + category: unlocalized2(product.nameShort), f1: true, precondition: CONTEXT_UPDATE_STATE.isEqualTo(StateType.AvailableForDownload) }); @@ -113,7 +113,7 @@ class InstallUpdateAction extends Action2 { super({ id: 'update.installUpdate', title: localize2('installUpdate', 'Install Update'), - category: { value: product.nameShort, original: product.nameShort }, + category: unlocalized2(product.nameShort), f1: true, precondition: CONTEXT_UPDATE_STATE.isEqualTo(StateType.Downloaded) }); @@ -129,7 +129,7 @@ class RestartToUpdateAction extends Action2 { super({ id: 'update.restartToUpdate', title: localize2('restartToUpdate', 'Restart to Update'), - category: { value: product.nameShort, original: product.nameShort }, + category: unlocalized2(product.nameShort), f1: true, precondition: CONTEXT_UPDATE_STATE.isEqualTo(StateType.Ready) }); diff --git a/src/vs/workbench/contrib/url/browser/trustedDomains.ts b/src/vs/workbench/contrib/url/browser/trustedDomains.ts index 2019b04e521..82c9559dad4 100644 --- a/src/vs/workbench/contrib/url/browser/trustedDomains.ts +++ b/src/vs/workbench/contrib/url/browser/trustedDomains.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import { URI } from 'vs/base/common/uri'; -import { localize } from 'vs/nls'; +import { localize, localize2 } from 'vs/nls'; import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation'; import { IProductService } from 'vs/platform/product/common/productService'; import { IQuickInputService, IQuickPickItem } from 'vs/platform/quickinput/common/quickInput'; @@ -25,7 +25,7 @@ export const TRUSTED_DOMAINS_CONTENT_STORAGE_KEY = 'http.linkProtectionTrustedDo export const manageTrustedDomainSettingsCommand = { id: 'workbench.action.manageTrustedDomain', description: { - description: localize('trustedDomain.manageTrustedDomain', 'Manage Trusted Domains'), + description: localize2('trustedDomain.manageTrustedDomain', 'Manage Trusted Domains'), args: [] }, handler: async (accessor: ServicesAccessor) => { diff --git a/src/vs/workbench/contrib/url/browser/url.contribution.ts b/src/vs/workbench/contrib/url/browser/url.contribution.ts index d0484bd566c..92e2b6b9611 100644 --- a/src/vs/workbench/contrib/url/browser/url.contribution.ts +++ b/src/vs/workbench/contrib/url/browser/url.contribution.ts @@ -55,10 +55,7 @@ CommandsRegistry.registerCommand(manageTrustedDomainSettingsCommand); MenuRegistry.appendMenuItem(MenuId.CommandPalette, { command: { id: manageTrustedDomainSettingsCommand.id, - title: { - value: manageTrustedDomainSettingsCommand.description.description, - original: 'Manage Trusted Domains' - } + title: manageTrustedDomainSettingsCommand.description.description } }); diff --git a/src/vs/workbench/contrib/userDataSync/browser/userDataSync.ts b/src/vs/workbench/contrib/userDataSync/browser/userDataSync.ts index 5a716a0880e..0787368edba 100644 --- a/src/vs/workbench/contrib/userDataSync/browser/userDataSync.ts +++ b/src/vs/workbench/contrib/userDataSync/browser/userDataSync.ts @@ -835,7 +835,7 @@ export class UserDataSyncWorkbenchContribution extends Disposable implements IWo } private getShowConflictsTitle(): ILocalizedString { - return { value: localize('resolveConflicts_global', "Show Conflicts ({0})", this.getConflictsCount()), original: `Show Conflicts (${this.getConflictsCount()})` }; + return localize2('resolveConflicts_global', "Show Conflicts ({0})", this.getConflictsCount()); } private conflictsActionDisposable = this._register(new MutableDisposable()); diff --git a/src/vs/workbench/contrib/webviewPanel/browser/webviewCommands.ts b/src/vs/workbench/contrib/webviewPanel/browser/webviewCommands.ts index f973ce7ef5b..356a852efdb 100644 --- a/src/vs/workbench/contrib/webviewPanel/browser/webviewCommands.ts +++ b/src/vs/workbench/contrib/webviewPanel/browser/webviewCommands.ts @@ -104,12 +104,12 @@ export class WebViewEditorFindPreviousCommand extends Action2 { export class ReloadWebviewAction extends Action2 { static readonly ID = 'workbench.action.webview.reloadWebviewAction'; - static readonly LABEL = nls.localize('refreshWebviewLabel', "Reload Webviews"); + static readonly LABEL = nls.localize2('refreshWebviewLabel', "Reload Webviews"); public constructor() { super({ id: ReloadWebviewAction.ID, - title: { value: ReloadWebviewAction.LABEL, original: 'Reload Webviews' }, + title: ReloadWebviewAction.LABEL, category: Categories.Developer, menu: [{ id: MenuId.CommandPalette diff --git a/src/vs/workbench/electron-sandbox/actions/installActions.ts b/src/vs/workbench/electron-sandbox/actions/installActions.ts index 952883aec23..d9332bb4855 100644 --- a/src/vs/workbench/electron-sandbox/actions/installActions.ts +++ b/src/vs/workbench/electron-sandbox/actions/installActions.ts @@ -21,10 +21,7 @@ export class InstallShellScriptAction extends Action2 { constructor() { super({ id: 'workbench.action.installCommandLine', - title: { - value: localize('install', "Install '{0}' command in PATH", product.applicationName), - original: `Install \'${product.applicationName}\' command in PATH` - }, + title: localize2('install', "Install '{0}' command in PATH", product.applicationName), category: shellCommandCategory, f1: true }); @@ -54,10 +51,7 @@ export class UninstallShellScriptAction extends Action2 { constructor() { super({ id: 'workbench.action.uninstallCommandLine', - title: { - value: localize('uninstall', "Uninstall '{0}' command from PATH", product.applicationName), - original: `Uninstall \'${product.applicationName}\' command from PATH` - }, + title: localize2('uninstall', "Uninstall '{0}' command from PATH", product.applicationName), category: shellCommandCategory, f1: true }); diff --git a/src/vs/workbench/services/views/browser/viewsService.ts b/src/vs/workbench/services/views/browser/viewsService.ts index 7f036faf807..49643efd588 100644 --- a/src/vs/workbench/services/views/browser/viewsService.ts +++ b/src/vs/workbench/services/views/browser/viewsService.ts @@ -501,10 +501,10 @@ export class ViewsService extends Disposable implements IViewsService { private registerFocusViewAction(viewDescriptor: IViewDescriptor, category?: string | ILocalizedString): IDisposable { return registerAction2(class FocusViewAction extends Action2 { constructor() { - const title = localize({ key: 'focus view', comment: ['{0} indicates the name of the view to be focused.'] }, "Focus on {0} View", viewDescriptor.name.value); + const title = localize2({ key: 'focus view', comment: ['{0} indicates the name of the view to be focused.'] }, "Focus on {0} View", viewDescriptor.name.value); super({ id: viewDescriptor.focusCommand ? viewDescriptor.focusCommand.id : `${viewDescriptor.id}.focus`, - title: { original: `Focus on ${viewDescriptor.name.original} View`, value: title }, + title, category, menu: [{ id: MenuId.CommandPalette, @@ -520,7 +520,7 @@ export class ViewsService extends Disposable implements IViewsService { win: viewDescriptor.focusCommand?.keybindings?.win }, metadata: { - description: title, + description: title.value, args: [ { name: 'focusOptions', diff --git a/src/vs/workbench/services/views/common/viewContainerModel.ts b/src/vs/workbench/services/views/common/viewContainerModel.ts index d7c9f7149ab..60009d0ff79 100644 --- a/src/vs/workbench/services/views/common/viewContainerModel.ts +++ b/src/vs/workbench/services/views/common/viewContainerModel.ts @@ -21,12 +21,13 @@ import { Action2, registerAction2 } from 'vs/platform/actions/common/actions'; import { Categories } from 'vs/platform/action/common/actionCommonCategories'; import { IOutputService } from 'vs/workbench/services/output/common/output'; import { CounterSet } from 'vs/base/common/map'; +import { localize2 } from 'vs/nls'; registerAction2(class extends Action2 { constructor() { super({ id: '_workbench.output.showViewsLog', - title: { value: 'Show Views Log', original: 'Show Views Log' }, + title: localize2('showViewsLog', "Show Views Log"), category: Categories.Developer, f1: true });