diff --git a/packages/bulk-edit/src/browser/bulk-edit-contribution.ts b/packages/bulk-edit/src/browser/bulk-edit-contribution.ts index c7c2e9d8c894f..35c63990e56b7 100644 --- a/packages/bulk-edit/src/browser/bulk-edit-contribution.ts +++ b/packages/bulk-edit/src/browser/bulk-edit-contribution.ts @@ -21,10 +21,9 @@ import { AbstractViewContribution } from '@theia/core/lib/browser/shell/view-con import { BulkEditCommands } from './bulk-edit-commands'; import { MonacoBulkEditService } from '@theia/monaco/lib/browser/monaco-bulk-edit-service'; import { TabBarToolbarContribution, TabBarToolbarRegistry } from '@theia/core/lib/browser/shell/tab-bar-toolbar'; -import { BulkEditTreeWidget, BULK_EDIT_TREE_WIDGET_ID } from './bulk-edit-tree'; +import { BulkEditTreeWidget, BULK_EDIT_TREE_WIDGET_ID, BULK_EDIT_WIDGET_NAME } from './bulk-edit-tree'; import { QuickViewService } from '@theia/core/lib/browser'; - -export const BULK_EDIT_WIDGET_NAME = 'Refactor Preview'; +import { nls } from '@theia/core/lib/common/nls'; @injectable() export class BulkEditContribution extends AbstractViewContribution implements TabBarToolbarContribution { @@ -64,13 +63,13 @@ export class BulkEditContribution extends AbstractViewContribution 0) { return super.renderTree(model); } - return
No edits have been detected in the workspace so far.
; + return
{nls.localize('vscode/bulkEditService/nothing', 'No edits have been detected in the workspace so far.')}
; } protected renderCaption(node: TreeNode, props: NodeProps): React.ReactNode { diff --git a/packages/callhierarchy/src/browser/callhierarchy-contribution.ts b/packages/callhierarchy/src/browser/callhierarchy-contribution.ts index c128a049ffc95..4495ccd25386c 100644 --- a/packages/callhierarchy/src/browser/callhierarchy-contribution.ts +++ b/packages/callhierarchy/src/browser/callhierarchy-contribution.ts @@ -27,10 +27,10 @@ export const CALL_HIERARCHY_TOGGLE_COMMAND_ID = 'callhierarchy:toggle'; export const CALL_HIERARCHY_LABEL = 'Call Hierarchy'; export namespace CallHierarchyCommands { - export const OPEN: Command = { + export const OPEN = Command.toLocalizedCommand({ id: 'callhierarchy:open', label: 'Open Call Hierarchy' - }; + }, 'theia/callhierarchy/open'); } @injectable() diff --git a/packages/console/src/browser/console-contribution.ts b/packages/console/src/browser/console-contribution.ts index 742de1bc874be..74b993ae3b444 100644 --- a/packages/console/src/browser/console-contribution.ts +++ b/packages/console/src/browser/console-contribution.ts @@ -21,6 +21,7 @@ import { ConsoleManager } from './console-manager'; import { ConsoleKeybindingContexts } from './console-keybinding-contexts'; import { ConsoleWidget } from './console-widget'; import { ConsoleContentWidget } from './console-content-widget'; +import { nls } from '@theia/core/lib/common/nls'; export namespace ConsoleCommands { export const SELECT_ALL: Command = { @@ -91,22 +92,22 @@ export class ConsoleContribution implements FrontendApplicationContribution, Com registerMenus(menus: MenuModelRegistry): void { menus.registerMenuAction(ConsoleContextMenu.CLIPBOARD, { commandId: CommonCommands.COPY.id, - label: 'Copy', + label: CommonCommands.COPY.label, order: 'a1', }); menus.registerMenuAction(ConsoleContextMenu.CLIPBOARD, { commandId: ConsoleCommands.SELECT_ALL.id, - label: 'Select All', + label: CommonCommands.SELECT_ALL.label, order: 'a2' }); menus.registerMenuAction(ConsoleContextMenu.CLIPBOARD, { commandId: ConsoleCommands.COLLAPSE_ALL.id, - label: 'Collapse All', + label: nls.localize('vscode/repl/collapse', 'Collapse All'), order: 'a3' }); menus.registerMenuAction(ConsoleContextMenu.CLEAR, { commandId: ConsoleCommands.CLEAR.id, - label: 'Clear Console' + label: nls.localize('vscode/repl/clearRepl', 'Clear Console') }); } diff --git a/packages/core/src/browser/about-dialog.tsx b/packages/core/src/browser/about-dialog.tsx index 2b35cf293dfcf..e05cec5836a5c 100644 --- a/packages/core/src/browser/about-dialog.tsx +++ b/packages/core/src/browser/about-dialog.tsx @@ -16,7 +16,7 @@ import * as React from 'react'; import { inject, injectable, postConstruct } from 'inversify'; -import { DialogProps } from './dialogs'; +import { Dialog, DialogProps } from './dialogs'; import { ReactDialog } from './dialogs/react-dialog'; import { ApplicationServer, ApplicationInfo, ExtensionInfo } from '../common/application-protocol'; import { Message } from './widgets/widget'; @@ -44,7 +44,7 @@ export class AboutDialog extends ReactDialog { super({ title: FrontendApplicationConfigProvider.get().applicationName, }); - this.appendAcceptButton('Ok'); + this.appendAcceptButton(Dialog.OK); } @postConstruct() diff --git a/packages/core/src/browser/common-frontend-contribution.ts b/packages/core/src/browser/common-frontend-contribution.ts index 10d5cefbfa529..e30a0b7c4a126 100644 --- a/packages/core/src/browser/common-frontend-contribution.ts +++ b/packages/core/src/browser/common-frontend-contribution.ts @@ -90,192 +90,196 @@ export namespace CommonMenus { export namespace CommonCommands { - const FILE_CATEGORY = 'File'; - const VIEW_CATEGORY = 'View'; + export const FILE_CATEGORY_KEY = 'vscode/menubarControl/mFile'; + export const VIEW_CATEGORY_KEY = 'vscode/menubarControl/mView'; + export const PREFERENCES_CATEGORY_KEY = 'vscode/actions/preferences'; + export const FILE_CATEGORY = 'File'; + export const VIEW_CATEGORY = 'View'; + export const PREFERENCES_CATEGORY = 'Preferences'; export const OPEN: Command = { id: 'core.open', }; - export const CUT: Command = { + export const CUT = Command.toLocalizedCommand({ id: 'core.cut', label: 'Cut' - }; - export const COPY: Command = { + }, 'vscode/fileActions.contribution/cut'); + export const COPY = Command.toLocalizedCommand({ id: 'core.copy', label: 'Copy' - }; - export const PASTE: Command = { + }, 'vscode/fileActions/copyFile'); + export const PASTE = Command.toLocalizedCommand({ id: 'core.paste', label: 'Paste' - }; + }, 'vscode/fileActions/pasteFile'); - export const COPY_PATH: Command = { + export const COPY_PATH = Command.toLocalizedCommand({ id: 'core.copy.path', label: 'Copy Path' - }; + }, 'vscode/fileActions.contribution/copyPath'); - export const UNDO: Command = { + export const UNDO = Command.toLocalizedCommand({ id: 'core.undo', label: 'Undo' - }; - export const REDO: Command = { + }, 'vscode/textInputActions/undo'); + export const REDO = Command.toLocalizedCommand({ id: 'core.redo', label: 'Redo' - }; - export const SELECT_ALL: Command = { + }, 'vscode/textInputActions/redo'); + export const SELECT_ALL = Command.toLocalizedCommand({ id: 'core.selectAll', label: 'Select All' - }; + }, 'vscode/textInputActions/selectAll'); - export const FIND: Command = { + export const FIND = Command.toLocalizedCommand({ id: 'core.find', label: 'Find' - }; - export const REPLACE: Command = { + }, 'vscode/simpleFindReplaceWidget/label.find'); + export const REPLACE = Command.toLocalizedCommand({ id: 'core.replace', label: 'Replace' - }; + }, 'vscode/simpleFindReplaceWidget/label.replace'); - export const NEXT_TAB: Command = { + export const NEXT_TAB = Command.toLocalizedCommand({ id: 'core.nextTab', category: VIEW_CATEGORY, label: 'Switch to Next Tab' - }; - export const PREVIOUS_TAB: Command = { + }, 'vscode/menubar/mShowNextTab', VIEW_CATEGORY_KEY); + export const PREVIOUS_TAB = Command.toLocalizedCommand({ id: 'core.previousTab', category: VIEW_CATEGORY, label: 'Switch to Previous Tab' - }; - export const NEXT_TAB_IN_GROUP: Command = { + }, 'vscode/menubar/mShowPreviousTab', VIEW_CATEGORY_KEY); + export const NEXT_TAB_IN_GROUP = Command.toLocalizedCommand({ id: 'core.nextTabInGroup', category: VIEW_CATEGORY, label: 'Switch to Next Tab in Group' - }; - export const PREVIOUS_TAB_IN_GROUP: Command = { + }, 'theia/core/common/showNextTabInGroup', VIEW_CATEGORY_KEY); + export const PREVIOUS_TAB_IN_GROUP = Command.toLocalizedCommand({ id: 'core.previousTabInGroup', category: VIEW_CATEGORY, label: 'Switch to Previous Tab in Group' - }; - export const NEXT_TAB_GROUP: Command = { + }, 'theia/core/common/showPreviousTabInGroup', VIEW_CATEGORY_KEY); + export const NEXT_TAB_GROUP = Command.toLocalizedCommand({ id: 'core.nextTabGroup', category: VIEW_CATEGORY, label: 'Switch to Next Tab Group' - }; - export const PREVIOUS_TAB_GROUP: Command = { + }, 'theia/core/common/showNextTabGroup', VIEW_CATEGORY_KEY); + export const PREVIOUS_TAB_GROUP = Command.toLocalizedCommand({ id: 'core.previousTabBar', category: VIEW_CATEGORY, label: 'Switch to Previous Tab Group' - }; - export const CLOSE_TAB: Command = { + }, 'theia/core/common/showPreviousTabGroup', VIEW_CATEGORY_KEY); + export const CLOSE_TAB = Command.toLocalizedCommand({ id: 'core.close.tab', category: VIEW_CATEGORY, label: 'Close Tab' - }; - export const CLOSE_OTHER_TABS: Command = { + }, 'theia/core/common/closeTab', VIEW_CATEGORY_KEY); + export const CLOSE_OTHER_TABS = Command.toLocalizedCommand({ id: 'core.close.other.tabs', category: VIEW_CATEGORY, label: 'Close Other Tabs' - }; - export const CLOSE_RIGHT_TABS: Command = { + }, 'theia/core/common/closeOthers', VIEW_CATEGORY_KEY); + export const CLOSE_RIGHT_TABS = Command.toLocalizedCommand({ id: 'core.close.right.tabs', category: VIEW_CATEGORY, label: 'Close Tabs to the Right' - }; - export const CLOSE_ALL_TABS: Command = { + }, 'theia/core/common/closeRight', VIEW_CATEGORY_KEY); + export const CLOSE_ALL_TABS = Command.toLocalizedCommand({ id: 'core.close.all.tabs', category: VIEW_CATEGORY, label: 'Close All Tabs' - }; - export const CLOSE_MAIN_TAB: Command = { + }, 'theia/core/common/closeAll', VIEW_CATEGORY_KEY); + export const CLOSE_MAIN_TAB = Command.toLocalizedCommand({ id: 'core.close.main.tab', category: VIEW_CATEGORY, label: 'Close Tab in Main Area' - }; - export const CLOSE_OTHER_MAIN_TABS: Command = { + }, 'theia/core/common/closeTabMain', VIEW_CATEGORY_KEY); + export const CLOSE_OTHER_MAIN_TABS = Command.toLocalizedCommand({ id: 'core.close.other.main.tabs', category: VIEW_CATEGORY, label: 'Close Other Tabs in Main Area' - }; - export const CLOSE_ALL_MAIN_TABS: Command = { + }, 'theia/core/common/closeOtherTabMain', VIEW_CATEGORY_KEY); + export const CLOSE_ALL_MAIN_TABS = Command.toLocalizedCommand({ id: 'core.close.all.main.tabs', category: VIEW_CATEGORY, label: 'Close All Tabs in Main Area' - }; - export const COLLAPSE_PANEL: Command = { + }, 'theia/core/common/closeAllTabMain', VIEW_CATEGORY_KEY); + export const COLLAPSE_PANEL = Command.toLocalizedCommand({ id: 'core.collapse.tab', category: VIEW_CATEGORY, label: 'Collapse Side Panel' - }; - export const COLLAPSE_ALL_PANELS: Command = { + }, 'theia/core/common/collapseTab', VIEW_CATEGORY_KEY); + export const COLLAPSE_ALL_PANELS = Command.toLocalizedCommand({ id: 'core.collapse.all.tabs', category: VIEW_CATEGORY, label: 'Collapse All Side Panels' - }; - export const TOGGLE_BOTTOM_PANEL: Command = { + }, 'theia/core/common/collapseAllTabs', VIEW_CATEGORY_KEY); + export const TOGGLE_BOTTOM_PANEL = Command.toLocalizedCommand({ id: 'core.toggle.bottom.panel', category: VIEW_CATEGORY, label: 'Toggle Bottom Panel' - }; - export const TOGGLE_STATUS_BAR: Command = { + }, 'theia/core/common/collapseBottomPanel', VIEW_CATEGORY_KEY); + export const TOGGLE_STATUS_BAR = Command.toLocalizedCommand({ id: 'workbench.action.toggleStatusbarVisibility', category: VIEW_CATEGORY, label: 'Toggle Status Bar Visibility' - }; - export const TOGGLE_MAXIMIZED: Command = { + }, 'vscode/layoutActions/toggleStatusbar'); + export const TOGGLE_MAXIMIZED = Command.toLocalizedCommand({ id: 'core.toggleMaximized', category: VIEW_CATEGORY, label: 'Toggle Maximized' - }; - export const OPEN_VIEW: Command = { + }, 'theia/core/common/toggleMaximized', VIEW_CATEGORY_KEY); + export const OPEN_VIEW = Command.toLocalizedCommand({ id: 'core.openView', category: VIEW_CATEGORY, label: 'Open View...' - }; + }, 'vscode/quickAccess.contribution/miOpenView', VIEW_CATEGORY_KEY); - export const SAVE: Command = { + export const SAVE = Command.toLocalizedCommand({ id: 'core.save', category: FILE_CATEGORY, label: 'Save', - }; - export const SAVE_WITHOUT_FORMATTING: Command = { + }, 'vscode/fileCommands/save', FILE_CATEGORY_KEY); + export const SAVE_WITHOUT_FORMATTING = Command.toLocalizedCommand({ id: 'core.saveWithoutFormatting', category: FILE_CATEGORY, label: 'Save without Formatting', - }; - export const SAVE_ALL: Command = { + }, 'vscode/fileCommands/saveWithoutFormatting', FILE_CATEGORY_KEY); + export const SAVE_ALL = Command.toLocalizedCommand({ id: 'core.saveAll', category: FILE_CATEGORY, label: 'Save All', - }; + }, 'vscode/fileCommands/saveAll', FILE_CATEGORY_KEY); - export const AUTO_SAVE: Command = { + export const AUTO_SAVE = Command.toLocalizedCommand({ id: 'textEditor.commands.autosave', category: FILE_CATEGORY, label: 'Auto Save', - }; + }, 'vscode/fileActions.contribution/miAutoSave', FILE_CATEGORY_KEY); - export const ABOUT_COMMAND: Command = { + export const ABOUT_COMMAND = Command.toLocalizedCommand({ id: 'core.about', label: 'About' - }; + }, 'vscode/windowActions/about'); - export const OPEN_PREFERENCES: Command = { + export const OPEN_PREFERENCES = Command.toLocalizedCommand({ id: 'preferences:open', - category: 'Settings', + category: PREFERENCES_CATEGORY, label: 'Open Preferences', - }; + }, 'vscode/preferences.contribution/preferences', PREFERENCES_CATEGORY_KEY); - export const SELECT_COLOR_THEME: Command = { + export const SELECT_COLOR_THEME = Command.toLocalizedCommand({ id: 'workbench.action.selectTheme', label: 'Color Theme', - category: 'Preferences' - }; - export const SELECT_ICON_THEME: Command = { + category: PREFERENCES_CATEGORY + }, 'vscode/themes.contribution/selectTheme.label', PREFERENCES_CATEGORY_KEY); + export const SELECT_ICON_THEME = Command.toLocalizedCommand({ id: 'workbench.action.selectIconTheme', label: 'File Icon Theme', - category: 'Preferences' - }; + category: PREFERENCES_CATEGORY + }, 'vscode/themes.contribution/selectIconTheme.label', PREFERENCES_CATEGORY_KEY); export const CONFIGURE_DISPLAY_LANGUAGE = Command.toLocalizedCommand({ id: 'workbench.action.configureLanguage', @@ -370,14 +374,14 @@ export class CommonFrontendContribution implements FrontendApplicationContributi app.shell.leftPanelHandler.addBottomMenu({ id: 'settings-menu', iconClass: 'codicon codicon-settings-gear', - title: 'Settings', + title: nls.localize(CommonCommands.PREFERENCES_CATEGORY_KEY, CommonCommands.PREFERENCES_CATEGORY), menuPath: SETTINGS_MENU, order: 0, }); const accountsMenu = { id: 'accounts-menu', iconClass: 'codicon codicon-person', - title: 'Accounts', + title: nls.localize('vscode/activitybarPart/accounts', 'Accounts'), menuPath: ACCOUNTS_MENU, order: 1, }; @@ -442,7 +446,7 @@ export class CommonFrontendContribution implements FrontendApplicationContributi this.shell.leftPanelHandler.addTopMenu({ id: mainMenuId, iconClass: 'codicon codicon-menu', - title: 'Application Menu', + title: nls.localize('vscode/menubar/mAppMenu', 'Application Menu'), menuPath: ['menubar'], order: 0, }); @@ -475,10 +479,10 @@ export class CommonFrontendContribution implements FrontendApplicationContributi } registerMenus(registry: MenuModelRegistry): void { - registry.registerSubmenu(CommonMenus.FILE, 'File'); - registry.registerSubmenu(CommonMenus.EDIT, 'Edit'); - registry.registerSubmenu(CommonMenus.VIEW, 'View'); - registry.registerSubmenu(CommonMenus.HELP, 'Help'); + registry.registerSubmenu(CommonMenus.FILE, nls.localize('vscode/menubarControl/mFile', 'File')); + registry.registerSubmenu(CommonMenus.EDIT, nls.localize('vscode/menubarControl/mEdit', 'Edit')); + registry.registerSubmenu(CommonMenus.VIEW, nls.localize('vscode/menubarControl/mView', 'View')); + registry.registerSubmenu(CommonMenus.HELP, nls.localize('vscode/menubarControl/mHelp', 'Help')); registry.registerMenuAction(CommonMenus.FILE_SAVE, { commandId: CommonCommands.SAVE.id @@ -491,7 +495,7 @@ export class CommonFrontendContribution implements FrontendApplicationContributi commandId: CommonCommands.AUTO_SAVE.id }); - registry.registerSubmenu(CommonMenus.FILE_SETTINGS_SUBMENU, 'Settings'); + registry.registerSubmenu(CommonMenus.FILE_SETTINGS_SUBMENU, nls.localize(CommonCommands.PREFERENCES_CATEGORY_KEY, CommonCommands.PREFERENCES_CATEGORY)); registry.registerMenuAction(CommonMenus.EDIT_UNDO, { commandId: CommonCommands.UNDO.id, @@ -544,37 +548,37 @@ export class CommonFrontendContribution implements FrontendApplicationContributi registry.registerMenuAction(SHELL_TABBAR_CONTEXT_MENU, { commandId: CommonCommands.CLOSE_TAB.id, - label: 'Close', + label: nls.localize('vscode/editor.contribution/close', 'Close'), order: '0' }); registry.registerMenuAction(SHELL_TABBAR_CONTEXT_MENU, { commandId: CommonCommands.CLOSE_OTHER_TABS.id, - label: 'Close Others', + label: nls.localize('vscode/editor.contribution/closeOthers', 'Close Others'), order: '1' }); registry.registerMenuAction(SHELL_TABBAR_CONTEXT_MENU, { commandId: CommonCommands.CLOSE_RIGHT_TABS.id, - label: 'Close to the Right', + label: nls.localize('vscode/editor.contribution/closeRight', 'Close to the Right'), order: '2' }); registry.registerMenuAction(SHELL_TABBAR_CONTEXT_MENU, { commandId: CommonCommands.CLOSE_ALL_TABS.id, - label: 'Close All', + label: nls.localize('vscode/editor.contribution/closeAll', 'Close All'), order: '3' }); registry.registerMenuAction(SHELL_TABBAR_CONTEXT_MENU, { commandId: CommonCommands.COLLAPSE_PANEL.id, - label: 'Collapse', + label: CommonCommands.COLLAPSE_PANEL.label, order: '4' }); registry.registerMenuAction(SHELL_TABBAR_CONTEXT_MENU, { commandId: CommonCommands.TOGGLE_MAXIMIZED.id, - label: 'Toggle Maximized', + label: CommonCommands.TOGGLE_MAXIMIZED.label, order: '5' }); registry.registerMenuAction(CommonMenus.HELP, { commandId: CommonCommands.ABOUT_COMMAND.id, - label: 'About', + label: CommonCommands.ABOUT_COMMAND.label, order: '9' }); @@ -1072,7 +1076,7 @@ export class CommonFrontendContribution implements FrontendApplicationContributi this.quickInputService?.showQuickPick(items, { - placeholder: 'Select File Icon Theme', + placeholder: nls.localize('vscode/extensionsActions/select file icon theme', 'Select File Icon Theme'), activeItem: items.find(item => item.id === resetTo), onDidChangeSelection: (quickPick: QuickPick, selectedItems: Array) => { resetTo = undefined; @@ -1111,7 +1115,7 @@ export class CommonFrontendContribution implements FrontendApplicationContributi const items = [...itemsByTheme.light, ...itemsByTheme.dark, ...itemsByTheme.hc]; this.quickInputService?.showQuickPick(items, { - placeholder: 'Select Color Theme (Up/Down Keys to Preview)', + placeholder: nls.localize('vscode/extensionActions/select color theme', 'Select Color Theme (Up/Down Keys to Preview)'), activeItem: items.find((item: QuickPickItem) => item.id === resetTo), // eslint-disable-next-line @typescript-eslint/no-explicit-any onDidChangeSelection: (quickPick: any, selectedItems: Array) => { diff --git a/packages/core/src/browser/core-preferences.ts b/packages/core/src/browser/core-preferences.ts index 2e868c95158c6..a5f132ac2eb7c 100644 --- a/packages/core/src/browser/core-preferences.ts +++ b/packages/core/src/browser/core-preferences.ts @@ -19,6 +19,7 @@ import { createPreferenceProxy, PreferenceProxy, PreferenceService, PreferenceCo import { SUPPORTED_ENCODINGS } from './supported-encodings'; import { FrontendApplicationConfigProvider } from './frontend-application-config-provider'; import { isOSX } from '../common/os'; +import { nls } from '../common/nls'; export const corePreferenceSchema: PreferenceSchema = { 'type': 'object', @@ -31,19 +32,20 @@ export const corePreferenceSchema: PreferenceSchema = { 'always', ], default: 'ifRequired', - description: 'When to confirm before closing the application window.', + description: nls.localize('vscode/workbench.contribution/confirmBeforeCloseWeb', 'When to confirm before closing the application window.'), }, 'breadcrumbs.enabled': { 'type': 'boolean', 'default': true, - 'description': 'Enable/disable navigation breadcrumbs.', + 'description': nls.localize('vscode/breadcrumbs/enabled', 'Enable/disable navigation breadcrumbs.'), 'scope': 'application' }, 'files.encoding': { 'type': 'string', 'enum': Object.keys(SUPPORTED_ENCODINGS), 'default': 'utf8', - 'description': 'The default character set encoding to use when reading and writing files. This setting can also be configured per language.', + 'description': nls.localize('vscode/files.contribution/encoding', + 'The default character set encoding to use when reading and writing files. This setting can also be configured per language.'), 'scope': 'language-overridable', 'enumDescriptions': Object.keys(SUPPORTED_ENCODINGS).map(key => SUPPORTED_ENCODINGS[key].labelLong), 'included': Object.keys(SUPPORTED_ENCODINGS).length > 1 @@ -55,21 +57,22 @@ export const corePreferenceSchema: PreferenceSchema = { 'keyCode', ], default: 'code', - description: 'Whether to interpret keypresses by the `code` of the physical key, or by the `keyCode` provided by the OS.' + description: nls.localize('vscode/keybindingService/dispatch', + 'Whether to interpret keypresses by the `code` of the physical key, or by the `keyCode` provided by the OS.') }, 'window.menuBarVisibility': { type: 'string', enum: ['classic', 'visible', 'hidden', 'compact'], markdownEnumDescriptions: [ - 'Menu is displayed at the top of the window and only hidden in full screen mode.', - 'Menu is always visible at the top of the window even in full screen mode.', - 'Menu is always hidden.', - 'Menu is displayed as a compact button in the sidebar.' + nls.localize('vscode/workbench.contribution/window.menuBarVisibility.default', 'Menu is displayed at the top of the window and only hidden in full screen mode.'), + nls.localize('vscode/workbench.contribution/window.menuBarVisibility.visible', 'Menu is always visible at the top of the window even in full screen mode.'), + nls.localize('vscode/workbench.contribution/window.menuBarVisibility.hidden', 'Menu is always hidden.'), + nls.localize('vscode/workbench.contribution/window.menuBarVisibility.compact', 'Menu is displayed as a compact button in the sidebar.') ], default: 'classic', scope: 'application', - markdownDescription: `Control the visibility of the menu bar. - A setting of 'compact' will move the menu into the sidebar.`, + markdownDescription: nls.localize('vscode/workbench.contribution/menuBarVisibility', `Control the visibility of the menu bar. + A setting of 'compact' will move the menu into the sidebar.`), included: !isOSX }, 'workbench.list.openMode': { @@ -79,39 +82,40 @@ export const corePreferenceSchema: PreferenceSchema = { 'doubleClick' ], default: 'singleClick', - description: 'Controls how to open items in trees using the mouse.' + description: nls.localize('vscode/listService/openModeModifier', 'Controls how to open items in trees using the mouse.') }, 'workbench.editor.highlightModifiedTabs': { 'type': 'boolean', - 'description': 'Controls whether a top border is drawn on modified (dirty) editor tabs or not.', + 'description': nls.localize('vscode/workbench.contribution/highlightModifiedTabs', 'Controls whether a top border is drawn on modified (dirty) editor tabs or not.'), 'default': false }, 'workbench.editor.closeOnFileDelete': { 'type': 'boolean', // eslint-disable-next-line max-len - 'description': 'Controls whether editors showing a file that was opened during the session should close automatically when getting deleted or renamed by some other process. Disabling this will keep the editor open on such an event. Note that deleting from within the application will always close the editor and that dirty files will never close to preserve your data.', + 'description': nls.localize('vscode/workbench.contribution/closeOnFileDelete', 'Controls whether editors showing a file that was opened during the session should close automatically when getting deleted or renamed by some other process. Disabling this will keep the editor open on such an event. Note that deleting from within the application will always close the editor and that dirty files will never close to preserve your data.'), 'default': false }, 'workbench.commandPalette.history': { type: 'number', default: 50, minimum: 0, - description: 'Controls the number of recently used commands to keep in history for the command palette. Set to 0 to disable command history.' + // eslint-disable-next-line max-len + description: nls.localize('vscode/workbench.contribution/commandHistory', 'Controls the number of recently used commands to keep in history for the command palette. Set to 0 to disable command history.') }, 'workbench.colorTheme': { type: 'string', default: FrontendApplicationConfigProvider.get().defaultTheme, - description: 'Specifies the color theme used in the workbench.' + description: nls.localize('vscode/themeConfiguration/colorTheme', 'Specifies the color theme used in the workbench.') }, 'workbench.iconTheme': { type: ['string', 'null'], default: FrontendApplicationConfigProvider.get().defaultIconTheme, - description: "Specifies the icon theme used in the workbench or 'null' to not show any file icons." + description: nls.localize('vscode/themeConfiguration/iconTheme', "Specifies the icon theme used in the workbench or 'null' to not show any file icons.") }, 'workbench.silentNotifications': { type: 'boolean', default: false, - description: 'Controls whether to suppress notification popups.' + description: nls.localize('vscode/workbench.contribution/zenMode.silentNotifications', 'Controls whether to suppress notification popups.') }, 'workbench.statusBar.visible': { type: 'boolean', @@ -122,7 +126,7 @@ export const corePreferenceSchema: PreferenceSchema = { type: 'string', enum: ['onHover', 'none', 'always'], default: 'onHover', - description: 'Controls whether the tree should render indent guides.' + description: nls.localize('vscode/listService/render tree indent guides', 'Controls whether the tree should render indent guides.') }, 'workbench.hover.delay': { type: 'number', diff --git a/packages/core/src/browser/dialogs.ts b/packages/core/src/browser/dialogs.ts index 548f893bd9842..8d44aabc261be 100644 --- a/packages/core/src/browser/dialogs.ts +++ b/packages/core/src/browser/dialogs.ts @@ -15,7 +15,7 @@ ********************************************************************************/ import { injectable, inject } from 'inversify'; -import { Disposable, MaybePromise, CancellationTokenSource } from '../common'; +import { Disposable, MaybePromise, CancellationTokenSource, nls } from '../common'; import { Key } from './keyboard/keys'; import { Widget, BaseWidget, Message, addKeyListener, codiconArray } from './widgets'; import { FrontendApplicationContribution } from './frontend-application'; @@ -66,6 +66,13 @@ export namespace DialogError { } } +export namespace Dialog { + export const YES = nls.localize('vscode/extensionsUtils/yes', 'Yes'); + export const NO = nls.localize('vscode/extensionsUtils/no', 'No'); + export const OK = nls.localize('vscode/dialog/ok', 'OK'); + export const CANCEL = nls.localize('vscode/explorerViewer/cancel', 'Cancel'); +} + @injectable() export class DialogOverlayService implements FrontendApplicationContribution { @@ -191,14 +198,14 @@ export abstract class AbstractDialog extends BaseWidget { this.update(); } - protected appendCloseButton(text: string = 'Cancel'): HTMLButtonElement { + protected appendCloseButton(text: string = Dialog.CANCEL): HTMLButtonElement { this.closeButton = this.createButton(text); this.controlPanel.appendChild(this.closeButton); this.closeButton.classList.add('secondary'); return this.closeButton; } - protected appendAcceptButton(text: string = 'OK'): HTMLButtonElement { + protected appendAcceptButton(text: string = Dialog.OK): HTMLButtonElement { this.acceptButton = this.createButton(text); this.controlPanel.appendChild(this.acceptButton); this.acceptButton.classList.add('main'); diff --git a/packages/core/src/browser/keyboard/browser-keyboard-frontend-contribution.ts b/packages/core/src/browser/keyboard/browser-keyboard-frontend-contribution.ts index 1dbfb394e7e02..a71fd3b37179d 100644 --- a/packages/core/src/browser/keyboard/browser-keyboard-frontend-contribution.ts +++ b/packages/core/src/browser/keyboard/browser-keyboard-frontend-contribution.ts @@ -19,16 +19,18 @@ import { isOSX } from '../../common/os'; import { CommandContribution, CommandRegistry, Command } from '../../common/command'; import { BrowserKeyboardLayoutProvider, KeyboardLayoutData } from './browser-keyboard-layout-provider'; import { QuickPickValue, QuickInputService, QuickPickItem } from '../quick-input'; +import { nls } from '../../common/nls'; export namespace KeyboardCommands { + const KEYBOARD_CATEGORY_KEY = 'vscode/settingsLayout/keyboard'; const KEYBOARD_CATEGORY = 'Keyboard'; - export const CHOOSE_KEYBOARD_LAYOUT: Command = { + export const CHOOSE_KEYBOARD_LAYOUT = Command.toLocalizedCommand({ id: 'core.keyboard.choose', category: KEYBOARD_CATEGORY, label: 'Choose Keyboard Layout', - }; + }, 'theia/core/keyboard/choose', KEYBOARD_CATEGORY_KEY); } @@ -50,9 +52,9 @@ export class BrowserKeyboardFrontendContribution implements CommandContribution protected async chooseLayout(): Promise { const current = this.layoutProvider.currentLayoutData; const autodetect: QuickPickValue<'autodetect'> = { - label: 'Auto-detect', - description: this.layoutProvider.currentLayoutSource !== 'user-choice' ? `(current: ${current.name})` : undefined, - detail: 'Try to detect the keyboard layout from browser information and pressed keys.', + label: nls.localize('vscode/editorStatus/autoDetect', 'Auto-detect'), + description: this.layoutProvider.currentLayoutSource !== 'user-choice' ? nls.localize('theia/core/keyboard/current', '(current: {0})', current.name) : undefined, + detail: nls.localize('theia/core/keyboard/tryDetect', 'Try to detect the keyboard layout from browser information and pressed keys.'), value: 'autodetect' }; const pcLayouts = this.layoutProvider.allLayoutData @@ -64,20 +66,22 @@ export class BrowserKeyboardFrontendContribution implements CommandContribution .sort((a, b) => compare(a.name, b.name)) .map(layout => this.toQuickPickValue(layout, current === layout)); let layouts: Array | QuickPickItem>; + const macKeyboards = nls.localize('theia/core/keyboard/mac', 'Mac Keyboards'); + const pcKeyboards = nls.localize('theia/core/keyboard/pc', 'PC Keyboards'); if (isOSX) { layouts = [ autodetect, - { type: 'separator', label: 'Mac Keyboards' }, ...macLayouts, - { type: 'separator', label: 'PC Keyboards' }, ...pcLayouts + { type: 'separator', label: macKeyboards }, ...macLayouts, + { type: 'separator', label: pcKeyboards }, ...pcLayouts ]; } else { layouts = [ autodetect, - { type: 'separator', label: 'PC Keyboards' }, ...pcLayouts, - { type: 'separator', label: 'Mac Keyboards' }, ...macLayouts + { type: 'separator', label: pcKeyboards }, ...pcLayouts, + { type: 'separator', label: macKeyboards }, ...macLayouts ]; } - const selectedItem = await this.quickInputService?.showQuickPick(layouts, { placeholder: 'Choose a keyboard layout' }); + const selectedItem = await this.quickInputService?.showQuickPick(layouts, { placeholder: nls.localize('theia/core/keyboard/chooseLayout', 'Choose a keyboard layout') }); if (selectedItem && ('value' in selectedItem)) { return this.layoutProvider.setLayoutData(selectedItem.value); } @@ -86,7 +90,8 @@ export class BrowserKeyboardFrontendContribution implements CommandContribution protected toQuickPickValue(layout: KeyboardLayoutData, isCurrent: boolean): QuickPickValue { return { label: layout.name, - description: `${layout.hardware === 'mac' ? 'Mac' : 'PC'} (${layout.language})${isCurrent ? ' - current layout' : ''}`, + description: + `${layout.hardware === 'mac' ? 'Mac' : 'PC'} (${layout.language})${isCurrent ? nls.localize('theia/core/keyboard/currentLayout', ' - current layout') : ''}`, value: layout }; } diff --git a/packages/core/src/browser/quick-input/quick-command-frontend-contribution.ts b/packages/core/src/browser/quick-input/quick-command-frontend-contribution.ts index 204252da3dde0..1d06c837fb04f 100644 --- a/packages/core/src/browser/quick-input/quick-command-frontend-contribution.ts +++ b/packages/core/src/browser/quick-input/quick-command-frontend-contribution.ts @@ -14,7 +14,7 @@ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 ********************************************************************************/ import { injectable, inject, optional } from 'inversify'; -import { CommandRegistry, CommandContribution, MenuContribution, MenuModelRegistry } from '../../common'; +import { CommandRegistry, CommandContribution, MenuContribution, MenuModelRegistry, nls } from '../../common'; import { KeybindingRegistry, KeybindingContribution } from '../keybinding'; import { CommonMenus } from '../common-frontend-contribution'; import { CLEAR_COMMAND_HISTORY, quickCommand, QuickCommandService } from './quick-command-service'; @@ -43,7 +43,7 @@ export class QuickCommandFrontendContribution implements CommandContribution, Ke registerMenus(menus: MenuModelRegistry): void { menus.registerMenuAction(CommonMenus.VIEW_PRIMARY, { commandId: quickCommand.id, - label: 'Find Command...' + label: nls.localize('vscode/quickAccess.contribution/commandsQuickAccess', 'Find Command...') }); } diff --git a/packages/core/src/browser/quick-input/quick-command-service.ts b/packages/core/src/browser/quick-input/quick-command-service.ts index de08e4e7d3ca7..dbd473caf7bd2 100644 --- a/packages/core/src/browser/quick-input/quick-command-service.ts +++ b/packages/core/src/browser/quick-input/quick-command-service.ts @@ -28,10 +28,10 @@ export const quickCommand: Command = { id: 'workbench.action.showCommands' }; -export const CLEAR_COMMAND_HISTORY: Command = { +export const CLEAR_COMMAND_HISTORY = Command.toLocalizedCommand({ id: 'clear.command.history', label: 'Clear Command History' -}; +}, 'vscode/commandsQuickAccess/clearCommandHistory'); @injectable() export class QuickCommandService implements QuickAccessContribution, QuickAccessProvider { diff --git a/packages/core/src/browser/shell/shell-layout-restorer.ts b/packages/core/src/browser/shell/shell-layout-restorer.ts index c7416f17ca12b..d8af37ad78df8 100644 --- a/packages/core/src/browser/shell/shell-layout-restorer.ts +++ b/packages/core/src/browser/shell/shell-layout-restorer.ts @@ -25,6 +25,7 @@ import { ThemeService } from '../theming'; import { ContributionProvider } from '../../common/contribution-provider'; import { MaybePromise } from '../../common/types'; import { ApplicationShell, applicationShellLayoutVersion, ApplicationShellLayoutVersion } from './application-shell'; +import { CommonCommands } from '../common-frontend-contribution'; /** * A contract for widgets that want to store and restore their inner state, between sessions. @@ -109,11 +110,11 @@ export interface ApplicationShellLayoutMigration { onWillInflateWidget?(desc: WidgetDescription, context: ApplicationShellLayoutMigrationContext): MaybePromise; } -export const RESET_LAYOUT: Command = { +export const RESET_LAYOUT = Command.toLocalizedCommand({ id: 'reset.layout', - category: 'View', + category: CommonCommands.VIEW_CATEGORY, label: 'Reset Workbench Layout' -}; +}, 'theia/core/resetWorkbenchLayout', CommonCommands.VIEW_CATEGORY_KEY); @injectable() export class ShellLayoutRestorer implements CommandContribution { diff --git a/packages/core/src/browser/shell/tab-bar-toolbar.tsx b/packages/core/src/browser/shell/tab-bar-toolbar.tsx index 8ec3f8bced7e7..433f1c2c8e699 100644 --- a/packages/core/src/browser/shell/tab-bar-toolbar.tsx +++ b/packages/core/src/browser/shell/tab-bar-toolbar.tsx @@ -27,6 +27,7 @@ import { ContextKeyService } from '../context-key-service'; import { Event, Emitter } from '../../common/event'; import { ContextMenuRenderer, Anchor } from '../context-menu-renderer'; import { MenuModelRegistry } from '../../common/menu'; +import { nls } from '../../common/nls'; /** * Clients should implement this interface if they want to contribute to the tab-bar toolbar. @@ -403,7 +404,8 @@ export class TabBarToolbar extends ReactWidget { protected renderMore(): React.ReactNode { return !!this.more.size &&
-
+
; } diff --git a/packages/core/src/browser/window-contribution.ts b/packages/core/src/browser/window-contribution.ts index 29f377be9c478..77d5004cf7091 100644 --- a/packages/core/src/browser/window-contribution.ts +++ b/packages/core/src/browser/window-contribution.ts @@ -23,10 +23,10 @@ import { CommonMenus } from '../browser/common-frontend-contribution'; export namespace WindowCommands { - export const NEW_WINDOW: Command = { + export const NEW_WINDOW = Command.toLocalizedCommand({ id: 'workbench.action.newWindow', label: 'New Window' - }; + }, 'vscode/windowActions/newWindow'); } @injectable() diff --git a/packages/core/src/common/nls.ts b/packages/core/src/common/nls.ts index 5bf410c670906..4b6f9a2c65d9d 100644 --- a/packages/core/src/common/nls.ts +++ b/packages/core/src/common/nls.ts @@ -24,7 +24,9 @@ export namespace nls { export const locale = typeof window === 'object' && window && window.localStorage.getItem(localeId) || undefined; - function format(message: string, args: string[]): string { + type FormatType = string | number | undefined; + + function format(message: string, args: FormatType[]): string { let result = message; if (args.length > 0) { result = message.replace(/\{(\d+)\}/g, (match, rest) => { @@ -42,9 +44,9 @@ export namespace nls { return result; } - export function localize(key: string, defaultValue: string, ...args: string[]): string { + export function localize(key: string, defaultValue: string, ...args: FormatType[]): string { let value = defaultValue; - if (localization) { + if (localization && key) { const translation = localization.translations[key]; if (translation) { // vscode's localizations often contain additional '&&' symbols, which we simply ignore diff --git a/packages/core/src/electron-browser/menu/electron-menu-contribution.ts b/packages/core/src/electron-browser/menu/electron-menu-contribution.ts index 32cfc927a432a..a954e0825b163 100644 --- a/packages/core/src/electron-browser/menu/electron-menu-contribution.ts +++ b/packages/core/src/electron-browser/menu/electron-menu-contribution.ts @@ -18,14 +18,15 @@ import * as electron from '../../../shared/electron'; import { inject, injectable } from 'inversify'; import { Command, CommandContribution, CommandRegistry, - isOSX, isWindows, MenuModelRegistry, MenuContribution, Disposable + isOSX, isWindows, MenuModelRegistry, MenuContribution, Disposable, nls } from '../../common'; import { ApplicationShell, codicon, ConfirmDialog, KeybindingContribution, KeybindingRegistry, - PreferenceScope, Widget, FrontendApplication, FrontendApplicationContribution, CommonMenus + PreferenceScope, Widget, FrontendApplication, FrontendApplicationContribution, CommonMenus, CommonCommands, Dialog } from '../../browser'; import { ElectronMainMenuFactory } from './electron-main-menu-factory'; import { FrontendApplicationStateService, FrontendApplicationState } from '../../browser/frontend-application-state'; +import { FrontendApplicationConfigProvider } from '../../browser/frontend-application-config-provider'; import { RequestTitleBarStyle, Restart, TitleBarStyleAtStartup, TitleBarStyleChanged } from '../../electron-common/messaging/electron-messages'; import { ZoomLevel } from '../window/electron-window-preferences'; import { BrowserMenuBarContribution } from '../../browser/menu/browser-menu-plugin'; @@ -33,35 +34,35 @@ import { BrowserMenuBarContribution } from '../../browser/menu/browser-menu-plug import '../../../src/electron-browser/menu/electron-menu-style.css'; export namespace ElectronCommands { - export const TOGGLE_DEVELOPER_TOOLS: Command = { + export const TOGGLE_DEVELOPER_TOOLS = Command.toLocalizedCommand({ id: 'theia.toggleDevTools', label: 'Toggle Developer Tools' - }; - export const RELOAD: Command = { + }, 'vscode/developerActions/toggleDevTools'); + export const RELOAD = Command.toLocalizedCommand({ id: 'view.reload', label: 'Reload Window' - }; - export const ZOOM_IN: Command = { + }, 'vscode/windowActions/reloadWindow'); + export const ZOOM_IN = Command.toLocalizedCommand({ id: 'view.zoomIn', label: 'Zoom In' - }; - export const ZOOM_OUT: Command = { + }, 'vscode/windowActions/zoomIn'); + export const ZOOM_OUT = Command.toLocalizedCommand({ id: 'view.zoomOut', label: 'Zoom Out' - }; - export const RESET_ZOOM: Command = { + }, 'vscode/windowActions/zoomOut'); + export const RESET_ZOOM = Command.toLocalizedCommand({ id: 'view.resetZoom', label: 'Reset Zoom' - }; - export const CLOSE_WINDOW: Command = { + }, 'vscode/windowActions/zoomReset'); + export const CLOSE_WINDOW = Command.toLocalizedCommand({ id: 'close.window', label: 'Close Window' - }; - export const TOGGLE_FULL_SCREEN: Command = { + }, 'vscode/windowActions/close'); + export const TOGGLE_FULL_SCREEN = Command.toLocalizedCommand({ id: 'workbench.action.toggleFullScreen', - category: 'View', + category: CommonCommands.VIEW_CATEGORY, label: 'Toggle Full Screen' - }; + }, 'vscode/windowActions/toggleFullScreen', CommonCommands.VIEW_CATEGORY_KEY); } export namespace ElectronMenus { @@ -225,11 +226,19 @@ export class ElectronMenuContribution extends BrowserMenuBarContribution impleme } protected async handleRequiredRestart(): Promise { + const msgNode = document.createElement('div'); + const message = document.createElement('p'); + message.textContent = nls.localize('vscode/relauncher.contribution/relaunchSettingMessage', 'A setting has changed that requires a restart to take effect'); + const detail = document.createElement('p'); + detail.textContent = nls.localize('vscode/relauncher.contribution/relaunchSettingDetail', + 'Press the restart button to restart {0} and enable the setting.', FrontendApplicationConfigProvider.get().applicationName); + msgNode.append(message, detail); + const restart = nls.localize('vscode/relauncher.contribution/restart', 'Restart'); const dialog = new ConfirmDialog({ - title: 'A setting has changed that requires a restart to take effect', - msg: 'Press the restart button to restart the application and enable the setting.', - ok: 'Restart', - cancel: 'Cancel' + title: restart, + msg: msgNode, + ok: restart, + cancel: Dialog.CANCEL }); if (await dialog.open()) { electron.ipcRenderer.send(Restart); diff --git a/packages/core/src/electron-browser/window/electron-window-preferences.ts b/packages/core/src/electron-browser/window/electron-window-preferences.ts index 9c97bc732b5a5..2b4ad3816a6ee 100644 --- a/packages/core/src/electron-browser/window/electron-window-preferences.ts +++ b/packages/core/src/electron-browser/window/electron-window-preferences.ts @@ -15,6 +15,7 @@ ********************************************************************************/ import { interfaces } from 'inversify'; +import { nls } from '../../common/nls'; import { createPreferenceProxy, PreferenceContribution, PreferenceProxy, PreferenceSchema, PreferenceService } from '../../browser/preferences'; import { isOSX, isWindows } from '../../common'; @@ -37,19 +38,15 @@ export const electronWindowPreferencesSchema: PreferenceSchema = { 'maximum': ZoomLevel.MAX, 'scope': 'application', // eslint-disable-next-line max-len - 'description': 'Adjust the zoom level of the window. The original size is 0 and each increment above (e.g. 1.0) or below (e.g. -1.0) represents zooming 20% larger or smaller. You can also enter decimals to adjust the zoom level with a finer granularity.' + 'description': nls.localize('vscode/desktop.contribution/zoomLevel', 'Adjust the zoom level of the window. The original size is 0 and each increment above (e.g. 1.0) or below (e.g. -1.0) represents zooming 20% larger or smaller. You can also enter decimals to adjust the zoom level with a finer granularity.') }, 'window.titleBarStyle': { type: 'string', enum: ['native', 'custom'], - markdownEnumDescriptions: [ - 'Native title bar is displayed.', - 'Custom title bar is displayed.' - ], default: isWindows ? 'custom' : 'native', scope: 'application', // eslint-disable-next-line max-len - markdownDescription: 'Adjust the appearance of the window title bar. On Linux and Windows, this setting also affects the application and context menu appearances. Changes require a full restart to apply.', + description: nls.localize('vscode/desktop.contribution/titleBarStyle', 'Adjust the appearance of the window title bar. On Linux and Windows, this setting also affects the application and context menu appearances. Changes require a full restart to apply.'), included: !isOSX }, } diff --git a/packages/debug/src/browser/console/debug-console-contribution.tsx b/packages/debug/src/browser/console/debug-console-contribution.tsx index 94cd66815a993..1b3092bef204b 100644 --- a/packages/debug/src/browser/console/debug-console-contribution.tsx +++ b/packages/debug/src/browser/console/debug-console-contribution.tsx @@ -18,6 +18,7 @@ import { ConsoleSessionManager } from '@theia/console/lib/browser/console-sessio import { ConsoleOptions, ConsoleWidget } from '@theia/console/lib/browser/console-widget'; import { AbstractViewContribution, bindViewContribution, codicon, Widget, WidgetFactory } from '@theia/core/lib/browser'; import { ContextKey, ContextKeyService } from '@theia/core/lib/browser/context-key-service'; +import { nls } from '@theia/core/lib/common/nls'; import { TabBarToolbarContribution, TabBarToolbarRegistry } from '@theia/core/lib/browser/shell/tab-bar-toolbar'; import { Command, CommandRegistry } from '@theia/core/lib/common/command'; import { Severity } from '@theia/core/lib/common/severity'; @@ -32,13 +33,16 @@ export type InDebugReplContextKey = ContextKey; export const InDebugReplContextKey = Symbol('inDebugReplContextKey'); export namespace DebugConsoleCommands { - const DEBUG_CONSOLE_CATEGORY = 'Debug'; - export const CLEAR: Command = { + + export const DEBUG_CATEGORY_KEY = 'vscode/debugCommands/debug'; + export const DEBUG_CATEGORY = 'Debug'; + + export const CLEAR = Command.toLocalizedCommand({ id: 'debug.console.clear', - category: DEBUG_CONSOLE_CATEGORY, + category: DEBUG_CATEGORY, label: 'Clear Console', iconClass: codicon('clear-all') - }; + }, 'vscode/repl/clearRepl', DEBUG_CATEGORY_KEY); } @injectable() @@ -124,7 +128,7 @@ export class DebugConsoleContribution extends AbstractViewContribution { - const tooltip = this.breakpointManager.breakpointsEnabled ? 'Deactivate Breakpoints' : 'Activate Breakpoints'; + const activateBreakpoints = nls.localize('vscode/breakpointsView/enableAllBreakpoints', 'Enable Breakpoints'); + const deactivateBreakpoints = nls.localize('vscode/breakpointsView/disableAllBreakpoints', 'Disable Breakpoints'); + const tooltip = this.breakpointManager.breakpointsEnabled ? deactivateBreakpoints : activateBreakpoints; if (toggleBreakpointsEnabled.tooltip !== tooltip) { toggleBreakpointsEnabled.tooltip = tooltip; onDidChangeToggleBreakpointsEnabled.fire(undefined); @@ -1088,7 +1118,7 @@ export class DebugFrontendApplicationContribution extends AbstractViewContributi id: DebugCommands.ADD_FUNCTION_BREAKPOINT.id, command: DebugCommands.ADD_FUNCTION_BREAKPOINT.id, icon: codicon('add'), - tooltip: 'Add Function Breakpoint' + tooltip: DebugCommands.ADD_FUNCTION_BREAKPOINT.label }); updateToggleBreakpointsEnabled(); this.breakpointManager.onDidChangeBreakpoints(updateToggleBreakpointsEnabled); @@ -1104,20 +1134,20 @@ export class DebugFrontendApplicationContribution extends AbstractViewContributi id: DebugCommands.ADD_WATCH_EXPRESSION.id, command: DebugCommands.ADD_WATCH_EXPRESSION.id, icon: codicon('add'), - tooltip: 'Add Expression' + tooltip: DebugCommands.ADD_WATCH_EXPRESSION.label }); toolbar.registerItem({ id: DebugCommands.COLLAPSE_ALL_WATCH_EXPRESSIONS.id, command: DebugCommands.COLLAPSE_ALL_WATCH_EXPRESSIONS.id, icon: codicon('collapse-all'), - tooltip: 'Collapse All', + tooltip: DebugCommands.COLLAPSE_ALL_WATCH_EXPRESSIONS.label, priority: 1 }); toolbar.registerItem({ id: DebugCommands.REMOVE_ALL_WATCH_EXPRESSIONS.id, command: DebugCommands.REMOVE_ALL_WATCH_EXPRESSIONS.id, icon: codicon('close-all'), - tooltip: 'Remove All Expressions', + tooltip: DebugCommands.REMOVE_ALL_WATCH_EXPRESSIONS.label, priority: 2 }); } diff --git a/packages/debug/src/browser/debug-preferences.ts b/packages/debug/src/browser/debug-preferences.ts index 0248a3bdf4cde..84da0e36ab104 100644 --- a/packages/debug/src/browser/debug-preferences.ts +++ b/packages/debug/src/browser/debug-preferences.ts @@ -14,6 +14,7 @@ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 ********************************************************************************/ +import { nls } from '@theia/core/lib/common/nls'; import { PreferenceSchema, PreferenceProxy, PreferenceService, createPreferenceProxy, PreferenceContribution } from '@theia/core/lib/browser/preferences'; import { interfaces } from '@theia/core/shared/inversify'; @@ -23,31 +24,36 @@ export const debugPreferencesSchema: PreferenceSchema = { 'debug.trace': { type: 'boolean', default: false, - description: 'Enable/disable tracing communications with debug adapters' + description: nls.localize('theia/debug/toggleTracing', 'Enable/disable tracing communications with debug adapters') }, 'debug.debugViewLocation': { enum: ['default', 'left', 'right', 'bottom'], default: 'default', - description: 'Controls the location of the debug view.' + description: nls.localize('theia/debug/debugViewLocation', 'Controls the location of the debug view.') }, 'debug.openDebug': { enum: ['neverOpen', 'openOnSessionStart', 'openOnFirstSessionStart', 'openOnDebugBreak'], default: 'openOnSessionStart', - description: 'Controls when the debug view should open.' + description: nls.localize('vscode/debug.contribution/openDebug', 'Controls when the debug view should open.') }, 'debug.internalConsoleOptions': { enum: ['neverOpen', 'openOnSessionStart', 'openOnFirstSessionStart'], default: 'openOnFirstSessionStart', - description: 'Controls when the internal debug console should open.' + description: nls.localize('vscode/debug/internalConsoleOptions', 'Controls when the internal debug console should open.') }, 'debug.inlineValues': { type: 'boolean', default: false, - description: 'Show variable values inline in editor while debugging.' + description: nls.localize('vscode/debug.contribution/inlineValues', 'Show variable values inline in editor while debugging.') }, 'debug.showInStatusBar': { enum: ['never', 'always', 'onFirstSessionStart'], - description: 'Controls when the debug status bar should be visible.', + enumDescriptions: [ + nls.localize('vscode/debug.contribution/never', 'Never show debug in status bar'), + nls.localize('vscode/debug.contribution/always', 'Always show debug in status bar'), + nls.localize('vscode/debug.contribution/onFirstSessionStart', 'Show debug in status bar only after debug was started for the first time') + ], + description: nls.localize('vscode/debug.contribution/showInStatusBar', 'Controls when the debug status bar should be visible.'), default: 'onFirstSessionStart' }, 'debug.confirmOnExit': { diff --git a/packages/debug/src/browser/debug-prefix-configuration.ts b/packages/debug/src/browser/debug-prefix-configuration.ts index 314cbff4f2176..8142a2313593e 100644 --- a/packages/debug/src/browser/debug-prefix-configuration.ts +++ b/packages/debug/src/browser/debug-prefix-configuration.ts @@ -61,11 +61,11 @@ export class DebugPrefixConfiguration implements CommandContribution, CommandHan readonly statusBarId = 'select-run-debug-statusbar-item'; - private readonly command: Command = { + private readonly command = Command.toLocalizedCommand({ id: 'select.debug.configuration', - category: 'Debug', + category: DebugCommands.DEBUG_CATEGORY, label: 'Select and Start Debugging' - }; + }, 'vscode/debugCommands/selectAndStartDebugging', DebugCommands.DEBUG_CATEGORY_KEY); @postConstruct() protected initialize(): void { diff --git a/packages/debug/src/browser/preferences/launch-preferences.ts b/packages/debug/src/browser/preferences/launch-preferences.ts index 9e969f9ca3b9b..edf4cd427a72d 100644 --- a/packages/debug/src/browser/preferences/launch-preferences.ts +++ b/packages/debug/src/browser/preferences/launch-preferences.ts @@ -18,6 +18,7 @@ import { interfaces } from '@theia/core/shared/inversify'; import { PreferenceContribution, PreferenceSchema } from '@theia/core/lib/browser/preferences/preference-contribution'; import { launchSchemaId } from '../debug-schema-updater'; import { PreferenceConfiguration } from '@theia/core/lib/browser/preferences/preference-configurations'; +import { nls } from '@theia/core/lib/common/nls'; export const launchPreferencesSchema: PreferenceSchema = { type: 'object', @@ -25,7 +26,10 @@ export const launchPreferencesSchema: PreferenceSchema = { properties: { 'launch': { $ref: launchSchemaId, - description: "Global debug launch configuration. Should be used as an alternative to 'launch.json' that is shared across workspaces", + description: nls.localize( + 'vscode/debug.contribution/launch', + "Global debug launch configuration. Should be used as an alternative to 'launch.json' that is shared across workspaces" + ), defaultValue: { configurations: [], compounds: [] } } } diff --git a/packages/debug/src/browser/view/debug-breakpoints-source.tsx b/packages/debug/src/browser/view/debug-breakpoints-source.tsx index 6849b398dffbf..3c13be47aad10 100644 --- a/packages/debug/src/browser/view/debug-breakpoints-source.tsx +++ b/packages/debug/src/browser/view/debug-breakpoints-source.tsx @@ -29,12 +29,6 @@ export class DebugBreakpointsSource extends TreeSource { @inject(BreakpointManager) protected readonly breakpoints: BreakpointManager; - constructor() { - super({ - placeholder: 'No breakpoints' - }); - } - @postConstruct() protected init(): void { this.fireDidChange(); diff --git a/packages/debug/src/browser/view/debug-breakpoints-widget.ts b/packages/debug/src/browser/view/debug-breakpoints-widget.ts index 26d9a3a482782..1ada22f37f58b 100644 --- a/packages/debug/src/browser/view/debug-breakpoints-widget.ts +++ b/packages/debug/src/browser/view/debug-breakpoints-widget.ts @@ -21,6 +21,7 @@ import { SourceTreeWidget } from '@theia/core/lib/browser/source-tree'; import { DebugBreakpointsSource } from './debug-breakpoints-source'; import { BreakpointManager } from '../breakpoint/breakpoint-manager'; import { DebugViewModel } from './debug-view-model'; +import { nls } from '@theia/core/lib/common/nls'; @injectable() export class DebugBreakpointsWidget extends SourceTreeWidget { @@ -57,7 +58,7 @@ export class DebugBreakpointsWidget extends SourceTreeWidget { protected init(): void { super.init(); this.id = 'debug:breakpoints:' + this.viewModel.id; - this.title.label = 'Breakpoints'; + this.title.label = nls.localize('vscode/debug.contribution/breakpoints', 'Breakpoints'); this.toDispose.push(this.breakpointsSource); this.source = this.breakpointsSource; } diff --git a/packages/debug/src/browser/view/debug-configuration-widget.tsx b/packages/debug/src/browser/view/debug-configuration-widget.tsx index 66a61d26bdedc..c627f1b14b5f7 100644 --- a/packages/debug/src/browser/view/debug-configuration-widget.tsx +++ b/packages/debug/src/browser/view/debug-configuration-widget.tsx @@ -27,6 +27,7 @@ import { DebugAction } from './debug-action'; import { DebugViewModel } from './debug-view-model'; import { DebugSessionOptions } from '../debug-session-options'; import { DebugCommands } from '../debug-frontend-application-contribution'; +import { nls } from '@theia/core/lib/common/nls'; @injectable() export class DebugConfigurationWidget extends ReactWidget { @@ -78,14 +79,15 @@ export class DebugConfigurationWidget extends ReactWidget { render(): React.ReactNode { const { options } = this; return - + - - + + ; } protected get currentValue(): string { diff --git a/packages/debug/src/browser/view/debug-stack-frames-source.tsx b/packages/debug/src/browser/view/debug-stack-frames-source.tsx index d60fbc71ffcd2..08144a316058e 100644 --- a/packages/debug/src/browser/view/debug-stack-frames-source.tsx +++ b/packages/debug/src/browser/view/debug-stack-frames-source.tsx @@ -27,12 +27,6 @@ export class DebugStackFramesSource extends TreeSource { @inject(DebugViewModel) protected readonly model: DebugViewModel; - constructor() { - super({ - placeholder: 'Not paused' - }); - } - @postConstruct() protected init(): void { this.refresh(); diff --git a/packages/debug/src/browser/view/debug-stack-frames-widget.ts b/packages/debug/src/browser/view/debug-stack-frames-widget.ts index aa8c299c3a1c6..9ad33b9448144 100644 --- a/packages/debug/src/browser/view/debug-stack-frames-widget.ts +++ b/packages/debug/src/browser/view/debug-stack-frames-widget.ts @@ -22,6 +22,7 @@ import { DebugStackFramesSource, LoadMoreStackFrames } from './debug-stack-frame import { DebugStackFrame } from '../model/debug-stack-frame'; import { DebugViewModel } from './debug-view-model'; import { DebugCallStackItemTypeKey } from '../debug-call-stack-item-type-key'; +import { nls } from '@theia/core/lib/common/nls'; @injectable() export class DebugStackFramesWidget extends SourceTreeWidget { @@ -55,7 +56,7 @@ export class DebugStackFramesWidget extends SourceTreeWidget { protected init(): void { super.init(); this.id = 'debug:frames:' + this.viewModel.id; - this.title.label = 'Call Stack'; + this.title.label = nls.localize('vscode/debug.contribution/callStack', 'Call Stack'); this.toDispose.push(this.frames); this.source = this.frames; diff --git a/packages/debug/src/browser/view/debug-threads-source.tsx b/packages/debug/src/browser/view/debug-threads-source.tsx index 286aa7df1655d..a2c0737018670 100644 --- a/packages/debug/src/browser/view/debug-threads-source.tsx +++ b/packages/debug/src/browser/view/debug-threads-source.tsx @@ -24,12 +24,6 @@ export class DebugThreadsSource extends TreeSource { @inject(DebugViewModel) protected readonly model: DebugViewModel; - constructor() { - super({ - placeholder: 'Not running' - }); - } - @postConstruct() protected init(): void { this.fireDidChange(); diff --git a/packages/debug/src/browser/view/debug-threads-widget.ts b/packages/debug/src/browser/view/debug-threads-widget.ts index 32fe3cb784dfc..a2c77930e1d6b 100644 --- a/packages/debug/src/browser/view/debug-threads-widget.ts +++ b/packages/debug/src/browser/view/debug-threads-widget.ts @@ -23,6 +23,7 @@ import { DebugSession } from '../debug-session'; import { DebugThread } from '../model/debug-thread'; import { DebugViewModel } from '../view/debug-view-model'; import { DebugCallStackItemTypeKey } from '../debug-call-stack-item-type-key'; +import { nls } from '@theia/core/lib/common/nls'; @injectable() export class DebugThreadsWidget extends SourceTreeWidget { @@ -59,7 +60,7 @@ export class DebugThreadsWidget extends SourceTreeWidget { protected init(): void { super.init(); this.id = 'debug:threads:' + this.viewModel.id; - this.title.label = 'Threads'; + this.title.label = nls.localize('theia/debug/threads', 'Threads'); this.toDispose.push(this.threads); this.source = this.threads; diff --git a/packages/debug/src/browser/view/debug-toolbar-widget.tsx b/packages/debug/src/browser/view/debug-toolbar-widget.tsx index 7f3f00adf4ad3..6c81fb7a0c242 100644 --- a/packages/debug/src/browser/view/debug-toolbar-widget.tsx +++ b/packages/debug/src/browser/view/debug-toolbar-widget.tsx @@ -21,6 +21,7 @@ import { ReactWidget } from '@theia/core/lib/browser/widgets'; import { DebugViewModel } from './debug-view-model'; import { DebugState } from '../debug-session'; import { DebugAction } from './debug-action'; +import { nls } from '@theia/core/lib/common/nls'; @injectable() export class DebugToolBar extends ReactWidget { @@ -58,26 +59,30 @@ export class DebugToolBar extends ReactWidget { const { state } = this.model; return {this.renderContinue()} - - - - + + + + {this.renderStart()} ; } protected renderStart(): React.ReactNode { const { state } = this.model; if (state === DebugState.Inactive && this.model.sessionCount === 1) { - return ; + return ; } - return ; + return ; } protected renderContinue(): React.ReactNode { const { state } = this.model; if (state === DebugState.Stopped) { - return ; + return ; } - return ; + return ; } protected start = () => this.model.start(); diff --git a/packages/debug/src/browser/view/debug-variables-source.ts b/packages/debug/src/browser/view/debug-variables-source.ts index 9b9f5801ea31f..3923207c8a1ff 100644 --- a/packages/debug/src/browser/view/debug-variables-source.ts +++ b/packages/debug/src/browser/view/debug-variables-source.ts @@ -26,12 +26,6 @@ export class DebugVariablesSource extends TreeSource { @inject(DebugViewModel) protected readonly model: DebugViewModel; - constructor() { - super({ - placeholder: 'Not paused' - }); - } - @postConstruct() protected init(): void { this.refresh(); diff --git a/packages/debug/src/browser/view/debug-variables-widget.ts b/packages/debug/src/browser/view/debug-variables-widget.ts index e3b830fffabe5..1241a6d82eebf 100644 --- a/packages/debug/src/browser/view/debug-variables-widget.ts +++ b/packages/debug/src/browser/view/debug-variables-widget.ts @@ -19,6 +19,7 @@ import { MenuPath } from '@theia/core/lib/common'; import { SourceTreeWidget } from '@theia/core/lib/browser/source-tree'; import { DebugVariablesSource } from './debug-variables-source'; import { DebugViewModel } from './debug-view-model'; +import { nls } from '@theia/core/lib/common/nls'; @injectable() export class DebugVariablesWidget extends SourceTreeWidget { @@ -51,7 +52,7 @@ export class DebugVariablesWidget extends SourceTreeWidget { protected init(): void { super.init(); this.id = 'debug:variables:' + this.viewModel.id; - this.title.label = 'Variables'; + this.title.label = nls.localize('vscode/debug.contribution/variables', 'Variables'); this.toDispose.push(this.variables); this.source = this.variables; } diff --git a/packages/debug/src/browser/view/debug-watch-source.ts b/packages/debug/src/browser/view/debug-watch-source.ts index 7e0fa43cde798..68f910567cc51 100644 --- a/packages/debug/src/browser/view/debug-watch-source.ts +++ b/packages/debug/src/browser/view/debug-watch-source.ts @@ -26,12 +26,6 @@ export class DebugWatchSource extends TreeSource { @inject(DebugViewModel) protected readonly model: DebugViewModel; - constructor() { - super({ - placeholder: 'No expressions' - }); - } - @postConstruct() protected init(): void { this.refresh(); diff --git a/packages/debug/src/browser/view/debug-watch-widget.ts b/packages/debug/src/browser/view/debug-watch-widget.ts index 2f4299a3d2b3b..c2aea9a76611e 100644 --- a/packages/debug/src/browser/view/debug-watch-widget.ts +++ b/packages/debug/src/browser/view/debug-watch-widget.ts @@ -19,6 +19,7 @@ import { MenuPath } from '@theia/core/lib/common'; import { SourceTreeWidget } from '@theia/core/lib/browser/source-tree'; import { DebugWatchSource } from './debug-watch-source'; import { DebugViewModel } from './debug-view-model'; +import { nls } from '@theia/core/lib/common/nls'; @injectable() export class DebugWatchWidget extends SourceTreeWidget { @@ -51,7 +52,7 @@ export class DebugWatchWidget extends SourceTreeWidget { protected init(): void { super.init(); this.id = 'debug:watch:' + this.viewModel.id; - this.title.label = 'Watch'; + this.title.label = nls.localize('vscode/debug.contribution/watch', 'Watch'); this.toDispose.push(this.variables); this.source = this.variables; } diff --git a/packages/debug/src/browser/view/debug-widget.ts b/packages/debug/src/browser/view/debug-widget.ts index 14df83c2d30ea..2eeb53a3e270d 100644 --- a/packages/debug/src/browser/view/debug-widget.ts +++ b/packages/debug/src/browser/view/debug-widget.ts @@ -23,6 +23,7 @@ import { DebugConfigurationWidget } from './debug-configuration-widget'; import { DebugViewModel } from './debug-view-model'; import { DebugSessionManager } from '../debug-session-manager'; import { ProgressBarFactory } from '@theia/core/lib/browser/progress-bar-factory'; +import { nls } from '@theia/core/lib/common/nls'; @injectable() export class DebugWidget extends BaseWidget implements StatefulWidget, ApplicationShell.TrackableWidgetProvider { @@ -38,7 +39,7 @@ export class DebugWidget extends BaseWidget implements StatefulWidget, Applicati } static ID = 'debug'; - static LABEL = 'Debug'; + static LABEL = nls.localize('vscode/settingsLayout/debug', 'Debug'); @inject(DebugViewModel) readonly model: DebugViewModel; diff --git a/packages/editor-preview/src/browser/editor-preview-contribution.ts b/packages/editor-preview/src/browser/editor-preview-contribution.ts index 6486bee4181aa..3e8731e09a7a2 100644 --- a/packages/editor-preview/src/browser/editor-preview-contribution.ts +++ b/packages/editor-preview/src/browser/editor-preview-contribution.ts @@ -14,17 +14,18 @@ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 ********************************************************************************/ -import { ApplicationShell, KeybindingContribution, KeybindingRegistry, SHELL_TABBAR_CONTEXT_MENU, Widget } from '@theia/core/lib/browser'; +import { ApplicationShell, CommonCommands, KeybindingContribution, KeybindingRegistry, SHELL_TABBAR_CONTEXT_MENU, Widget } from '@theia/core/lib/browser'; +import { nls } from '@theia/core/lib/common/nls'; import { Command, CommandContribution, CommandRegistry, MenuContribution, MenuModelRegistry } from '@theia/core/lib/common'; import { inject, injectable } from '@theia/core/shared/inversify'; import { EditorPreviewWidget } from './editor-preview-widget'; export namespace EditorPreviewCommands { - export const PIN_PREVIEW_COMMAND: Command = { + export const PIN_PREVIEW_COMMAND = Command.toLocalizedCommand({ id: 'workbench.action.keepEditor', - category: 'View', + category: CommonCommands.VIEW_CATEGORY, label: 'Keep Editor', - }; + }, 'vscode/editor.contribution/keepEditor', CommonCommands.VIEW_CATEGORY_KEY); } @injectable() @@ -61,7 +62,7 @@ export class EditorPreviewContribution implements CommandContribution, MenuContr registerMenus(registry: MenuModelRegistry): void { registry.registerMenuAction(SHELL_TABBAR_CONTEXT_MENU, { commandId: EditorPreviewCommands.PIN_PREVIEW_COMMAND.id, - label: 'Keep Open', + label: nls.localize('vscode/editor.contribution/keepOpen', 'Keep Open'), order: '6', }); } diff --git a/packages/editor-preview/src/browser/editor-preview-preferences.ts b/packages/editor-preview/src/browser/editor-preview-preferences.ts index 0b54973048dde..7b2016cea2476 100644 --- a/packages/editor-preview/src/browser/editor-preview-preferences.ts +++ b/packages/editor-preview/src/browser/editor-preview-preferences.ts @@ -16,13 +16,14 @@ import { interfaces } from '@theia/core/shared/inversify'; import { createPreferenceProxy, PreferenceProxy, PreferenceService, PreferenceContribution, PreferenceSchema } from '@theia/core/lib/browser'; +import { nls } from '@theia/core/lib/common/nls'; export const EditorPreviewConfigSchema: PreferenceSchema = { 'type': 'object', properties: { 'editor.enablePreview': { type: 'boolean', - description: 'Controls whether editors are opened as previews when selected or single-clicked.', + description: nls.localize('vscode/workbench.contribution/enablePreview', 'Controls whether editors are opened as previews when selected or single-clicked.'), default: true }, } diff --git a/packages/editor/src/browser/editor-command.ts b/packages/editor/src/browser/editor-command.ts index f901247e4b6e0..61c9cc47d8fde 100644 --- a/packages/editor/src/browser/editor-command.ts +++ b/packages/editor/src/browser/editor-command.ts @@ -24,11 +24,12 @@ import { ResourceProvider, MessageService } from '@theia/core'; import { LanguageService, Language } from '@theia/core/lib/browser/language-service'; import { SUPPORTED_ENCODINGS } from '@theia/core/lib/browser/supported-encodings'; import { EncodingMode } from './editor'; +import { nls } from '@theia/core/lib/common/nls'; export namespace EditorCommands { + const EDITOR_CATEGORY_KEY = 'vscode/textEditor/editor'; const EDITOR_CATEGORY = 'Editor'; - const VIEW_CATEGORY = 'View'; /** * Show editor references @@ -43,154 +44,154 @@ export namespace EditorCommands { id: 'textEditor.commands.configIndentation' }; - export const CONFIG_EOL: Command = { + export const CONFIG_EOL = Command.toLocalizedCommand({ id: 'textEditor.commands.configEol', category: EDITOR_CATEGORY, label: 'Change End of Line Sequence' - }; + }, 'vscode/editorStatus/selectEOL', EDITOR_CATEGORY_KEY); - export const INDENT_USING_SPACES: Command = { + export const INDENT_USING_SPACES = Command.toLocalizedCommand({ id: 'textEditor.commands.indentUsingSpaces', category: EDITOR_CATEGORY, label: 'Indent Using Spaces' - }; - export const INDENT_USING_TABS: Command = { + }, 'vscode/indentation/indentUsingSpaces', EDITOR_CATEGORY_KEY); + export const INDENT_USING_TABS = Command.toLocalizedCommand({ id: 'textEditor.commands.indentUsingTabs', category: EDITOR_CATEGORY, label: 'Indent Using Tabs' - }; - export const CHANGE_LANGUAGE: Command = { + }, 'vscode/indentation/indentUsingTabs', EDITOR_CATEGORY_KEY); + export const CHANGE_LANGUAGE = Command.toLocalizedCommand({ id: 'textEditor.change.language', category: EDITOR_CATEGORY, label: 'Change Language Mode' - }; - export const CHANGE_ENCODING: Command = { + }, 'vscode/editorStatus/changeMode', EDITOR_CATEGORY_KEY); + export const CHANGE_ENCODING = Command.toLocalizedCommand({ id: 'textEditor.change.encoding', category: EDITOR_CATEGORY, label: 'Change File Encoding' - }; - export const REVERT_EDITOR: Command = { + }, 'vscode/editorStatus/changeEncoding', EDITOR_CATEGORY_KEY); + export const REVERT_EDITOR = Command.toLocalizedCommand({ id: 'workbench.action.files.revert', - category: 'File', + category: CommonCommands.FILE_CATEGORY, label: 'Revert File', - }; - export const REVERT_AND_CLOSE: Command = { + }, 'vscode/fileActions.contribution/revert', CommonCommands.FILE_CATEGORY_KEY); + export const REVERT_AND_CLOSE = Command.toLocalizedCommand({ id: 'workbench.action.revertAndCloseActiveEditor', - category: 'View', + category: CommonCommands.VIEW_CATEGORY, label: 'Revert and Close Editor' - }; + }, 'vscode/editorActions/revertAndCloseActiveEditor', EDITOR_CATEGORY_KEY); /** * Command for going back to the last editor navigation location. */ - export const GO_BACK: Command = { + export const GO_BACK = Command.toLocalizedCommand({ id: 'textEditor.commands.go.back', category: EDITOR_CATEGORY, label: 'Go Back' - }; + }, 'vscode/editorActions/navigatePrevious', EDITOR_CATEGORY_KEY); /** * Command for going to the forthcoming editor navigation location. */ - export const GO_FORWARD: Command = { + export const GO_FORWARD = Command.toLocalizedCommand({ id: 'textEditor.commands.go.forward', category: EDITOR_CATEGORY, label: 'Go Forward' - }; + }, 'vscode/editorActions/navigateNext', EDITOR_CATEGORY_KEY); /** * Command that reveals the last text edit location, if any. */ - export const GO_LAST_EDIT: Command = { + export const GO_LAST_EDIT = Command.toLocalizedCommand({ id: 'textEditor.commands.go.lastEdit', category: EDITOR_CATEGORY, label: 'Go to Last Edit Location' - }; + }, 'vscode/editorActions/navigateToLastEditLocation', EDITOR_CATEGORY_KEY); /** * Command that clears the editor navigation history. */ - export const CLEAR_EDITOR_HISTORY: Command = { + export const CLEAR_EDITOR_HISTORY = Command.toLocalizedCommand({ id: 'textEditor.commands.clear.history', category: EDITOR_CATEGORY, label: 'Clear Editor History' - }; + }, 'vscode/editorActions/clearEditorHistory', EDITOR_CATEGORY_KEY); /** * Command that displays all editors that are currently opened. */ - export const SHOW_ALL_OPENED_EDITORS: Command = { + export const SHOW_ALL_OPENED_EDITORS = Command.toLocalizedCommand({ id: 'workbench.action.showAllEditors', - category: VIEW_CATEGORY, + category: CommonCommands.VIEW_CATEGORY, label: 'Show All Opened Editors' - }; + }, 'theia/editor/showAllEditors', EDITOR_CATEGORY_KEY); /** * Command that toggles the minimap. */ - export const TOGGLE_MINIMAP: Command = { + export const TOGGLE_MINIMAP = Command.toLocalizedCommand({ id: 'editor.action.toggleMinimap', - category: VIEW_CATEGORY, + category: CommonCommands.VIEW_CATEGORY, label: 'Toggle Minimap' - }; + }, 'vscode/toggleMinimap/toggleMinimap', EDITOR_CATEGORY_KEY); /** * Command that toggles the rendering of whitespace characters in the editor. */ - export const TOGGLE_RENDER_WHITESPACE: Command = { + export const TOGGLE_RENDER_WHITESPACE = Command.toLocalizedCommand({ id: 'editor.action.toggleRenderWhitespace', - category: VIEW_CATEGORY, + category: CommonCommands.VIEW_CATEGORY, label: 'Toggle Render Whitespace' - }; + }, 'vscode/toggleRenderWhitespace/toggleRenderWhitespace', EDITOR_CATEGORY_KEY); /** * Command that toggles the word wrap. */ - export const TOGGLE_WORD_WRAP: Command = { + export const TOGGLE_WORD_WRAP = Command.toLocalizedCommand({ id: 'editor.action.toggleWordWrap', - category: VIEW_CATEGORY, + category: CommonCommands.VIEW_CATEGORY, label: 'Toggle Word Wrap' - }; + }, 'vscode/toggleWordWrap/miToggleWordWrap', EDITOR_CATEGORY_KEY); /** * Command that re-opens the last closed editor. */ - export const REOPEN_CLOSED_EDITOR: Command = { + export const REOPEN_CLOSED_EDITOR = Command.toLocalizedCommand({ id: 'workbench.action.reopenClosedEditor', - category: VIEW_CATEGORY, + category: CommonCommands.VIEW_CATEGORY, label: 'Reopen Closed Editor' - }; + }, 'vscode/editorActions/reopenClosedEditor', EDITOR_CATEGORY_KEY); /** * Opens a second instance of the current editor, splitting the view in the direction specified. */ - export const SPLIT_EDITOR_RIGHT: Command = { + export const SPLIT_EDITOR_RIGHT = Command.toLocalizedCommand({ id: 'workbench.action.splitEditorRight', - category: VIEW_CATEGORY, + category: CommonCommands.VIEW_CATEGORY, label: 'Split Editor Right' - }; - export const SPLIT_EDITOR_DOWN: Command = { + }, 'vscode/editorActions/splitEditorGroupRight', EDITOR_CATEGORY_KEY); + export const SPLIT_EDITOR_DOWN = Command.toLocalizedCommand({ id: 'workbench.action.splitEditorDown', - category: VIEW_CATEGORY, + category: CommonCommands.VIEW_CATEGORY, label: 'Split Editor Down' - }; - export const SPLIT_EDITOR_UP: Command = { + }, 'vscode/editorActions/splitEditorGroupDown', EDITOR_CATEGORY_KEY); + export const SPLIT_EDITOR_UP = Command.toLocalizedCommand({ id: 'workbench.action.splitEditorUp', - category: VIEW_CATEGORY, + category: CommonCommands.VIEW_CATEGORY, label: 'Split Editor Up' - }; - export const SPLIT_EDITOR_LEFT: Command = { + }, 'vscode/editorActions/splitEditorGroupUp', EDITOR_CATEGORY_KEY); + export const SPLIT_EDITOR_LEFT = Command.toLocalizedCommand({ id: 'workbench.action.splitEditorLeft', - category: VIEW_CATEGORY, + category: CommonCommands.VIEW_CATEGORY, label: 'Split Editor Left' - }; + }, 'vscode/editorActions/splitEditorGroupLeft', EDITOR_CATEGORY_KEY); /** * Default horizontal split: right. */ - export const SPLIT_EDITOR_HORIZONTAL: Command = { + export const SPLIT_EDITOR_HORIZONTAL = Command.toLocalizedCommand({ id: 'workbench.action.splitEditor', - category: VIEW_CATEGORY, + category: CommonCommands.VIEW_CATEGORY, label: 'Split Editor' - }; + }, 'vscode/editorActions/splitEditor', EDITOR_CATEGORY_KEY); /** * Default vertical split: down. */ - export const SPLIT_EDITOR_VERTICAL: Command = { + export const SPLIT_EDITOR_VERTICAL = Command.toLocalizedCommand({ id: 'workbench.action.splitEditorOrthogonal', - category: VIEW_CATEGORY, + category: CommonCommands.VIEW_CATEGORY, label: 'Split Editor Orthogonal' - }; + }, 'vscode/editorActions/splitEditorOrthogonal', EDITOR_CATEGORY_KEY); } @injectable() @@ -280,11 +281,11 @@ export class EditorCommandContribution implements CommandContribution { } const current = editor.document.languageId; const items: Array | QuickPickItem> = [ - { label: 'Auto Detect', value: 'autoDetect' }, - { type: 'separator', label: 'languages (identifier)' }, + { label: nls.localize('vscode/editorStatus/autoDetect', 'Auto Detect'), value: 'autoDetect' }, + { type: 'separator', label: nls.localize('vscode/editorStatus/languagesPicks', 'languages (identifier)') }, ... (this.languages.languages.map(language => this.toQuickPickLanguage(language, current))).sort((e, e2) => e.label.localeCompare(e2.label)) ]; - const selectedMode = await this.quickInputService?.showQuickPick(items, { placeholder: 'Select Language Mode' }); + const selectedMode = await this.quickInputService?.showQuickPick(items, { placeholder: nls.localize('vscode/editorStatus/selectLanguageMode', 'Select Language Mode') }); if (selectedMode && ('value' in selectedMode)) { if (selectedMode.value === 'autoDetect') { editor.detectLanguage(); @@ -305,13 +306,13 @@ export class EditorCommandContribution implements CommandContribution { if (!editor) { return; } - const reopenWithEncodingPick = { label: 'Reopen with Encoding', value: 'reopen' }; - const saveWithEncodingPick = { label: 'Save with Encoding', value: 'save' }; + const reopenWithEncodingPick = { label: nls.localize('vscode/editorStatus/reopenWithEncoding', 'Reopen with Encoding'), value: 'reopen' }; + const saveWithEncodingPick = { label: nls.localize('vscode/editorStatus/saveWithEncoding', 'Save with Encoding'), value: 'save' }; const actionItems: QuickPickValue[] = [ reopenWithEncodingPick, saveWithEncodingPick ]; - const selectedEncoding = await this.quickInputService?.showQuickPick(actionItems, { placeholder: 'Select Action' }); + const selectedEncoding = await this.quickInputService?.showQuickPick(actionItems, { placeholder: nls.localize('vscode/editorStatus/pickAction', 'Select Action') }); if (!selectedEncoding) { return; } @@ -344,19 +345,21 @@ export class EditorCommandContribution implements CommandContribution { // Insert guessed encoding if (guessedEncoding && configuredEncoding !== guessedEncoding && SUPPORTED_ENCODINGS[guessedEncoding]) { encodingItems.unshift({ - label: `Guessed from content: ${SUPPORTED_ENCODINGS[guessedEncoding].labelLong}`, + label: `${nls.localize('vscode/editorStatus/guessedEncoding', 'Guessed from content')}: ${SUPPORTED_ENCODINGS[guessedEncoding].labelLong}`, value: { id: guessedEncoding, description: guessedEncoding } }); } const selectedFileEncoding = await this.quickInputService?.showQuickPick>(encodingItems, { - placeholder: isReopenWithEncoding ? 'Select File Encoding to Reopen File' : 'Select File Encoding to Save with' + placeholder: isReopenWithEncoding ? + nls.localize('vscode/editorStatus/pickEncodingForReopen', 'Select File Encoding to Reopen File') : + nls.localize('vscode/editorStatus/pickEncodingForSave', 'Select File Encoding to Save with') }); if (!selectedFileEncoding) { return; } if (editor.document.dirty && isReopenWithEncoding) { - this.messageService.info('The file is dirty. Please save it first before reopening it with another encoding.'); + this.messageService.info(nls.localize('theia/editor/reopenDirty', 'The file is dirty. Please save it first before reopening it with another encoding.')); return; } else if (selectedFileEncoding.value) { editor.setEncoding(selectedFileEncoding.value.id, isReopenWithEncoding ? EncodingMode.Decode : EncodingMode.Encode); @@ -367,10 +370,11 @@ export class EditorCommandContribution implements CommandContribution { const languageUri = this.toLanguageUri(value); const icon = this.labelProvider.getIcon(languageUri); const iconClasses = icon !== '' ? [icon + ' file-icon'] : undefined; + const configured = current === value.id; return { value, label: value.name, - description: `(${value.id})${current === value.id ? ' - Configured Language' : ''}`, + description: nls.localize(`vscode/editorStatus/languageDescription${configured ? '' : 'Configured'}`, `({0})${configured ? ' - Configured Language' : ''}`), iconClasses }; } diff --git a/packages/editor/src/browser/editor-contribution.ts b/packages/editor/src/browser/editor-contribution.ts index 00f30cc51c722..14449b6dece7e 100644 --- a/packages/editor/src/browser/editor-contribution.ts +++ b/packages/editor/src/browser/editor-contribution.ts @@ -25,6 +25,7 @@ import { EditorCommands } from './editor-command'; import { CommandRegistry, CommandContribution } from '@theia/core/lib/common'; import { LanguageService } from '@theia/core/lib/browser/language-service'; import { SUPPORTED_ENCODINGS } from '@theia/core/lib/browser/supported-encodings'; +import { nls } from '@theia/core/lib/common/nls'; @injectable() export class EditorContribution implements FrontendApplicationContribution, CommandContribution, KeybindingContribution { @@ -94,7 +95,7 @@ export class EditorContribution implements FrontendApplicationContribution, Comm alignment: StatusBarAlignment.RIGHT, priority: 1, command: EditorCommands.CHANGE_LANGUAGE.id, - tooltip: 'Select Language Mode' + tooltip: nls.localize('vscode/editorStatus/selectLanguageMode', 'Select Language Mode') }); } @@ -108,7 +109,7 @@ export class EditorContribution implements FrontendApplicationContribution, Comm alignment: StatusBarAlignment.RIGHT, priority: 10, command: EditorCommands.CHANGE_ENCODING.id, - tooltip: 'Select Encoding' + tooltip: nls.localize('vscode/editorStatus/selectEncoding', 'Select Encoding') }); } @@ -119,10 +120,10 @@ export class EditorContribution implements FrontendApplicationContribution, Comm } const { cursor } = editor; this.statusBar.setElement('editor-status-cursor-position', { - text: `Ln ${cursor.line + 1}, Col ${editor.getVisibleColumn(cursor)}`, + text: nls.localize('vscode/editorStatus/singleSelection', 'Ln {0}, Col {1}', (cursor.line + 1).toString(), editor.getVisibleColumn(cursor).toString()), alignment: StatusBarAlignment.RIGHT, priority: 100, - tooltip: 'Go To Line', + tooltip: nls.localize('vscode/editorStatus/gotoLine', 'Go To Line'), command: 'editor.action.gotoLine' }); } diff --git a/packages/editor/src/browser/editor-menu.ts b/packages/editor/src/browser/editor-menu.ts index 464cae389a14b..5a446a7ce365b 100644 --- a/packages/editor/src/browser/editor-menu.ts +++ b/packages/editor/src/browser/editor-menu.ts @@ -18,6 +18,7 @@ import { injectable } from '@theia/core/shared/inversify'; import { MenuContribution, MenuModelRegistry, MenuPath, MAIN_MENU_BAR } from '@theia/core'; import { CommonCommands, CommonMenus } from '@theia/core/lib/browser'; import { EditorCommands } from './editor-command'; +import { nls } from '@theia/core/lib/common/nls'; export const EDITOR_CONTEXT_MENU: MenuPath = ['editor_context_menu']; @@ -72,18 +73,18 @@ export class EditorMenuContribution implements MenuContribution { }); // Editor navigation. Go > Back and Go > Forward. - registry.registerSubmenu(EditorMainMenu.GO, 'Go'); + registry.registerSubmenu(EditorMainMenu.GO, nls.localize('vscode/menubar/mGoto', 'Go')); registry.registerMenuAction(EditorMainMenu.NAVIGATION_GROUP, { commandId: EditorCommands.GO_BACK.id, - label: 'Back' + label: EditorCommands.GO_BACK.label }); registry.registerMenuAction(EditorMainMenu.NAVIGATION_GROUP, { commandId: EditorCommands.GO_FORWARD.id, - label: 'Forward' + label: EditorCommands.GO_FORWARD.label }); registry.registerMenuAction(EditorMainMenu.NAVIGATION_GROUP, { commandId: EditorCommands.GO_LAST_EDIT.id, - label: 'Last Edit Location' + label: EditorCommands.GO_LAST_EDIT.label }); // Toggle Commands. @@ -94,17 +95,17 @@ export class EditorMenuContribution implements MenuContribution { }); registry.registerMenuAction(CommonMenus.VIEW_TOGGLE, { commandId: EditorCommands.TOGGLE_MINIMAP.id, - label: 'Show Minimap', + label: EditorCommands.TOGGLE_MINIMAP.label, order: '1', }); registry.registerMenuAction(CommonMenus.VIEW_TOGGLE, { commandId: EditorCommands.TOGGLE_RENDER_WHITESPACE.id, - label: 'Render Whitespace', + label: EditorCommands.TOGGLE_RENDER_WHITESPACE.label, order: '2' }); registry.registerMenuAction(CommonMenus.FILE_CLOSE, { commandId: CommonCommands.CLOSE_MAIN_TAB.id, - label: 'Close Editor', + label: nls.localize('vscode/editor.contribution/closeEditor', 'Close Editor'), order: '1' }); } diff --git a/packages/editor/src/browser/editor-preferences.ts b/packages/editor/src/browser/editor-preferences.ts index aba35bc557ab7..da22408e63be6 100644 --- a/packages/editor/src/browser/editor-preferences.ts +++ b/packages/editor/src/browser/editor-preferences.ts @@ -25,6 +25,7 @@ import { PreferenceSchemaProperties } from '@theia/core/lib/browser/preferences'; import { isWindows, isOSX, OS } from '@theia/core/lib/common/os'; +import { nls } from '@theia/core/lib/common/nls'; const DEFAULT_WINDOWS_FONT_FAMILY = 'Consolas, \'Courier New\', monospace'; const DEFAULT_MAC_FONT_FAMILY = 'Menlo, Monaco, \'Courier New\', monospace'; @@ -77,7 +78,7 @@ const codeEditorPreferenceProperties = { 'type': 'number', 'default': EDITOR_MODEL_DEFAULTS.tabSize, 'minimum': 1, - 'markdownDescription': 'The number of spaces a tab is equal to. This setting is overridden based on the file contents when `#editor.detectIndentation#` is on.' + 'markdownDescription': nls.localize('vscode/commonEditorConfig/tabSize', 'The number of spaces a tab is equal to. This setting is overridden based on the file contents when `#editor.detectIndentation#` is on.') }, 'editor.defaultFormatter': { 'type': 'string', @@ -87,105 +88,105 @@ const codeEditorPreferenceProperties = { 'editor.insertSpaces': { 'type': 'boolean', 'default': EDITOR_MODEL_DEFAULTS.insertSpaces, - 'markdownDescription': 'Insert spaces when pressing `Tab`. This setting is overridden based on the file contents when `#editor.detectIndentation#` is on.' + 'markdownDescription': nls.localize('vscode/commonEditorConfig/insertSpaces', 'Insert spaces when pressing `Tab`. This setting is overridden based on the file contents when `#editor.detectIndentation#` is on.') }, 'editor.detectIndentation': { 'type': 'boolean', 'default': EDITOR_MODEL_DEFAULTS.detectIndentation, - 'markdownDescription': 'Controls whether `#editor.tabSize#` and `#editor.insertSpaces#` will be automatically detected when a file is opened based on the file contents.' + 'markdownDescription': nls.localize('vscode/commonEditorConfig/detectIndentation', 'Controls whether `#editor.tabSize#` and `#editor.insertSpaces#` will be automatically detected when a file is opened based on the file contents.') }, 'editor.trimAutoWhitespace': { 'type': 'boolean', 'default': EDITOR_MODEL_DEFAULTS.trimAutoWhitespace, - 'description': 'Remove trailing auto inserted whitespace.' + 'description': nls.localize('vscode/commonEditorConfig/trimAutoWhitespace', 'Remove trailing auto inserted whitespace.') }, 'editor.largeFileOptimizations': { 'type': 'boolean', 'default': EDITOR_MODEL_DEFAULTS.largeFileOptimizations, - 'description': 'Special handling for large files to disable certain memory intensive features.' + 'description': nls.localize('vscode/commonEditorConfig/largeFileOptimizations', 'Special handling for large files to disable certain memory intensive features.') }, 'editor.wordBasedSuggestions': { 'type': 'boolean', 'default': true, - 'description': 'Controls whether completions should be computed based on words in the document.' + 'description': nls.localize('vscode/commonEditorConfig/wordBasedSuggestions', 'Controls whether completions should be computed based on words in the document.') }, 'editor.wordBasedSuggestionsMode': { 'enum': ['currentDocument', 'matchingDocuments', 'allDocuments'], 'default': 'matchingDocuments', 'enumDescriptions': [ - 'Only suggest words from the active document.', - 'Suggest words from all open documents of the same language.', - 'Suggest words from all open documents.' + nls.localize('vscode/commonEditorConfig/wordBasedSuggestionsMode.currentDocument', 'Only suggest words from the active document.'), + nls.localize('vscode/commonEditorConfig/wordBasedSuggestionsMode.matchingDocuments', 'Suggest words from all open documents of the same language.'), + nls.localize('vscode/commonEditorConfig/wordBasedSuggestionsMode.allDocuments', 'Suggest words from all open documents.') ], - 'description': 'Controls form what documents word based completions are computed.' + 'description': nls.localize('vscode/commonEditorConfig/wordBasedSuggestionsMode', 'Controls form what documents word based completions are computed.') }, 'editor.semanticHighlighting.enabled': { 'enum': [true, false, 'configuredByTheme'], 'enumDescriptions': [ - 'Semantic highlighting enabled for all color themes.', - 'Semantic highlighting disabled for all color themes.', - 'Semantic highlighting is configured by the current color theme\'s `semanticHighlighting` setting.' + nls.localize('vscode/commonEditorConfig/semanticHighlighting.true', 'Semantic highlighting enabled for all color themes.'), + nls.localize('vscode/commonEditorConfig/semanticHighlighting.false', 'Semantic highlighting disabled for all color themes.'), + nls.localize('vscode/commonEditorConfig/semanticHighlighting.configuredByTheme', 'Semantic highlighting is configured by the current color theme\'s `semanticHighlighting` setting.') ], 'default': 'configuredByTheme', - 'description': 'Controls whether the semanticHighlighting is shown for the languages that support it.' + 'description': nls.localize('vscode/commonEditorConfig/emanticHighlighting.enabled', 'Controls whether the semanticHighlighting is shown for the languages that support it.') }, 'editor.stablePeek': { 'type': 'boolean', 'default': false, - 'markdownDescription': 'Keep peek editors open even when double clicking their content or when hitting `Escape`.' + 'markdownDescription': nls.localize('vscode/commonEditorConfig/stablePeek', 'Keep peek editors open even when double clicking their content or when hitting `Escape`.') }, 'editor.maxTokenizationLineLength': { 'type': 'integer', 'default': 400, - 'description': 'Lines above this length will not be tokenized for performance reasons.' + 'description': nls.localize('vscode/commonEditorConfig/maxTokenizationLineLength', 'Lines above this length will not be tokenized for performance reasons.') }, 'diffEditor.maxComputationTime': { 'type': 'number', 'default': 5000, - 'description': 'Timeout in milliseconds after which diff computation is cancelled. Use 0 for no timeout.' + 'description': nls.localize('vscode/commonEditorConfig/maxComputationTime', 'Timeout in milliseconds after which diff computation is cancelled. Use 0 for no timeout.') }, 'diffEditor.renderSideBySide': { 'type': 'boolean', 'default': true, - 'description': 'Controls whether the diff editor shows the diff side by side or inline.' + 'description': nls.localize('vscode/commonEditorConfig/sideBySide', 'Controls whether the diff editor shows the diff side by side or inline.') }, 'diffEditor.ignoreTrimWhitespace': { 'type': 'boolean', 'default': true, - 'description': 'When enabled, the diff editor ignores changes in leading or trailing whitespace.' + 'description': nls.localize('vscode/commonEditorConfig/ignoreTrimWhitespace', 'When enabled, the diff editor ignores changes in leading or trailing whitespace.') }, 'diffEditor.renderIndicators': { 'type': 'boolean', 'default': true, - 'description': 'Controls whether the diff editor shows +/- indicators for added/removed changes.' + 'description': nls.localize('vscode/commonEditorConfig/renderIndicators', 'Controls whether the diff editor shows +/- indicators for added/removed changes.') }, 'diffEditor.codeLens': { 'type': 'boolean', 'default': false, - 'description': 'Controls whether the editor shows CodeLens.' + 'description': nls.localize('vscode/commonEditorConfig/codeLens', 'Controls whether the editor shows CodeLens.') }, 'diffEditor.wordWrap': { 'type': 'string', 'enum': ['off', 'on', 'inherit'], 'default': 'inherit', 'markdownEnumDescriptions': [ - 'Lines will never wrap.', - 'Lines will wrap at the viewport width.', - 'Lines will wrap according to the `#editor.wordWrap#` setting.' + nls.localize('vscode/commonEditorConfig/wordWrap.off', 'Lines will never wrap.'), + nls.localize('vscode/commonEditorConfig/wordWrap.on', 'Lines will wrap at the viewport width.'), + nls.localize('vscode/commonEditorConfig/wordWrap.inherit', 'Lines will wrap according to the `#editor.wordWrap#` setting.') ] }, 'editor.acceptSuggestionOnCommitCharacter': { - 'markdownDescription': 'Controls whether suggestions should be accepted on commit characters. For example, in JavaScript, the semi-colon (`;`) can be a commit character that accepts a suggestion and types that character.', + 'markdownDescription': nls.localize('vscode/editorOptions/acceptSuggestionOnCommitCharacter', 'Controls whether suggestions should be accepted on commit characters. For example, in JavaScript, the semi-colon (`;`) can be a commit character that accepts a suggestion and types that character.'), 'type': 'boolean', 'default': true }, 'editor.acceptSuggestionOnEnter': { 'markdownEnumDescriptions': [ '', - 'Only accept a suggestion with `Enter` when it makes a textual change.', + nls.localize('vscode/editorOptions/acceptSuggestionOnEnterSmart', 'Only accept a suggestion with `Enter` when it makes a textual change.'), '' ], - 'markdownDescription': 'Controls whether suggestions should be accepted on `Enter`, in addition to `Tab`. Helps to avoid ambiguity between inserting new lines or accepting suggestions.', + 'markdownDescription': nls.localize('vscode/editorOptions/acceptSuggestionOnEnter', 'Controls whether suggestions should be accepted on `Enter`, in addition to `Tab`. Helps to avoid ambiguity between inserting new lines or accepting suggestions.'), 'type': 'string', 'enum': [ 'on', @@ -202,15 +203,15 @@ const codeEditorPreferenceProperties = { 'off' ], 'enumDescriptions': [ - 'The editor will use platform APIs to detect when a Screen Reader is attached.', - 'The editor will be permanently optimized for usage with a Screen Reader.', - 'The editor will never be optimized for usage with a Screen Reader.' + nls.localize('vscode/editorOptions/accessibilitySupport.auto', 'The editor will use platform APIs to detect when a Screen Reader is attached.'), + nls.localize('vscode/editorOptions/accessibilitySupport.on', 'The editor will be permanently optimized for usage with a Screen Reader.'), + nls.localize('vscode/editorOptions/accessibilitySupport.off', 'The editor will never be optimized for usage with a Screen Reader.') ], 'default': 'auto', - 'description': 'Controls whether the editor should run in a mode where it is optimized for screen readers.' + 'description': nls.localize('vscode/editorOptions/accessibilitySupport', 'Controls whether the editor should run in a mode where it is optimized for screen readers.') }, 'editor.accessibilityPageSize': { - 'description': 'Controls the number of lines in the editor that can be read out by a screen reader. Warning: this has a performance implication for numbers larger than the default.', + 'description': nls.localize('vscode/editorOptions/accessibilityPageSize', 'Controls the number of lines in the editor that can be read out by a screen reader. Warning: this has a performance implication for numbers larger than the default.'), 'type': 'integer', 'default': 10, 'minimum': 1, @@ -219,11 +220,11 @@ const codeEditorPreferenceProperties = { 'editor.autoClosingBrackets': { 'enumDescriptions': [ '', - 'Use language configurations to determine when to autoclose brackets.', - 'Autoclose brackets only when the cursor is to the left of whitespace.', + nls.localize('vscode/editorOptions/languageDefined', 'Use language configurations to determine when to autoclose brackets.'), + nls.localize('vscode/editorOptions/beforeWhitespace', 'Autoclose brackets only when the cursor is to the left of whitespace.'), '' ], - 'description': 'Controls whether the editor should automatically close brackets after the user adds an opening bracket.', + 'description': nls.localize('vscode/editorOptions/autoClosingBrackets', 'Controls whether the editor should automatically close brackets after the user adds an opening bracket.'), 'type': 'string', 'enum': [ 'always', @@ -236,10 +237,10 @@ const codeEditorPreferenceProperties = { 'editor.autoClosingOvertype': { 'enumDescriptions': [ '', - 'Type over closing quotes or brackets only if they were automatically inserted.', + nls.localize('vscode/editorOptions/editor.autoClosingDelete.auto', 'Type over closing quotes or brackets only if they were automatically inserted.'), '' ], - 'description': 'Controls whether the editor should type over closing quotes or brackets.', + 'description': nls.localize('vscode/editorOptions/autoClosingDelete', 'Controls whether the editor should type over closing quotes or brackets.'), 'type': 'string', 'enum': [ 'always', @@ -251,11 +252,11 @@ const codeEditorPreferenceProperties = { 'editor.autoClosingQuotes': { 'enumDescriptions': [ '', - 'Use language configurations to determine when to autoclose quotes.', - 'Autoclose quotes only when the cursor is to the left of whitespace.', + nls.localize('vscode/editorOptions/editor.autoClosingQuotes.languageDefined', 'Use language configurations to determine when to autoclose quotes.'), + nls.localize('vscode/editorOptions/editor.autoClosingQuotes.beforeWhitespace', 'Autoclose quotes only when the cursor is to the left of whitespace.'), '' ], - 'description': 'Controls whether the editor should automatically close quotes after the user adds an opening quote.', + 'description': nls.localize('vscode/editorOptions/autoClosingQuotes', 'Controls whether the editor should automatically close quotes after the user adds an opening quote.'), 'type': 'string', 'enum': [ 'always', @@ -267,13 +268,13 @@ const codeEditorPreferenceProperties = { }, 'editor.autoIndent': { 'enumDescriptions': [ - 'The editor will not insert indentation automatically.', - 'The editor will keep the current line\'s indentation.', - 'The editor will keep the current line\'s indentation and honor language defined brackets.', - 'The editor will keep the current line\'s indentation, honor language defined brackets and invoke special onEnterRules defined by languages.', - 'The editor will keep the current line\'s indentation, honor language defined brackets, invoke special onEnterRules defined by languages, and honor indentationRules defined by languages.' + nls.localize('vscode/editorOptions/editor.autoIndent.none', 'The editor will not insert indentation automatically.'), + nls.localize('vscode/editorOptions/editor.autoIndent.keep', 'The editor will keep the current line\'s indentation.'), + nls.localize('vscode/editorOptions/editor.autoIndent.brackets', 'The editor will keep the current line\'s indentation and honor language defined brackets.'), + nls.localize('vscode/editorOptions/editor.autoIndent.advanced', 'The editor will keep the current line\'s indentation, honor language defined brackets and invoke special onEnterRules defined by languages.'), + nls.localize('vscode/editorOptions/editor.autoIndent.full', 'The editor will keep the current line\'s indentation, honor language defined brackets, invoke special onEnterRules defined by languages, and honor indentationRules defined by languages.') ], - 'description': 'Controls whether the editor should automatically adjust the indentation when users type, paste, move or indent lines.', + 'description': nls.localize('vscode/editorOptions/autoIndent', 'Controls whether the editor should automatically adjust the indentation when users type, paste, move or indent lines.'), 'type': 'string', 'enum': [ 'none', @@ -286,12 +287,12 @@ const codeEditorPreferenceProperties = { }, 'editor.autoSurround': { 'enumDescriptions': [ - 'Use language configurations to determine when to automatically surround selections.', - 'Surround with quotes but not brackets.', - 'Surround with brackets but not quotes.', + nls.localize('vscode/editorOptions/editor.autoSurround.languageDefined', 'Use language configurations to determine when to automatically surround selections.'), + nls.localize('vscode/editorOptions/editor.autoSurround.quotes', 'Surround with quotes but not brackets.'), + nls.localize('vscode/editorOptions/editor.autoSurround.brackets', 'Surround with brackets but not quotes.'), '' ], - 'description': 'Controls whether the editor should automatically surround selections.', + 'description': nls.localize('vscode/editorOptions/autoSurround', 'Controls whether the editor should automatically surround selections.'), 'type': 'string', 'enum': [ 'languageDefined', @@ -303,21 +304,21 @@ const codeEditorPreferenceProperties = { }, 'editor.ariaLabel': { 'type': 'string', - 'description': 'The aria label for the editor\'s textarea when focused.', + 'description': nls.localize('theia/editor/ariaLabel', 'The aria label for the editor\'s textarea when focused.'), 'default': 'ariaLabel' }, 'editor.automaticLayout': { 'type': 'boolean', 'default': false, - 'description': 'Enable that the editor will install an interval to check if its container dom node size has changed. Enabling this might have a severe performance impact.' + 'description': nls.localize('theia/editor/automaticLayout', 'Enable that the editor will install an interval to check if its container dom node size has changed. Enabling this might have a severe performance impact.') }, 'editor.codeLens': { - 'description': 'Controls whether the editor shows CodeLens.', + 'description': nls.localize('vscode/editorOptions/codeLens', 'Controls whether the editor shows CodeLens.'), 'type': 'boolean', 'default': true }, 'editor.codeLensFontFamily': { - 'description': 'Controls the font family for CodeLens.', + 'description': nls.localize('vscode/editorOptions/codeLensFontFamily', 'Controls the font family for CodeLens.'), 'type': 'string', 'default': true }, @@ -326,35 +327,35 @@ const codeEditorPreferenceProperties = { 'default': 0, 'minimum': 0, 'maximum': 100, - 'description': 'Controls the font size in pixels for CodeLens. When set to `0`, the 90% of `#editor.fontSize#` is used.' + 'description': nls.localize('vscode/editorOptions/codeLensFontSize', 'Controls the font size in pixels for CodeLens. When set to `0`, the 90% of `#editor.fontSize#` is used.') }, 'editor.colorDecorators': { - 'description': 'Controls whether the editor should render the inline color decorators and color picker.', + 'description': nls.localize('vscode/editorOptions/colorDecorators', 'Controls whether the editor should render the inline color decorators and color picker.'), 'type': 'boolean', 'default': true }, 'editor.comments.insertSpace': { 'type': 'boolean', 'default': true, - 'description': 'Controls whether a space character is inserted when commenting.' + 'description': nls.localize('vscode/editorOptions/comments.insertSpace', 'Controls whether a space character is inserted when commenting.') }, 'editor.comments.ignoreEmptyLines': { 'type': 'boolean', 'default': true, - 'description': 'Controls if empty lines should be ignored with toggle, add or remove actions for line comments.' + 'description': nls.localize('vscode/editorOptions/comments.ignoreEmptyLines', 'Controls if empty lines should be ignored with toggle, add or remove actions for line comments.') }, 'editor.contextmenu': { - 'description': 'Controls whether to enable the custom contextmenu.', + 'description': nls.localize('theia/editor/contextmenu', 'Controls whether to enable the custom contextmenu.'), 'type': 'boolean', 'default': true, }, 'editor.copyWithSyntaxHighlighting': { - 'description': 'Controls whether syntax highlighting should be copied into the clipboard.', + 'description': nls.localize('vscode/editorOptions/copyWithSyntaxHighlighting', 'Controls whether syntax highlighting should be copied into the clipboard.'), 'type': 'boolean', 'default': true }, 'editor.cursorBlinking': { - 'description': 'Control the cursor animation style.', + 'description': nls.localize('vscode/editorOptions/cursorBlinking', 'Control the cursor animation style.'), 'type': 'string', 'enum': [ 'blink', @@ -366,12 +367,12 @@ const codeEditorPreferenceProperties = { 'default': 'blink' }, 'editor.cursorSmoothCaretAnimation': { - 'description': 'Controls whether the smooth caret animation should be enabled.', + 'description': nls.localize('vscode/editorOptions/cursorSmoothCaretAnimation', 'Controls whether the smooth caret animation should be enabled.'), 'type': 'boolean', 'default': false }, 'editor.cursorStyle': { - 'description': 'Controls the cursor style.', + 'description': nls.localize('vscode/editorOptions/cursorStyle', 'Controls the cursor style.'), 'type': 'string', 'enum': [ 'line', @@ -384,7 +385,7 @@ const codeEditorPreferenceProperties = { 'default': 'line' }, 'editor.cursorSurroundingLines': { - 'description': 'Controls the minimal number of visible leading and trailing lines surrounding the cursor. Known as `scrollOff` or `scrollOffset` in some other editors.', + 'description': nls.localize('vscode/editorOptions/cursorSurroundingLines', 'Controls the minimal number of visible leading and trailing lines surrounding the cursor. Known as `scrollOff` or `scrollOffset` in some other editors.'), 'type': 'integer', 'default': 0, 'minimum': 0, @@ -392,10 +393,10 @@ const codeEditorPreferenceProperties = { }, 'editor.cursorSurroundingLinesStyle': { 'enumDescriptions': [ - '`cursorSurroundingLines` is enforced only when triggered via the keyboard or API.', - '`cursorSurroundingLines` is enforced always.' + nls.localize('vscode/editorOptions/cursorSurroundingLinesStyle.default', '`cursorSurroundingLines` is enforced only when triggered via the keyboard or API.'), + nls.localize('vscode/editorOptions/cursorSurroundingLinesStyle.all', '`cursorSurroundingLines` is enforced always.') ], - 'description': 'Controls when `cursorSurroundingLines` should be enforced.', + 'description': nls.localize('vscode/editorOptions/cursorSurroundingLinesStyle', 'Controls when `cursorSurroundingLines` should be enforced.'), 'type': 'string', 'enum': [ 'default', @@ -404,51 +405,51 @@ const codeEditorPreferenceProperties = { 'default': 'default' }, 'editor.cursorWidth': { - 'markdownDescription': 'Controls the width of the cursor when `#editor.cursorStyle#` is set to `line`.', + 'markdownDescription': nls.localize('vscode/editorOptions/cursorWidth', 'Controls the width of the cursor when `#editor.cursorStyle#` is set to `line`.'), 'type': 'integer', 'default': 0, 'minimum': 0, 'maximum': 1073741824 }, 'editor.disableLayerHinting': { - 'markdownDescription': 'Disable the use of `transform: translate3d(0px, 0px, 0px)` for the editor margin and lines layers. The usage of `transform: translate3d(0px, 0px, 0px)` acts as a hint for browsers to create an extra layer.', + 'markdownDescription': nls.localize('theia/editor/disableLayerHinting', 'Disable the use of `transform: translate3d(0px, 0px, 0px)` for the editor margin and lines layers. The usage of `transform: translate3d(0px, 0px, 0px)` acts as a hint for browsers to create an extra layer.'), 'type': 'boolean', 'default': false }, 'editor.disableMonospaceOptimizations': { - 'description': 'Controls whether to enable optimizations for monospace fonts.', + 'description': nls.localize('theia/editor/disableMonospaceOptimizations', 'Controls whether to enable optimizations for monospace fonts.'), 'type': 'boolean', 'default': false }, 'editor.dragAndDrop': { - 'description': 'Controls whether the editor should allow moving selections via drag and drop.', + 'description': nls.localize('vscode/editorOptions/dragAndDrop', 'Controls whether the editor should allow moving selections via drag and drop.'), 'type': 'boolean', 'default': true }, 'editor.emptySelectionClipboard': { - 'description': 'Controls whether copying without a selection copies the current line.', + 'description': nls.localize('vscode/editorOptions/emptySelectionClipboard', 'Controls whether copying without a selection copies the current line.'), 'type': 'boolean', 'default': true }, 'editor.extraEditorClassName': { - 'description': 'Additional class name to be added to the editor.', + 'description': nls.localize('theia/editor/extraEditorClassName', 'Additional class name to be added to the editor.'), 'type': 'string', 'default': '' }, 'editor.fastScrollSensitivity': { - 'markdownDescription': 'Scrolling speed multiplier when pressing `Alt`.', + 'markdownDescription': nls.localize('vscode/editorOptions/fastScrollSensitivity', 'Scrolling speed multiplier when pressing `Alt`.'), 'type': 'number', 'default': 5 }, 'editor.find.cursorMoveOnType': { - 'description': 'Controls whether the cursor should jump to find matches while typing.', + 'description': nls.localize('vscode/editorOptions/find.cursorMoveOnType', 'Controls whether the cursor should jump to find matches while typing.'), 'type': 'boolean', 'default': true }, 'editor.find.seedSearchStringFromSelection': { 'type': 'boolean', 'default': true, - 'description': 'Controls whether the search string in the Find Widget is seeded from the editor selection.' + 'description': nls.localize('vscode/editorOptions/find.seedSearchStringFromSelection', 'Controls whether the search string in the Find Widget is seeded from the editor selection.') }, 'editor.find.autoFindInSelection': { 'type': 'string', @@ -459,59 +460,63 @@ const codeEditorPreferenceProperties = { ], 'default': 'never', 'enumDescriptions': [ - 'Never turn on Find in selection automatically (default)', - 'Always turn on Find in selection automatically', - 'Turn on Find in selection automatically when multiple lines of content are selected.' + nls.localize('vscode/editorOptions/editor.find.autoFindInSelection.never', 'Never turn on Find in selection automatically (default)'), + nls.localize('vscode/editorOptions/editor.find.autoFindInSelection.always', 'Always turn on Find in selection automatically'), + nls.localize('vscode/editorOptions/editor.find.autoFindInSelection.multiline', 'Turn on Find in selection automatically when multiple lines of content are selected.') ], - 'description': 'Controls whether the find operation is carried out on selected text or the entire file in the editor.' + 'description': nls.localize('vscode/editorOptions/find.autoFindInSelection', 'Controls whether the find operation is carried out on selected text or the entire file in the editor.') }, 'editor.find.globalFindClipboard': { 'type': 'boolean', 'default': false, - 'description': 'Controls whether the Find Widget should read or modify the shared find clipboard on macOS.', + 'description': nls.localize('vscode/editorOptions/find.globalFindClipboard', 'Controls whether the Find Widget should read or modify the shared find clipboard on macOS.'), 'included': isOSX }, 'editor.find.addExtraSpaceOnTop': { 'type': 'boolean', 'default': true, - 'description': 'Controls whether the Find Widget should add extra lines on top of the editor. When true, you can scroll beyond the first line when the Find Widget is visible.' + 'description': nls.localize('vscode/editorOptions/find.addExtraSpaceOnTop', 'Controls whether the Find Widget should add extra lines on top of the editor. When true, you can scroll beyond the first line when the Find Widget is visible.') }, 'editor.find.loop': { 'type': 'boolean', 'default': true, - 'description': 'Controls whether the search automatically restarts from the beginning (or the end) when no further matches can be found.' + 'description': nls.localize('vscode/editorOptions/find.loop', 'Controls whether the search automatically restarts from the beginning (or the end) when no further matches can be found.') }, 'editor.fixedOverflowWidgets': { - 'markdownDescription': 'Controls whether to display overflow widgets as `fixed`.', + 'markdownDescription': nls.localize('theia/editor/fixedOverflowWidgets', 'Controls whether to display overflow widgets as `fixed`.'), 'type': 'boolean', 'default': false, }, 'editor.folding': { - 'description': 'Controls whether the editor has code folding enabled.', + 'description': nls.localize('vscode/editorOptions/folding', 'Controls whether the editor has code folding enabled.'), 'type': 'boolean', 'default': true }, 'editor.foldingStrategy': { - 'markdownDescription': 'Controls the strategy for computing folding ranges. `auto` uses a language specific folding strategy, if available. `indentation` uses the indentation based folding strategy.', + 'markdownDescription': nls.localize('vscode/editorOptions/foldingStrategy', 'Controls the strategy for computing folding ranges. `auto` uses a language specific folding strategy, if available. `indentation` uses the indentation based folding strategy.'), 'type': 'string', 'enum': [ 'auto', 'indentation' ], + 'enumDescriptions': [ + nls.localize('vscode/editorOptions/foldingStrategy.auto', 'Use a language-specific folding strategy if available, else the indentation-based one.'), + nls.localize('vscode/editorOptions/foldingStrategy.indentation', 'Use the indentation-based folding strategy.'), + ], 'default': 'auto' }, 'editor.foldingHighlight': { - 'description': 'Controls whether the editor should highlight folded ranges.', + 'description': nls.localize('vscode/editorOptions/foldingHighlight', 'Controls whether the editor should highlight folded ranges.'), 'type': 'boolean', 'default': true }, 'editor.unfoldOnClickAfterEndOfLine': { - 'description': 'Controls whether clicking on the empty content after a folded line will unfold the line.', + 'description': nls.localize('vscode/editorOptions/unfoldOnClickAfterEndOfLine', 'Controls whether clicking on the empty content after a folded line will unfold the line.'), 'type': 'boolean', 'default': false }, 'editor.fontFamily': { - 'description': 'Controls the font family.', + 'description': nls.localize('vscode/editorOptions/fontFamily', 'Controls the font family.'), 'type': 'string', 'default': EDITOR_FONT_DEFAULTS.fontFamily }, @@ -519,14 +524,14 @@ const codeEditorPreferenceProperties = { 'anyOf': [ { 'type': 'boolean', - 'description': 'Enables/Disables font ligatures.' + 'description': nls.localize('vscode/editorOptions/fontLigatures', 'Enables/Disables font ligatures.') }, { 'type': 'string', - 'description': 'Explicit font-feature-settings.' + 'description': nls.localize('vscode/editorOptions/fontFeatureSettings', 'Explicit font-feature-settings.') } ], - 'description': 'Configures font ligatures.', + 'description': nls.localize('vscode/editorOptions/fontLigaturesGeneral', 'Configures font ligatures.'), 'default': false }, 'editor.fontSize': { @@ -534,7 +539,7 @@ const codeEditorPreferenceProperties = { 'minimum': 6, 'maximum': 100, 'default': EDITOR_FONT_DEFAULTS.fontSize, - 'description': 'Controls the font size in pixels.' + 'description': nls.localize('vscode/editorOptions/fontSize', 'Controls the font size in pixels.') }, 'editor.fontWeight': { 'enum': [ @@ -550,32 +555,32 @@ const codeEditorPreferenceProperties = { '800', '900' ], - 'description': 'Controls the font weight.', + 'description': nls.localize('vscode/editorOptions/fontWeight', 'Controls the font weight.'), 'type': 'string', 'default': EDITOR_FONT_DEFAULTS.fontWeight }, 'editor.formatOnPaste': { - 'description': 'Controls whether the editor should automatically format the pasted content. A formatter must be available and the formatter should be able to format a range in a document.', + 'description': nls.localize('vscode/editorOptions/formatOnPaste', 'Controls whether the editor should automatically format the pasted content. A formatter must be available and the formatter should be able to format a range in a document.'), 'type': 'boolean', 'default': false }, 'editor.formatOnType': { - 'description': 'Controls whether the editor should automatically format the line after typing.', + 'description': nls.localize('vscode/editorOptions/formatOnType', 'Controls whether the editor should automatically format the line after typing.'), 'type': 'boolean', 'default': false }, 'editor.glyphMargin': { - 'description': 'Controls whether the editor should render the vertical glyph margin. Glyph margin is mostly used for debugging.', + 'description': nls.localize('vscode/editorOptions/glyphMargin', 'Controls whether the editor should render the vertical glyph margin. Glyph margin is mostly used for debugging.'), 'type': 'boolean', 'default': true }, 'editor.gotoLocation.multiple': { 'type': 'string', 'default': '', - 'deprecationMessage': 'This setting is deprecated, please use separate settings like `editor.editor.gotoLocation.multipleDefinitions` or `editor.editor.gotoLocation.multipleImplementations` instead.' + 'deprecationMessage': nls.localize('vscode/editorOptions/insertSpaces', 'This setting is deprecated, please use separate settings like `editor.editor.gotoLocation.multipleDefinitions` or `editor.editor.gotoLocation.multipleImplementations` instead.') }, 'editor.gotoLocation.multipleDefinitions': { - 'description': 'Controls the behavior the `Go to Definition`-command when multiple target locations exist.', + 'description': nls.localize('vscode/editorOptions/editor.editor.gotoLocation.multipleDefinitions', 'Controls the behavior the `Go to Definition`-command when multiple target locations exist.'), 'type': 'string', 'enum': [ 'peek', @@ -584,13 +589,13 @@ const codeEditorPreferenceProperties = { ], 'default': 'peek', 'enumDescriptions': [ - 'Show peek view of the results (default)', - 'Go to the primary result and show a peek view', - 'Go to the primary result and enable peek-less navigation to others' + nls.localize('vscode/editorOptions/editor.gotoLocation.multiple.peek', 'Show peek view of the results (default)'), + nls.localize('vscode/editorOptions/editor.gotoLocation.multiple.gotoAndPeek', 'Go to the primary result and show a peek view'), + nls.localize('vscode/editorOptions/editor.gotoLocation.multiple.goto', 'Go to the primary result and enable peek-less navigation to others') ] }, 'editor.gotoLocation.multipleTypeDefinitions': { - 'description': 'Controls the behavior the `Go to Type Definition`-command when multiple target locations exist.', + 'description': nls.localize('vscode/editorOptions/editor.editor.gotoLocation.multipleTypeDefinitions', 'Controls the behavior the `Go to Type Definition`-command when multiple target locations exist.'), 'type': 'string', 'enum': [ 'peek', @@ -599,13 +604,13 @@ const codeEditorPreferenceProperties = { ], 'default': 'peek', 'enumDescriptions': [ - 'Show peek view of the results (default)', - 'Go to the primary result and show a peek view', - 'Go to the primary result and enable peek-less navigation to others' + nls.localize('vscode/editorOptions/editor.gotoLocation.multiple.peek', 'Show peek view of the results (default)'), + nls.localize('vscode/editorOptions/editor.gotoLocation.multiple.gotoAndPeek', 'Go to the primary result and show a peek view'), + nls.localize('vscode/editorOptions/editor.gotoLocation.multiple.goto', 'Go to the primary result and enable peek-less navigation to others') ] }, 'editor.gotoLocation.multipleDeclarations': { - 'description': 'Controls the behavior the `Go to Declaration`-command when multiple target locations exist.', + 'description': nls.localize('vscode/editorOptions/editor.editor.gotoLocation.multipleDeclarations', 'Controls the behavior the `Go to Declaration`-command when multiple target locations exist.'), 'type': 'string', 'enum': [ 'peek', @@ -614,13 +619,13 @@ const codeEditorPreferenceProperties = { ], 'default': 'peek', 'enumDescriptions': [ - 'Show peek view of the results (default)', - 'Go to the primary result and show a peek view', - 'Go to the primary result and enable peek-less navigation to others' + nls.localize('vscode/editorOptions/editor.gotoLocation.multiple.peek', 'Show peek view of the results (default)'), + nls.localize('vscode/editorOptions/editor.gotoLocation.multiple.gotoAndPeek', 'Go to the primary result and show a peek view'), + nls.localize('vscode/editorOptions/editor.gotoLocation.multiple.goto', 'Go to the primary result and enable peek-less navigation to others') ] }, 'editor.gotoLocation.multipleImplementations': { - 'description': 'Controls the behavior the `Go to Implementations`-command when multiple target locations exist.', + 'description': nls.localize('vscode/editorOptions/editor.editor.gotoLocation.multipleImplemenattions', 'Controls the behavior the `Go to Implementations`-command when multiple target locations exist.'), 'type': 'string', 'enum': [ 'peek', @@ -629,13 +634,13 @@ const codeEditorPreferenceProperties = { ], 'default': 'peek', 'enumDescriptions': [ - 'Show peek view of the results (default)', - 'Go to the primary result and show a peek view', - 'Go to the primary result and enable peek-less navigation to others' + nls.localize('vscode/editorOptions/editor.gotoLocation.multiple.peek', 'Show peek view of the results (default)'), + nls.localize('vscode/editorOptions/editor.gotoLocation.multiple.gotoAndPeek', 'Go to the primary result and show a peek view'), + nls.localize('vscode/editorOptions/editor.gotoLocation.multiple.goto', 'Go to the primary result and enable peek-less navigation to others') ] }, 'editor.gotoLocation.multipleReferences': { - 'description': 'Controls the behavior the `Go to References`-command when multiple target locations exist.', + 'description': nls.localize('vscode/editorOptions/editor.editor.gotoLocation.multipleReferences', 'Controls the behavior the `Go to References`-command when multiple target locations exist.'), 'type': 'string', 'enum': [ 'peek', @@ -644,77 +649,77 @@ const codeEditorPreferenceProperties = { ], 'default': 'peek', 'enumDescriptions': [ - 'Show peek view of the results (default)', - 'Go to the primary result and show a peek view', - 'Go to the primary result and enable peek-less navigation to others' + nls.localize('vscode/editorOptions/editor.gotoLocation.multiple.peek', 'Show peek view of the results (default)'), + nls.localize('vscode/editorOptions/editor.gotoLocation.multiple.gotoAndPeek', 'Go to the primary result and show a peek view'), + nls.localize('vscode/editorOptions/editor.gotoLocation.multiple.goto', 'Go to the primary result and enable peek-less navigation to others') ] }, 'editor.gotoLocation.alternativeDefinitionCommand': { 'type': 'string', 'default': 'editor.action.goToReferences', - 'description': 'Alternative command id that is being executed when the result of `Go to Definition` is the current location.' + 'description': nls.localize('vscode/editorOptions/alternativeDefinitionCommand', 'Alternative command id that is being executed when the result of `Go to Definition` is the current location.') }, 'editor.gotoLocation.alternativeTypeDefinitionCommand': { 'type': 'string', 'default': 'editor.action.goToReferences', - 'description': 'Alternative command id that is being executed when the result of `Go to Type Definition` is the current location.' + 'description': nls.localize('vscode/editorOptions/alternativeTypeDefinitionCommand', 'Alternative command id that is being executed when the result of `Go to Type Definition` is the current location.') }, 'editor.gotoLocation.alternativeDeclarationCommand': { 'type': 'string', 'default': 'editor.action.goToReferences', - 'description': 'Alternative command id that is being executed when the result of `Go to Declaration` is the current location.' + 'description': nls.localize('vscode/editorOptions/alternativeDeclarationCommand', 'Alternative command id that is being executed when the result of `Go to Declaration` is the current location.') }, 'editor.gotoLocation.alternativeImplementationCommand': { 'type': 'string', 'default': '', - 'description': 'Alternative command id that is being executed when the result of `Go to Implementation` is the current location.' + 'description': nls.localize('vscode/editorOptions/alternativeImplementationCommand', 'Alternative command id that is being executed when the result of `Go to Implementation` is the current location.') }, 'editor.gotoLocation.alternativeReferenceCommand': { 'type': 'string', 'default': '', - 'description': 'Alternative command id that is being executed when the result of `Go to Reference` is the current location.' + 'description': nls.localize('vscode/editorOptions/alternativeReferenceCommand', 'Alternative command id that is being executed when the result of `Go to Reference` is the current location.') }, 'editor.hideCursorInOverviewRuler': { - 'description': 'Controls whether the cursor should be hidden in the overview ruler.', + 'description': nls.localize('vscode/editorOptions/hideCursorInOverviewRuler', 'Controls whether the cursor should be hidden in the overview ruler.'), 'type': 'boolean', 'default': false }, 'editor.highlightActiveIndentGuide': { - 'description': 'Controls whether the editor should highlight the active indent guide.', + 'description': nls.localize('theia/editor/highlightActiveIndentGuide', 'Controls whether the editor should highlight the active indent guide.'), 'type': 'boolean', 'default': true }, 'editor.hover.enabled': { 'type': 'boolean', 'default': true, - 'description': 'Controls whether the hover is shown.' + 'description': nls.localize('vscode/editorOptions/hover.enabled', 'Controls whether the hover is shown.') }, 'editor.hover.delay': { 'type': 'number', 'default': 300, - 'description': 'Controls the delay in milliseconds after which the hover is shown.' + 'description': nls.localize('vscode/editorOptions/hover.delay', 'Controls the delay in milliseconds after which the hover is shown.') }, 'editor.hover.sticky': { 'type': 'boolean', 'default': true, - 'description': 'Controls whether the hover should remain visible when mouse is moved over it.' + 'description': nls.localize('vscode/editorOptions/hover.sticky', 'Controls whether the hover should remain visible when mouse is moved over it.') }, 'editor.inDiffEditor': { 'type': 'boolean', 'default': true, }, 'editor.letterSpacing': { - 'description': 'Controls the letter spacing in pixels.', + 'description': nls.localize('vscode/editorOptions/letterSpacing', 'Controls the letter spacing in pixels.'), 'type': 'number', 'default': EDITOR_FONT_DEFAULTS.letterSpacing }, 'editor.lightbulb.enabled': { 'type': 'boolean', 'default': true, - 'description': 'Enables the code action lightbulb in the editor.' + 'description': nls.localize('vscode/editorOptions/codeActions', 'Enables the code action lightbulb in the editor.') }, 'editor.lineHeight': { - 'description': 'Controls the line height. Use 0 to compute the line height from the font size.', + 'description': nls.localize('vscode/editorOptions/lineHeight', 'Controls the line height. Use 0 to compute the line height from the font size.'), 'type': 'integer', 'default': EDITOR_FONT_DEFAULTS.lineHeight, 'minimum': 0, @@ -729,33 +734,33 @@ const codeEditorPreferenceProperties = { 'interval' ], 'enumDescriptions': [ - 'Line numbers are not rendered.', - 'Line numbers are rendered as absolute number.', - 'Line numbers are rendered as distance in lines to cursor position.', - 'Line numbers are rendered every 10 lines.' + nls.localize('vscode/editorOptions/lineNumbers.off', 'Line numbers are not rendered.'), + nls.localize('vscode/editorOptions/lineNumbers.on', 'Line numbers are rendered as absolute number.'), + nls.localize('vscode/editorOptions/lineNumbers.relative', 'Line numbers are rendered as distance in lines to cursor position.'), + nls.localize('vscode/editorOptions/lineNumbers.interval', 'Line numbers are rendered every 10 lines.') ], 'default': 'on', - 'description': 'Controls the display of line numbers.' + 'description': nls.localize('vscode/editorOptions/lineNumbers', 'Controls the display of line numbers.') }, 'editor.lineNumbersMinChars': { - 'description': 'Controls the line height. Use 0 to compute the line height from the font size.', + 'description': nls.localize('theia/editor/lineNumbersMinChars', 'Controls the line height. Use 0 to compute the line height from the font size.'), 'type': 'integer', 'default': 5, 'minimum': 1, 'maximum': 300 }, 'editor.linkedEditing': { - 'description': 'Controls whether the editor has linked editing enabled. Depending on the language, related symbols, e.g. HTML tags, are updated while editing.', + 'description': nls.localize('vscode/editorOptions/linkedEditing', 'Controls whether the editor has linked editing enabled. Depending on the language, related symbols, e.g. HTML tags, are updated while editing.'), 'type': 'boolean', 'default': false }, 'editor.links': { - 'description': 'Controls whether the editor should detect links and make them clickable.', + 'description': nls.localize('vscode/editorOptions/links', 'Controls whether the editor should detect links and make them clickable.'), 'type': 'boolean', 'default': true }, 'editor.matchBrackets': { - 'description': 'Highlight matching brackets.', + 'description': nls.localize('vscode/editorOptions/matchBrackets', 'Highlight matching brackets.'), 'type': 'string', 'enum': [ 'always', @@ -767,7 +772,7 @@ const codeEditorPreferenceProperties = { 'editor.minimap.enabled': { 'type': 'boolean', 'default': true, - 'description': 'Controls whether the minimap is shown.' + 'description': nls.localize('vscode/editorOptions/minimap.enabled', 'Controls whether the minimap is shown.') }, 'editor.minimap.side': { 'type': 'string', @@ -776,7 +781,7 @@ const codeEditorPreferenceProperties = { 'right' ], 'default': 'right', - 'description': 'Controls the side where to render the minimap.' + 'description': nls.localize('vscode/editorOptions/minimap.side', 'Controls the side where to render the minimap.') }, 'editor.minimap.showSlider': { 'type': 'string', @@ -785,52 +790,52 @@ const codeEditorPreferenceProperties = { 'mouseover' ], 'default': 'mouseover', - 'description': 'Controls when the minimap slider is shown.' + 'description': nls.localize('vscode/editorOptions/minimap.showSlider', 'Controls when the minimap slider is shown.') }, 'editor.minimap.scale': { 'type': 'number', 'default': 1, 'minimum': 1, 'maximum': 3, - 'description': 'Scale of content drawn in the minimap.' + 'description': nls.localize('vscode/editorOptions/minimap.scale', 'Scale of content drawn in the minimap.') }, 'editor.minimap.renderCharacters': { 'type': 'boolean', 'default': true, - 'description': 'Render the actual characters on a line as opposed to color blocks.' + 'description': nls.localize('vscode/editorOptions/minimap.renderCharacters', 'Render the actual characters on a line as opposed to color blocks.') }, 'editor.minimap.maxColumn': { 'type': 'number', 'default': 120, - 'description': 'Limit the width of the minimap to render at most a certain number of columns.' + 'description': nls.localize('vscode/editorOptions/minimap.maxColumn', 'Limit the width of the minimap to render at most a certain number of columns.') }, 'editor.mouseStyle': { - 'description': 'Controls the mouse pointer style.', + 'description': nls.localize('theia/editor/mouseStyle', 'Controls the mouse pointer style.'), 'type': 'string', 'enum': ['text', 'default', 'copy'], 'default': 'text' }, 'editor.mouseWheelScrollSensitivity': { - 'markdownDescription': 'A multiplier to be used on the `deltaX` and `deltaY` of mouse wheel scroll events.', + 'markdownDescription': nls.localize('vscode/editorOptions/mouseWheelScrollSensitivity', 'A multiplier to be used on the `deltaX` and `deltaY` of mouse wheel scroll events.'), 'type': 'number', 'default': 1 }, 'editor.mouseWheelZoom': { - 'markdownDescription': 'Zoom the font of the editor when using mouse wheel and holding `Ctrl`.', + 'markdownDescription': nls.localize('vscode/editorOptions/mouseWheelZoom', 'Zoom the font of the editor when using mouse wheel and holding `Ctrl`.'), 'type': 'boolean', 'default': false }, 'editor.multiCursorMergeOverlapping': { - 'description': 'Merge multiple cursors when they are overlapping.', + 'description': nls.localize('vscode/editorOptions/multiCursorMergeOverlapping', 'Merge multiple cursors when they are overlapping.'), 'type': 'boolean', 'default': true }, 'editor.multiCursorModifier': { 'markdownEnumDescriptions': [ - 'Maps to `Control` on Windows and Linux and to `Command` on macOS.', - 'Maps to `Alt` on Windows and Linux and to `Option` on macOS.' + nls.localize('vscode/editorOptions/multiCursorModifier.ctrlCmd', 'Maps to `Control` on Windows and Linux and to `Command` on macOS.'), + nls.localize('vscode/editorOptions/multiCursorModifier.alt', 'Maps to `Alt` on Windows and Linux and to `Option` on macOS.') ], - 'markdownDescription': 'The modifier to be used to add multiple cursors with the mouse. The Go To Definition and Open Link mouse gestures will adapt such that they do not conflict with the multicursor modifier. [Read more](https://code.visualstudio.com/docs/editor/codebasics#_multicursor-modifier).', + 'markdownDescription': nls.localize('vscode/editorOptions/multiCursorModifier', 'The modifier to be used to add multiple cursors with the mouse. The Go To Definition and Open Link mouse gestures will adapt such that they do not conflict with the multicursor modifier. [Read more](https://code.visualstudio.com/docs/editor/codebasics#_multicursor-modifier).'), 'type': 'string', 'enum': [ 'ctrlCmd', @@ -840,10 +845,10 @@ const codeEditorPreferenceProperties = { }, 'editor.multiCursorPaste': { 'markdownEnumDescriptions': [ - 'Each cursor pastes a single line of the text.', - 'Each cursor pastes the full text.' + nls.localize('vscode/editorOptions/multiCursorPaste.spread', 'Each cursor pastes a single line of the text.'), + nls.localize('vscode/editorOptions/multiCursorPaste.full', 'Each cursor pastes the full text.') ], - 'markdownDescription': 'Controls pasting when the line count of the pasted text matches the cursor count.', + 'markdownDescription': nls.localize('vscode/editorOptions/multiCursorPaste', 'Controls pasting when the line count of the pasted text matches the cursor count.'), 'type': 'string', 'enum': [ 'spread', @@ -852,12 +857,12 @@ const codeEditorPreferenceProperties = { 'default': 'spread' }, 'editor.occurrencesHighlight': { - 'description': 'Controls whether the editor should highlight semantic symbol occurrences.', + 'description': nls.localize('vscode/editorOptions/occurrencesHighlight', 'Controls whether the editor should highlight semantic symbol occurrences.'), 'type': 'boolean', 'default': true }, 'editor.overviewRulerBorder': { - 'description': 'Controls whether a border should be drawn around the overview ruler.', + 'description': nls.localize('vscode/editorOptions/overviewRulerBorder', 'Controls whether a border should be drawn around the overview ruler.'), 'type': 'boolean', 'default': true }, @@ -866,38 +871,38 @@ const codeEditorPreferenceProperties = { 'default': 3, 'minimum': 0, 'maximum': 3, - 'description': 'The number of vertical lanes the overview ruler should render.' + 'description': nls.localize('theia/editor/overviewRulerLanes', 'The number of vertical lanes the overview ruler should render.') }, 'editor.padding.top': { 'type': 'number', 'default': 0, 'minimum': 0, 'maximum': 1000, - 'description': 'Controls the amount of space between the top edge of the editor and the first line.' + 'description': nls.localize('vscode/editorOptions/padding.top', 'Controls the amount of space between the top edge of the editor and the first line.') }, 'editor.padding.bottom': { 'type': 'number', 'default': 0, 'minimum': 0, 'maximum': 1000, - 'description': 'Controls the amount of space between the bottom edge of the editor and the last line.' + 'description': nls.localize('vscode/editorOptions/padding.bottom', 'Controls the amount of space between the bottom edge of the editor and the last line.') }, 'editor.parameterHints.enabled': { 'type': 'boolean', 'default': true, - 'description': 'Enables a pop-up that shows parameter documentation and type information as you type.' + 'description': nls.localize('vscode/editorOptions/parameterHints.enabled', 'Enables a pop-up that shows parameter documentation and type information as you type.') }, 'editor.parameterHints.cycle': { 'type': 'boolean', 'default': false, - 'description': 'Controls whether the parameter hints menu cycles or closes when reaching the end of the list.' + 'description': nls.localize('vscode/editorOptions/parameterHints.cycle', 'Controls whether the parameter hints menu cycles or closes when reaching the end of the list.') }, 'editor.peekWidgetDefaultFocus': { 'enumDescriptions': [ - 'Focus the tree when opening peek', - 'Focus the editor when opening peek' + nls.localize('vscode/editorOptions/peekWidgetDefaultFocus.tree', 'Focus the tree when opening peek'), + nls.localize('vscode/editorOptions/peekWidgetDefaultFocus.editor', 'Focus the editor when opening peek') ], - 'description': 'Controls whether to focus the inline editor or the tree in the peek widget.', + 'description': nls.localize('vscode/editorOptions/peekWidgetDefaultFocus', 'Controls whether to focus the inline editor or the tree in the peek widget.'), 'type': 'string', 'enum': [ 'tree', @@ -908,7 +913,7 @@ const codeEditorPreferenceProperties = { 'editor.definitionLinkOpensInPeek': { 'type': 'boolean', 'default': false, - 'description': 'Controls whether the Go to Definition mouse gesture always opens the peek widget.' + 'description': nls.localize('vscode/editorOptions/definitionLinkOpensInPeek', 'Controls whether the Go to Definition mouse gesture always opens the peek widget.') }, 'editor.quickSuggestions': { 'anyOf': [ @@ -921,17 +926,17 @@ const codeEditorPreferenceProperties = { 'strings': { 'type': 'boolean', 'default': false, - 'description': 'Enable quick suggestions inside strings.' + 'description': nls.localize('vscode/editorOptions/quickSuggestions.strings', 'Enable quick suggestions inside strings.') }, 'comments': { 'type': 'boolean', 'default': false, - 'description': 'Enable quick suggestions inside comments.' + 'description': nls.localize('vscode/editorOptions/quickSuggestions.comments', 'Enable quick suggestions inside comments.') }, 'other': { 'type': 'boolean', 'default': true, - 'description': 'Enable quick suggestions outside of strings and comments.' + 'description': nls.localize('vscode/editorOptions/quickSuggestions.other', 'Enable quick suggestions outside of strings and comments.') } } } @@ -941,37 +946,37 @@ const codeEditorPreferenceProperties = { 'comments': false, 'strings': false }, - 'description': 'Controls whether suggestions should automatically show up while typing.' + 'description': nls.localize('vscode/editorOptions/quickSuggestions', 'Controls whether suggestions should automatically show up while typing.') }, 'editor.quickSuggestionsDelay': { - 'description': 'Controls the delay in milliseconds after which quick suggestions will show up.', + 'description': nls.localize('vscode/editorOptions/quickSuggestionsDelay', 'Controls the delay in milliseconds after which quick suggestions will show up.'), 'type': 'integer', 'default': 10, 'minimum': 0, 'maximum': 1073741824 }, 'editor.readOnly': { - 'description': 'Controls whether the editor is readonly.', + 'description': nls.localize('theia/editor/readOnly', 'Controls whether the editor is readonly.'), 'type': 'boolean', 'default': false }, 'editor.rename.enablePreview': { - 'description': 'Controls whether the editor should display refactor preview pane for rename.', + 'description': nls.localize('vscode/rename/enablePreview', 'Controls whether the editor should display refactor preview pane for rename.'), 'type': 'boolean', 'default': true }, 'editor.renderControlCharacters': { - 'description': 'Controls whether the editor should render control characters.', + 'description': nls.localize('vscode/editorOptions/renderControlCharacters', 'Controls whether the editor should render control characters.'), 'type': 'boolean', 'default': false }, 'editor.renderIndentGuides': { - 'description': 'Controls whether the editor should render indent guides.', + 'description': nls.localize('vscode/editorOptions/editor.guides.indentation', 'Controls whether the editor should render indent guides.'), 'type': 'boolean', 'default': true }, 'editor.renderFinalNewline': { - 'description': 'Render last line number when the file ends with a newline.', + 'description': nls.localize('vscode/editorOptions/renderFinalNewline', 'Render last line number when the file ends with a newline.'), 'type': 'boolean', 'default': true }, @@ -980,9 +985,9 @@ const codeEditorPreferenceProperties = { '', '', '', - 'Highlights both the gutter and the current line.' + nls.localize('vscode/editorOptions/renderLineHighlight.all', 'Highlights both the gutter and the current line.') ], - 'description': 'Controls how the editor should render the current line highlight.', + 'description': nls.localize('vscode/editorOptions/renderLineHighlight', 'Controls how the editor should render the current line highlight.'), 'type': 'string', 'enum': [ 'none', @@ -993,12 +998,12 @@ const codeEditorPreferenceProperties = { 'default': 'line' }, 'editor.renderLineHighlightOnlyWhenFocus': { - 'description': 'Controls if the editor should render the current line highlight only when the editor is focused.', + 'description': nls.localize('vscode/editorOptions/renderLineHighlightOnlyWhenFocus', 'Controls if the editor should render the current line highlight only when the editor is focused.'), 'type': 'boolean', 'default': false }, 'editor.renderValidationDecorations': { - 'description': 'Controls whether the editor renders validation decorations.', + 'description': nls.localize('theia/editor/renderValidationDecorations', 'Controls whether the editor renders validation decorations.'), 'type': 'string', 'enum': ['editable', 'on', 'off'], 'default': 'editable' @@ -1006,29 +1011,31 @@ const codeEditorPreferenceProperties = { 'editor.renderWhitespace': { 'enumDescriptions': [ '', - 'Render whitespace characters except for single spaces between words.', - 'Render whitespace characters only on selected text.', + nls.localize('vscode/editorOptions/renderWhitespace.boundary', 'Render whitespace characters except for single spaces between words.'), + nls.localize('vscode/editorOptions/renderWhitespace.selection', 'Render whitespace characters only on selected text.'), + nls.localize('vscode/editorOptions/renderWhitespace.trailing', 'Render only trailing whitespace characters.'), '' ], - 'description': 'Controls how the editor should render whitespace characters.', + 'description': nls.localize('vscode/editorOptions/renderWhitespace', 'Controls how the editor should render whitespace characters.'), 'type': 'string', 'enum': [ 'none', 'boundary', 'selection', + 'trailin', 'all' ], 'default': 'none' }, 'editor.revealHorizontalRightPadding': { - 'description': 'When revealing the cursor, a virtual padding (px) is added to the cursor, turning it into a rectangle. This virtual padding ensures that the cursor gets revealed before hitting the edge of the viewport.', + 'description': nls.localize('theia/editor/revealHorizontalRightPadding', 'When revealing the cursor, a virtual padding (px) is added to the cursor, turning it into a rectangle. This virtual padding ensures that the cursor gets revealed before hitting the edge of the viewport.'), 'type': 'integer', 'default': 30, 'minimum': 0, 'maximum': 1000 }, 'editor.roundedSelection': { - 'description': 'Controls whether selections should have rounded corners.', + 'description': nls.localize('vscode/editorOptions/roundedSelection', 'Controls whether selections should have rounded corners.'), 'type': 'boolean', 'default': true }, @@ -1038,83 +1045,87 @@ const codeEditorPreferenceProperties = { 'type': 'number' }, 'default': [], - 'description': 'Render vertical rulers after a certain number of monospace characters. Use multiple values for multiple rulers. No rulers are drawn if array is empty.' + 'description': nls.localize('vscode/editorOptions/rulers', 'Render vertical rulers after a certain number of monospace characters. Use multiple values for multiple rulers. No rulers are drawn if array is empty.') }, 'editor.scrollBeyondLastColumn': { - 'description': 'Controls the number of extra characters beyond which the editor will scroll horizontally.', + 'description': nls.localize('vscode/editorOptions/scrollBeyondLastColumn', 'Controls the number of extra characters beyond which the editor will scroll horizontally.'), 'type': 'integer', 'default': 5, 'minimum': 0, 'maximum': 1073741824 }, 'editor.scrollBeyondLastLine': { - 'description': 'Controls whether the editor will scroll beyond the last line.', + 'description': nls.localize('vscode/editorOptions/scrollBeyondLastLine', 'Controls whether the editor will scroll beyond the last line.'), 'type': 'boolean', 'default': true }, 'editor.scrollPredominantAxis': { - 'description': 'Scroll only along the predominant axis when scrolling both vertically and horizontally at the same time. Prevents horizontal drift when scrolling vertically on a trackpad.', + 'description': nls.localize('vscode/editorOptions/scrollPredominantAxis', 'Scroll only along the predominant axis when scrolling both vertically and horizontally at the same time. Prevents horizontal drift when scrolling vertically on a trackpad.'), 'type': 'boolean', 'default': true }, 'editor.selectionClipboard': { - 'description': 'Controls whether the Linux primary clipboard should be supported.', + 'description': nls.localize('vscode/editorOptions/selectionClipboard', 'Controls whether the Linux primary clipboard should be supported.'), 'included': platform.isLinux, 'type': 'boolean', 'default': true }, 'editor.selectionHighlight': { - 'description': 'Controls whether the editor should highlight matches similar to the selection.', + 'description': nls.localize('vscode/editorOptions/selectionHighlight', 'Controls whether the editor should highlight matches similar to the selection.'), 'type': 'boolean', 'default': true }, 'editor.selectOnLineNumbers': { - 'description': 'Controls whether to select the corresponding line when clicking on the line number', + 'description': nls.localize('vscode/editorOptions/selectOnLineNumbers', 'Controls whether to select the corresponding line when clicking on the line number'), 'type': 'boolean', 'default': true }, 'editor.showFoldingControls': { - 'description': 'Controls whether the fold controls on the gutter are automatically hidden.', + 'description': nls.localize('vscode/editorOptions/showFoldingControls', 'Controls whether the fold controls on the gutter are automatically hidden.'), 'type': 'string', 'enum': [ 'always', 'mouseover' ], + 'enumDescriptions': [ + nls.localize('vscode/editorOptions/showFoldingControls.always', 'Always show the folding controls.'), + nls.localize('vscode/editorOptions/showFoldingControls.mouseover', 'Only show the folding controls when the mouse is over the gutter.'), + ], 'default': 'mouseover' }, 'editor.showUnused': { - 'description': 'Controls fading out of unused code.', + 'description': nls.localize('vscode/editorOptions/showUnused', 'Controls fading out of unused code.'), 'type': 'boolean', 'default': true }, 'editor.showDeprecated': { - 'description': 'Controls strikethrough deprecated variables.', + 'description': nls.localize('vscode/editorOptions/showDeprecated', 'Controls strikethrough deprecated variables.'), 'type': 'boolean', 'default': true }, 'editor.inlineHints.enabled': { 'type': 'boolean', 'default': true, - 'description': 'Enables the inline hints in the editor.' + 'description': nls.localize('vscode/editorOptions/editor.inlayHints.enabled', 'Enables the inline hints in the editor.') }, 'editor.inlineHints.fontSize': { 'type': 'number', 'default': EDITOR_FONT_DEFAULTS.fontSize, - description: 'Controls font size of inline hints in the editor. When set to `0`, the 90% of `#editor.fontSize#` is used.' + description: nls.localize('vscode/editorOptions/editor.inlayHints.fontSize', 'Controls font size of inline hints in the editor. When set to `0`, the 90% of `#editor.fontSize#` is used.') }, 'editor.inlineHints.fontFamily': { 'type': 'string', 'default': EDITOR_FONT_DEFAULTS.fontFamily, - 'description': 'Controls font family of inline hints in the editor.' + 'description': nls.localize('vscode/editorOptions/inlayHints.fontFamily', 'Controls font family of inline hints in the editor.') }, 'editor.snippetSuggestions': { 'enumDescriptions': [ - 'Show snippet suggestions on top of other suggestions.', - 'Show snippet suggestions below other suggestions.', - 'Show snippets suggestions with other suggestions.', - 'Do not show snippet suggestions.' + nls.localize('vscode/editorOptions/snippetSuggestions.top', 'Show snippet suggestions on top of other suggestions.'), + nls.localize('vscode/editorOptions/snippetSuggestions.bottom', 'Show snippet suggestions below other suggestions.'), + nls.localize('vscode/editorOptions/snippetSuggestions.inline', 'Show snippets suggestions with other suggestions.'), + nls.localize('vscode/editorOptions/snippetSuggestions.none', 'Do not show snippet suggestions.') ], - 'description': 'Controls whether snippets are shown with other suggestions and how they are sorted.', + 'description': nls.localize('vscode/editorOptions/snippetSuggestions', 'Controls whether snippets are shown with other suggestions and how they are sorted.'), 'type': 'string', 'enum': [ 'top', @@ -1125,22 +1136,22 @@ const codeEditorPreferenceProperties = { 'default': 'inline' }, 'editor.smartSelect.selectLeadingAndTrailingWhitespace': { - 'description': 'Whether leading and trailing whitespace should always be selected.', + 'description': nls.localize('vscode/editorOptions/selectLeadingAndTrailingWhitespace', 'Whether leading and trailing whitespace should always be selected.'), 'default': true, 'type': 'boolean' }, 'editor.smoothScrolling': { - 'description': 'Controls whether the editor will scroll using an animation.', + 'description': nls.localize('vscode/editorOptions/smoothScrolling', 'Controls whether the editor will scroll using an animation.'), 'type': 'boolean', 'default': false }, 'editor.stickyTabStops': { - 'description': 'Emulate selection behaviour of tab characters when using spaces for indentation. Selection will stick to tab stops.', + 'description': nls.localize('vscode/editorOptions/stickyTabStops', 'Emulate selection behaviour of tab characters when using spaces for indentation. Selection will stick to tab stops.'), 'type': 'boolean', 'default': false }, 'editor.stopRenderingLineAfter': { - 'description': 'Performance guard: Stop rendering a line after x characters.', + 'description': nls.localize('theia/editor/stopRenderingLineAfter', 'Performance guard: Stop rendering a line after x characters.'), 'type': 'integer', 'default': 10000, 'minimum': -1, @@ -1153,215 +1164,215 @@ const codeEditorPreferenceProperties = { 'replace' ], 'enumDescriptions': [ - 'Insert suggestion without overwriting text right of the cursor.', - 'Insert suggestion and overwrite text right of the cursor.' + nls.localize('vscode/editorOptions/suggest.insertMode.insert', 'Insert suggestion without overwriting text right of the cursor.'), + nls.localize('vscode/editorOptions/suggest.insertMode.replace', 'Insert suggestion and overwrite text right of the cursor.') ], 'default': 'insert', - 'description': 'Controls whether words are overwritten when accepting completions. Note that this depends on extensions opting into this feature.' + 'description': nls.localize('vscode/editorOptions/suggest.insertMode', 'Controls whether words are overwritten when accepting completions. Note that this depends on extensions opting into this feature.') }, 'editor.suggest.insertHighlight': { 'type': 'boolean', 'default': false, - 'description': 'Controls whether unexpected text modifications while accepting completions should be highlighted, e.g `insertMode` is `replace` but the completion only supports `insert`.' + 'description': nls.localize('theia/editor/suggest.insertHighlight', 'Controls whether unexpected text modifications while accepting completions should be highlighted, e.g `insertMode` is `replace` but the completion only supports `insert`.') }, 'editor.suggest.filterGraceful': { 'type': 'boolean', 'default': true, - 'description': 'Controls whether filtering and sorting suggestions accounts for small typos.' + 'description': nls.localize('vscode/editorOptions/suggest.filterGraceful', 'Controls whether filtering and sorting suggestions accounts for small typos.') }, 'editor.suggest.localityBonus': { 'type': 'boolean', 'default': false, - 'description': 'Controls whether sorting favours words that appear close to the cursor.' + 'description': nls.localize('vscode/editorOptions/suggest.localityBonus', 'Controls whether sorting favours words that appear close to the cursor.') }, 'editor.suggest.shareSuggestSelections': { 'type': 'boolean', 'default': false, - 'markdownDescription': 'Controls whether remembered suggestion selections are shared between multiple workspaces and windows (needs `#editor.suggestSelection#`).' + 'markdownDescription': nls.localize('vscode/editorOptions/suggest.shareSuggestSelections', 'Controls whether remembered suggestion selections are shared between multiple workspaces and windows (needs `#editor.suggestSelection#`).') }, 'editor.suggest.snippetsPreventQuickSuggestions': { 'type': 'boolean', 'default': true, - 'description': 'Controls whether an active snippet prevents quick suggestions.' + 'description': nls.localize('vscode/editorOptions/suggest.snippetsPreventQuickSuggestions', 'Controls whether an active snippet prevents quick suggestions.') }, 'editor.suggest.showIcons': { 'type': 'boolean', 'default': true, - 'description': 'Controls whether to show or hide icons in suggestions.' + 'description': nls.localize('vscode/editorOptions/suggest.showIcons', 'Controls whether to show or hide icons in suggestions.') }, 'editor.suggest.maxVisibleSuggestions': { 'type': 'number', 'default': 12, 'minimum': 1, 'maximum': 15, - 'description': 'Controls how many suggestions IntelliSense will show before showing a scrollbar (maximum 15).' + 'description': nls.localize('vscode/editorOptions/suggest.maxVisibleSuggestions.dep', 'Controls how many suggestions IntelliSense will show before showing a scrollbar (maximum 15).') }, 'editor.suggest.filteredTypes': { 'type': 'object', 'default': {}, - 'deprecationMessage': 'This setting is deprecated, please use separate settings like `editor.suggest.showKeywords` or `editor.suggest.showSnippets` instead.' + 'deprecationMessage': nls.localize('vscode/editorOptions/deprecated', 'This setting is deprecated, please use separate settings like `editor.suggest.showKeywords` or `editor.suggest.showSnippets` instead.') }, 'editor.suggest.showMethods': { 'type': 'boolean', 'default': true, - 'markdownDescription': 'When enabled IntelliSense shows `method`-suggestions.' + 'markdownDescription': nls.localize('vscode/editorOptions/editor.suggest.showMethods', 'When enabled IntelliSense shows `method`-suggestions.') }, 'editor.suggest.showFunctions': { 'type': 'boolean', 'default': true, - 'markdownDescription': 'When enabled IntelliSense shows `function`-suggestions.' + 'markdownDescription': nls.localize('vscode/editorOptions/editor.suggest.showFunctions', 'When enabled IntelliSense shows `function`-suggestions.') }, 'editor.suggest.showConstructors': { 'type': 'boolean', 'default': true, - 'markdownDescription': 'When enabled IntelliSense shows `constructor`-suggestions.' + 'markdownDescription': nls.localize('vscode/editorOptions/editor.suggest.showConstructors', 'When enabled IntelliSense shows `constructor`-suggestions.') }, 'editor.suggest.showFields': { 'type': 'boolean', 'default': true, - 'markdownDescription': 'When enabled IntelliSense shows `field`-suggestions.' + 'markdownDescription': nls.localize('vscode/editorOptions/editor.suggest.showFields', 'When enabled IntelliSense shows `field`-suggestions.') }, 'editor.suggest.showVariables': { 'type': 'boolean', 'default': true, - 'markdownDescription': 'When enabled IntelliSense shows `variable`-suggestions.' + 'markdownDescription': nls.localize('vscode/editorOptions/editor.suggest.showVariables', 'When enabled IntelliSense shows `variable`-suggestions.') }, 'editor.suggest.showClasses': { 'type': 'boolean', 'default': true, - 'markdownDescription': 'When enabled IntelliSense shows `class`-suggestions.' + 'markdownDescription': nls.localize('vscode/editorOptions/editor.suggest.showClasss', 'When enabled IntelliSense shows `class`-suggestions.') }, 'editor.suggest.showStructs': { 'type': 'boolean', 'default': true, - 'markdownDescription': 'When enabled IntelliSense shows `struct`-suggestions.' + 'markdownDescription': nls.localize('vscode/editorOptions/editor.suggest.showStructs', 'When enabled IntelliSense shows `struct`-suggestions.') }, 'editor.suggest.showInterfaces': { 'type': 'boolean', 'default': true, - 'markdownDescription': 'When enabled IntelliSense shows `interface`-suggestions.' + 'markdownDescription': nls.localize('vscode/editorOptions/editor.suggest.showInterfaces', 'When enabled IntelliSense shows `interface`-suggestions.') }, 'editor.suggest.showModules': { 'type': 'boolean', 'default': true, - 'markdownDescription': 'When enabled IntelliSense shows `module`-suggestions.' + 'markdownDescription': nls.localize('vscode/editorOptions/editor.suggest.showModules', 'When enabled IntelliSense shows `module`-suggestions.') }, 'editor.suggest.showProperties': { 'type': 'boolean', 'default': true, - 'markdownDescription': 'When enabled IntelliSense shows `property`-suggestions.' + 'markdownDescription': nls.localize('vscode/editorOptions/editor.suggest.showPropertys', 'When enabled IntelliSense shows `property`-suggestions.') }, 'editor.suggest.showEvents': { 'type': 'boolean', 'default': true, - 'markdownDescription': 'When enabled IntelliSense shows `event`-suggestions.' + 'markdownDescription': nls.localize('vscode/editorOptions/editor.suggest.showEvents', 'When enabled IntelliSense shows `event`-suggestions.') }, 'editor.suggest.showOperators': { 'type': 'boolean', 'default': true, - 'markdownDescription': 'When enabled IntelliSense shows `operator`-suggestions.' + 'markdownDescription': nls.localize('vscode/editorOptions/editor.suggest.showOperators', 'When enabled IntelliSense shows `operator`-suggestions.') }, 'editor.suggest.showUnits': { 'type': 'boolean', 'default': true, - 'markdownDescription': 'When enabled IntelliSense shows `unit`-suggestions.' + 'markdownDescription': nls.localize('vscode/editorOptions/editor.suggest.showUnits', 'When enabled IntelliSense shows `unit`-suggestions.') }, 'editor.suggest.showValues': { 'type': 'boolean', 'default': true, - 'markdownDescription': 'When enabled IntelliSense shows `value`-suggestions.' + 'markdownDescription': nls.localize('vscode/editorOptions/editor.suggest.showValues', 'When enabled IntelliSense shows `value`-suggestions.') }, 'editor.suggest.showConstants': { 'type': 'boolean', 'default': true, - 'markdownDescription': 'When enabled IntelliSense shows `constant`-suggestions.' + 'markdownDescription': nls.localize('vscode/editorOptions/editor.suggest.showConstants', 'When enabled IntelliSense shows `constant`-suggestions.') }, 'editor.suggest.showEnums': { 'type': 'boolean', 'default': true, - 'markdownDescription': 'When enabled IntelliSense shows `enum`-suggestions.' + 'markdownDescription': nls.localize('vscode/editorOptions/editor.suggest.showEnums', 'When enabled IntelliSense shows `enum`-suggestions.') }, 'editor.suggest.showEnumMembers': { 'type': 'boolean', 'default': true, - 'markdownDescription': 'When enabled IntelliSense shows `enumMember`-suggestions.' + 'markdownDescription': nls.localize('vscode/editorOptions/editor.suggest.showEnumMembers', 'When enabled IntelliSense shows `enumMember`-suggestions.') }, 'editor.suggest.showKeywords': { 'type': 'boolean', 'default': true, - 'markdownDescription': 'When enabled IntelliSense shows `keyword`-suggestions.' + 'markdownDescription': nls.localize('vscode/editorOptions/editor.suggest.showKeywords', 'When enabled IntelliSense shows `keyword`-suggestions.') }, 'editor.suggest.showWords': { 'type': 'boolean', 'default': true, - 'markdownDescription': 'When enabled IntelliSense shows `text`-suggestions.' + 'markdownDescription': nls.localize('vscode/editorOptions/editor.suggest.showTexts', 'When enabled IntelliSense shows `text`-suggestions.') }, 'editor.suggest.showColors': { 'type': 'boolean', 'default': true, - 'markdownDescription': 'When enabled IntelliSense shows `color`-suggestions.' + 'markdownDescription': nls.localize('vscode/editorOptions/editor.suggest.showColors', 'When enabled IntelliSense shows `color`-suggestions.') }, 'editor.suggest.showFiles': { 'type': 'boolean', 'default': true, - 'markdownDescription': 'When enabled IntelliSense shows `file`-suggestions.' + 'markdownDescription': nls.localize('vscode/editorOptions/editor.suggest.showFiles', 'When enabled IntelliSense shows `file`-suggestions.') }, 'editor.suggest.showReferences': { 'type': 'boolean', 'default': true, - 'markdownDescription': 'When enabled IntelliSense shows `reference`-suggestions.' + 'markdownDescription': nls.localize('vscode/editorOptions/editor.suggest.showReferences', 'When enabled IntelliSense shows `reference`-suggestions.') }, 'editor.suggest.showCustomcolors': { 'type': 'boolean', 'default': true, - 'markdownDescription': 'When enabled IntelliSense shows `customcolor`-suggestions.' + 'markdownDescription': nls.localize('vscode/editorOptions/editor.suggest.showCustomcolors', 'When enabled IntelliSense shows `customcolor`-suggestions.') }, 'editor.suggest.showFolders': { 'type': 'boolean', 'default': true, - 'markdownDescription': 'When enabled IntelliSense shows `folder`-suggestions.' + 'markdownDescription': nls.localize('vscode/editorOptions/ineditor.suggest.showFolderssertSpaces', 'When enabled IntelliSense shows `folder`-suggestions.') }, 'editor.suggest.showTypeParameters': { 'type': 'boolean', 'default': true, - 'markdownDescription': 'When enabled IntelliSense shows `typeParameter`-suggestions.' + 'markdownDescription': nls.localize('vscode/editorOptions/editor.suggest.showTypeParameters', 'When enabled IntelliSense shows `typeParameter`-suggestions.') }, 'editor.suggest.showSnippets': { 'type': 'boolean', 'default': true, - 'markdownDescription': 'When enabled IntelliSense shows `snippet`-suggestions.' + 'markdownDescription': nls.localize('vscode/editorOptions/editor.suggest.showSnippets', 'When enabled IntelliSense shows `snippet`-suggestions.') }, 'editor.suggest.hideStatusBar': { 'type': 'boolean', 'default': true, - 'markdownDescription': 'Controls the visibility of the status bar at the bottom of the suggest widget.' + 'markdownDescription': nls.localize('vscode/editorOptions/suggest.showStatusBar', 'Controls the visibility of the status bar at the bottom of the suggest widget.') }, 'editor.suggestFontSize': { - 'markdownDescription': 'Font size for the suggest widget. When set to `0`, the value of `#editor.fontSize#` is used.', + 'markdownDescription': nls.localize('vscode/editorOptions/suggestFontSize', 'Font size for the suggest widget. When set to `0`, the value of `#editor.fontSize#` is used.'), 'type': 'integer', 'default': 0, 'minimum': 0, 'maximum': 1000 }, 'editor.suggestLineHeight': { - 'markdownDescription': 'Line height for the suggest widget. When set to `0`, the value of `#editor.lineHeight#` is used.', + 'markdownDescription': nls.localize('vscode/editorOptions/suggestLineHeight', 'Line height for the suggest widget. When set to `0`, the value of `#editor.lineHeight#` is used.'), 'type': 'integer', 'default': 0, 'minimum': 0, 'maximum': 1000 }, 'editor.suggestOnTriggerCharacters': { - 'description': 'Controls whether suggestions should automatically show up when typing trigger characters.', + 'description': nls.localize('vscode/editorOptions/suggestOnTriggerCharacters', 'Controls whether suggestions should automatically show up when typing trigger characters.'), 'type': 'boolean', 'default': true }, 'editor.suggestSelection': { 'markdownEnumDescriptions': [ - 'Always select the first suggestion.', - 'Select recent suggestions unless further typing selects one, e.g. `console.| -> console.log` because `log` has been completed recently.', - 'Select suggestions based on previous prefixes that have completed those suggestions, e.g. `co -> console` and `con -> const`.' + nls.localize('vscode/editorOptions/suggestSelection.first', 'Always select the first suggestion.'), + nls.localize('vscode/editorOptions/suggestSelection.recentlyUsed', 'Select recent suggestions unless further typing selects one, e.g. `console.| -> console.log` because `log` has been completed recently.'), + nls.localize('vscode/editorOptions/suggestSelection.recentlyUsedByPrefix', 'Select suggestions based on previous prefixes that have completed those suggestions, e.g. `co -> console` and `con -> const`.') ], - 'description': 'Controls how suggestions are pre-selected when showing the suggest list.', + 'description': nls.localize('vscode/editorOptions/suggestSelection', 'Controls how suggestions are pre-selected when showing the suggest list.'), 'type': 'string', 'enum': [ 'first', @@ -1372,11 +1383,11 @@ const codeEditorPreferenceProperties = { }, 'editor.tabCompletion': { 'enumDescriptions': [ - 'Tab complete will insert the best matching suggestion when pressing tab.', - 'Disable tab completions.', - 'Tab complete snippets when their prefix match. Works best when `quickSuggestions` aren\'t enabled.' + nls.localize('vscode/editorOptions/tabCompletion.on', 'Tab complete will insert the best matching suggestion when pressing tab.'), + nls.localize('vscode/editorOptions/tabCompletion.off', 'Disable tab completions.'), + nls.localize('vscode/editorOptions/tabCompletion.onlySnippets', 'Tab complete snippets when their prefix match. Works best when `quickSuggestions` aren\'t enabled.') ], - 'description': 'Enables tab completions.', + 'description': nls.localize('vscode/editorOptions/tabCompletion', 'Enables tab completions.'), 'type': 'string', 'enum': [ 'on', @@ -1386,7 +1397,7 @@ const codeEditorPreferenceProperties = { 'default': 'off' }, 'editor.tabIndex': { - 'markdownDescription': 'Controls the wrapping column of the editor when `#editor.wordWrap#` is `wordWrapColumn` or `bounded`.', + 'markdownDescription': nls.localize('theia/editor/tabIndex', 'Controls the wrapping column of the editor when `#editor.wordWrap#` is `wordWrapColumn` or `bounded`.'), 'type': 'integer', 'default': 0, 'minimum': -1, @@ -1394,33 +1405,33 @@ const codeEditorPreferenceProperties = { }, 'editor.unusualLineTerminators': { 'markdownEnumDescriptions': [ - 'Unusual line terminators are automatically removed.', - 'Unusual line terminators are ignored.', - 'Unusual line terminators prompt to be removed.' + nls.localize('unusualLineTerminators.auto', 'Unusual line terminators are automatically removed.'), + nls.localize('unusualLineTerminators.off', 'Unusual line terminators are ignored.'), + nls.localize('unusualLineTerminators.prompt', 'Unusual line terminators prompt to be removed.') ], - 'description': 'Remove unusual line terminators that might cause problems.', + 'description': nls.localize('vscode/editorOptions/unusualLineTerminators', 'Remove unusual line terminators that might cause problems.'), 'type': 'string', 'enum': ['auto', 'off', 'prompt'], 'default': 'prompt' }, 'editor.useTabStops': { - 'description': 'Inserting and deleting whitespace follows tab stops.', + 'description': nls.localize('vscode/editorOptions/useTabStops', 'Inserting and deleting whitespace follows tab stops.'), 'type': 'boolean', 'default': true }, 'editor.wordSeparators': { - 'description': 'Characters that will be used as word separators when doing word related navigations or operations.', + 'description': nls.localize('vscode/editorOptions/wordSeparators', 'Characters that will be used as word separators when doing word related navigations or operations.'), 'type': 'string', 'default': DEFAULT_WORD_SEPARATORS }, 'editor.wordWrap': { 'markdownEnumDescriptions': [ - 'Lines will never wrap.', - 'Lines will wrap at the viewport width.', - 'Lines will wrap at `#editor.wordWrapColumn#`.', - 'Lines will wrap at the minimum of viewport and `#editor.wordWrapColumn#`.' + nls.localize('vscode/editorOptions/wordWrap.off', 'Lines will never wrap.'), + nls.localize('vscode/editorOptions/wordWrap.on', 'Lines will wrap at the viewport width.'), + nls.localize('vscode/editorOptions/wordWrap.wordWrapColumn', 'Lines will wrap at `#editor.wordWrapColumn#`.'), + nls.localize('vscode/editorOptions/wordWrap.bounded', 'Lines will wrap at the minimum of viewport and `#editor.wordWrapColumn#`.') ], - 'description': 'Controls how lines should wrap.', + 'description': nls.localize('vscode/editorOptions/wordWrap', 'Controls how lines should wrap.'), 'type': 'string', 'enum': [ 'off', @@ -1431,42 +1442,42 @@ const codeEditorPreferenceProperties = { 'default': 'off' }, 'editor.wordWrapBreakAfterCharacters': { - 'description': 'Configure word wrapping characters. A break will be introduced after these characters.', + 'description': nls.localize('theia/editor/wordWrapBreakAfterCharacters', 'Configure word wrapping characters. A break will be introduced after these characters.'), 'type': 'string', 'default': ' \t})]?|/&.,;¢°′″‰℃、。。、¢,.:;?!%・・ゝゞヽヾーァィゥェォッャュョヮヵヶぁぃぅぇぉっゃゅょゎゕゖㇰㇱㇲㇳㇴㇵㇶㇷㇸㇹㇺㇻㇼㇽㇾㇿ々〻ァィゥェォャュョッー”〉》」』】〕)]}」', }, 'editor.wordWrapBreakBeforeCharacters': { - 'description': 'Configure word wrapping characters. A break will be introduced before these characters.', + 'description': nls.localize('theia/editor/wordWrapBreakBeforeCharacters', 'Configure word wrapping characters. A break will be introduced before these characters.'), 'type': 'string', 'default': '([{‘“〈《「『【〔([{「£¥$£¥++', }, 'editor.wordWrapColumn': { - 'markdownDescription': 'Controls the wrapping column of the editor when `#editor.wordWrap#` is `wordWrapColumn` or `bounded`.', + 'markdownDescription': nls.localize('vscode/editorOptions/wordWrapColumn', 'Controls the wrapping column of the editor when `#editor.wordWrap#` is `wordWrapColumn` or `bounded`.'), 'type': 'integer', 'default': 80, 'minimum': 1, 'maximum': 1073741824 }, 'editor.wordWrapOverride1': { - 'markdownDescription': 'Override the `wordWrap` setting.', + 'markdownDescription': nls.localize('theia/editor/wordWrapOverride1', 'Override the `wordWrap` setting.'), 'type': 'string', 'enum': ['off', 'on', 'inherit'], 'default': 'inherit' }, 'editor.wordWrapOverride2': { - 'markdownDescription': 'Override the `wordWrapOverride1` setting.', + 'markdownDescription': nls.localize('theia/editor/wordWrapOverride2', 'Override the `wordWrapOverride1` setting.'), 'type': 'string', 'enum': ['off', 'on', 'inherit'], 'default': 'inherit' }, 'editor.wrappingIndent': { 'enumDescriptions': [ - 'No indentation. Wrapped lines begin at column 1.', - 'Wrapped lines get the same indentation as the parent.', - 'Wrapped lines get +1 indentation toward the parent.', - 'Wrapped lines get +2 indentation toward the parent.' + nls.localize('vscode/editorOptions/wrappingIndent.none', 'No indentation. Wrapped lines begin at column 1.'), + nls.localize('vscode/editorOptions/wrappingIndent.same', 'Wrapped lines get the same indentation as the parent.'), + nls.localize('vscode/editorOptions/wrappingIndent.indent', 'Wrapped lines get +1 indentation toward the parent.'), + nls.localize('vscode/editorOptions/wrappingIndent.deepIndent', 'Wrapped lines get +2 indentation toward the parent.') ], - 'description': 'Controls the indentation of wrapped lines.', + 'description': nls.localize('vscode/editorOptions/wrappingIndent', 'Controls the indentation of wrapped lines.'), 'type': 'string', 'enum': [ 'none', @@ -1478,10 +1489,10 @@ const codeEditorPreferenceProperties = { }, 'editor.wrappingStrategy': { 'enumDescriptions': [ - 'Assumes that all characters are of the same width. This is a fast algorithm that works correctly for monospace fonts and certain scripts (like Latin characters) where glyphs are of equal width.', - 'Delegates wrapping points computation to the browser. This is a slow algorithm, that might cause freezes for large files, but it works correctly in all cases.' + nls.localize('vscode/editorOptions/wrappingStrategy.simple', 'Assumes that all characters are of the same width. This is a fast algorithm that works correctly for monospace fonts and certain scripts (like Latin characters) where glyphs are of equal width.'), + nls.localize('vscode/editorOptions/wrappingStrategy.advanced', 'Delegates wrapping points computation to the browser. This is a slow algorithm, that might cause freezes for large files, but it works correctly in all cases.') ], - 'description': 'Controls the algorithm that computes wrapping points.', + 'description': nls.localize('vscode/editorOptions/wrappingStrategy', 'Controls the algorithm that computes wrapping points.'), 'type': 'string', 'enum': [ 'simple', @@ -1504,29 +1515,29 @@ export const editorPreferenceSchema: PreferenceSchema = { 'off' ], 'default': 'off', - 'description': 'Controls auto save of dirty files.', + 'description': nls.localize('vscode/files.contribution/autoSave', 'Controls auto save of dirty files.'), overridable: false }, 'editor.autoSaveDelay': { 'type': 'number', 'default': 500, - 'description': 'Configure the auto save delay in milliseconds.', + 'description': nls.localize('vscode/files.contribution/autoSaveDelay', 'Configure the auto save delay in milliseconds.'), overridable: false }, 'editor.formatOnSave': { 'type': 'boolean', 'default': false, - 'description': 'Enable format on manual save.' + 'description': nls.localize('vscode/files.contribution/formatOnSave', 'Enable format on manual save.') }, 'editor.formatOnSaveTimeout': { 'type': 'number', 'default': 750, - 'description': 'Timeout in milliseconds after which the formatting that is run on file save is cancelled.' + 'description': nls.localize('theia/editor/formatOnSaveTimeout', 'Timeout in milliseconds after which the formatting that is run on file save is cancelled.') }, 'editor.history.persistClosedEditors': { 'type': 'boolean', 'default': false, - 'description': 'Controls whether to persist closed editor history for the workspace across window reloads.' + 'description': nls.localize('theia/editor/persistClosedEditors', 'Controls whether to persist closed editor history for the workspace across window reloads.') }, 'files.eol': { 'type': 'string', @@ -1536,12 +1547,12 @@ export const editorPreferenceSchema: PreferenceSchema = { 'auto' ], 'enumDescriptions': [ - 'LF', - 'CRLF', - 'Uses operating system specific end of line character.' + nls.localize('vscode/files.contribution/eol.LF', 'LF'), + nls.localize('vscode/files.contribution/eol.CRLF', 'CRLF'), + nls.localize('vscode/files.contribution/eol.auto', 'Uses operating system specific end of line character.') ], 'default': 'auto', - 'description': 'The default end of line character.' + 'description': nls.localize('vscode/files.contribution/eol', 'The default end of line character.') } } }; diff --git a/packages/external-terminal/src/electron-browser/external-terminal-contribution.ts b/packages/external-terminal/src/electron-browser/external-terminal-contribution.ts index 9c119fa9d4d0f..5da5ecb647f51 100644 --- a/packages/external-terminal/src/electron-browser/external-terminal-contribution.ts +++ b/packages/external-terminal/src/electron-browser/external-terminal-contribution.ts @@ -23,12 +23,13 @@ import { WorkspaceService } from '@theia/workspace/lib/browser'; import { ExternalTerminalService } from '../common/external-terminal'; import { ExternalTerminalPreferenceService } from './external-terminal-preference'; import { QuickPickService } from '@theia/core/lib/common/quick-pick-service'; +import { nls } from '@theia/core/lib/common/nls'; export namespace ExternalTerminalCommands { - export const OPEN_NATIVE_CONSOLE: Command = { + export const OPEN_NATIVE_CONSOLE = Command.toLocalizedCommand({ id: 'workbench.action.terminal.openNativeConsole', label: 'Open New External Terminal' - }; + }, 'vscode/externalTerminal.contribution/globalConsoleAction'); } @injectable() @@ -109,7 +110,7 @@ export class ExternalTerminalFrontendContribution implements CommandContribution description: this.labelProvider.getLongName(resource), value: resource.toString() }) - ), { placeholder: 'Select current working directory for new external terminal' }); + ), { placeholder: nls.localize('theia/external-terminal/cwd', 'Select current working directory for new external terminal') }); return selectedItem?.value; } } diff --git a/packages/external-terminal/src/electron-browser/external-terminal-preference.ts b/packages/external-terminal/src/electron-browser/external-terminal-preference.ts index ef5f932771953..c5db7967d7023 100644 --- a/packages/external-terminal/src/electron-browser/external-terminal-preference.ts +++ b/packages/external-terminal/src/electron-browser/external-terminal-preference.ts @@ -24,6 +24,7 @@ import { import { PreferenceSchemaProvider } from '@theia/core/lib/browser/preferences/preference-contribution'; import { isWindows, isOSX } from '@theia/core/lib/common/os'; import { ExternalTerminalService, ExternalTerminalConfiguration } from '../common/external-terminal'; +import { nls } from '@theia/core/lib/common/nls'; export const ExternalTerminalPreferences = Symbol('ExternalTerminalPreferences'); export type ExternalTerminalPreferences = PreferenceProxy; @@ -86,17 +87,17 @@ export async function getExternalTerminalSchema(externalTerminalService: Externa properties: { 'terminal.external.windowsExec': { type: 'string', - description: 'Customizes which terminal to run on Windows.', + description: nls.localize('vscode/externalTerminal.contribution/terminal.external.windowsExec', 'Customizes which terminal to run on Windows.'), default: `${isWindows ? hostExec : 'C:\\WINDOWS\\System32\\cmd.exe'}` }, 'terminal.external.osxExec': { type: 'string', - description: 'Customizes which terminal to run on macOS.', + description: nls.localize('vscode/externalTerminal.contribution/terminal.external.osxExec', 'Customizes which terminal to run on macOS.'), default: `${isOSX ? hostExec : 'Terminal.app'}` }, 'terminal.external.linuxExec': { type: 'string', - description: 'Customizes which terminal to run on Linux.', + description: nls.localize('vscode/externalTerminal.contribution/terminal.external.linuxExec', 'Customizes which terminal to run on Linux.'), default: `${!(isWindows || isOSX) ? hostExec : 'xterm'}` } } diff --git a/packages/file-search/src/browser/quick-file-open.ts b/packages/file-search/src/browser/quick-file-open.ts index 5636ab68a3145..fe9d05e9cd3fd 100644 --- a/packages/file-search/src/browser/quick-file-open.ts +++ b/packages/file-search/src/browser/quick-file-open.ts @@ -15,7 +15,7 @@ ********************************************************************************/ import { inject, injectable, optional, postConstruct } from '@theia/core/shared/inversify'; -import { OpenerService, KeybindingRegistry, QuickAccessRegistry, QuickAccessProvider } from '@theia/core/lib/browser'; +import { OpenerService, KeybindingRegistry, QuickAccessRegistry, QuickAccessProvider, CommonCommands } from '@theia/core/lib/browser'; import { WorkspaceService } from '@theia/workspace/lib/browser/workspace-service'; import URI from '@theia/core/lib/common/uri'; import { FileSearchService, WHITESPACE_QUERY_SEPARATOR } from '../common/file-search-service'; @@ -28,11 +28,11 @@ import { FileSystemPreferences } from '@theia/filesystem/lib/browser'; import { EditorOpenerOptions, EditorWidget, Position, Range } from '@theia/editor/lib/browser'; import { findMatches, QuickInputService, QuickPickItem, QuickPicks } from '@theia/core/lib/browser/quick-input/quick-input-service'; -export const quickFileOpen: Command = { +export const quickFileOpen = Command.toLocalizedCommand({ id: 'file-search.openFile', - category: 'File', + category: CommonCommands.FILE_CATEGORY, label: 'Open File...' -}; +}, 'vscode/workspaceActions/openFile', CommonCommands.FILE_CATEGORY_KEY); export interface FilterAndRange { filter: string; range?: Range; diff --git a/packages/filesystem/src/browser/download/file-download-command-contribution.ts b/packages/filesystem/src/browser/download/file-download-command-contribution.ts index fdc7af94c601c..d83f5e26de202 100644 --- a/packages/filesystem/src/browser/download/file-download-command-contribution.ts +++ b/packages/filesystem/src/browser/download/file-download-command-contribution.ts @@ -22,6 +22,7 @@ import { SelectionService } from '@theia/core/lib/common/selection-service'; import { Command, CommandContribution, CommandRegistry } from '@theia/core/lib/common/command'; import { UriAwareCommandHandler } from '@theia/core/lib/common/uri-command-handler'; import { FileDownloadService } from './file-download-service'; +import { CommonCommands } from '@theia/core/lib/browser'; @injectable() export class FileDownloadCommandContribution implements CommandContribution { @@ -67,16 +68,16 @@ export class FileDownloadCommandContribution implements CommandContribution { export namespace FileDownloadCommands { - export const DOWNLOAD: Command = { + export const DOWNLOAD = Command.toLocalizedCommand({ id: 'file.download', - category: 'File', + category: CommonCommands.FILE_CATEGORY, label: 'Download' - }; + }, 'vscode/fileActions/downloadButton', CommonCommands.FILE_CATEGORY_KEY); - export const COPY_DOWNLOAD_LINK: Command = { + export const COPY_DOWNLOAD_LINK = Command.toLocalizedCommand({ id: 'file.copyDownloadLink', - category: 'File', + category: CommonCommands.FILE_CATEGORY, label: 'Copy Download Link' - }; + }, 'theia/filesystem/copyDownloadLink', CommonCommands.FILE_CATEGORY_KEY); } diff --git a/packages/filesystem/src/browser/file-upload-service.ts b/packages/filesystem/src/browser/file-upload-service.ts index 433b7eeee93e2..4ae5b3c2c0214 100644 --- a/packages/filesystem/src/browser/file-upload-service.ts +++ b/packages/filesystem/src/browser/file-upload-service.ts @@ -28,7 +28,8 @@ import { HTTP_FILE_UPLOAD_PATH } from '../common/file-upload'; import { Semaphore } from 'async-mutex'; import { FileSystemPreferences } from './filesystem-preferences'; import { FileService } from './file-service'; -import { ConfirmDialog } from '@theia/core/lib/browser'; +import { ConfirmDialog, Dialog } from '@theia/core/lib/browser'; +import { nls } from '@theia/core/lib/common/nls'; export const HTTP_UPLOAD_URL: string = new Endpoint({ path: HTTP_FILE_UPLOAD_PATH }).getRestUrl().toString(true); @@ -162,7 +163,7 @@ export class FileUploadService { } } params.progress.report({ - message: `Processed ${done} out of ${total}`, + message: nls.localize('theia/filesystem/processedOutOf', 'Processed {0} out of {1}', done, total), work: { total, done } }); } else { @@ -175,7 +176,7 @@ export class FileUploadService { done += item.done; } params.progress.report({ - message: `Uploaded ${result.uploaded.length} out of ${status.size}`, + message: nls.localize('theia/filesystem/uploadedOutOf', 'Uploaded {0} out of {1}', result.uploaded.length, status.size), work: { total, done } }); } @@ -244,10 +245,10 @@ export class FileUploadService { protected async confirmOverwrite(fileUri: URI): Promise { const dialog = new ConfirmDialog({ - title: 'Replace file', - msg: `File '${fileUri.path.base}' already exists in the destination folder. Do you want to replace it?`, - ok: 'Replace', - cancel: 'Cancel' + title: nls.localize('vscode/findWidget/label.replace', 'Replace file'), + msg: nls.localize('vscode/explorerViewer/confirmOverwrite', 'File "{0}" already exists in the destination folder. Do you want to replace it?', fileUri.path.base), + ok: nls.localize('vscode/findWidget/label.replace', 'Replace file'), + cancel: Dialog.CANCEL }); return !!await dialog.open(); } @@ -360,7 +361,7 @@ export class FileUploadService { protected async withProgress( cb: (progress: Progress, token: CancellationToken) => Promise, - { text }: FileUploadProgressParams = { text: 'Uploading Files' } + { text }: FileUploadProgressParams = { text: nls.localize('theia/filesystem/uploadFiles', 'Uploading Files') } ): Promise { const cancellationSource = new CancellationTokenSource(); const { token } = cancellationSource; diff --git a/packages/filesystem/src/browser/filesystem-frontend-contribution.ts b/packages/filesystem/src/browser/filesystem-frontend-contribution.ts index 004136109da98..3b702e88d4137 100644 --- a/packages/filesystem/src/browser/filesystem-frontend-contribution.ts +++ b/packages/filesystem/src/browser/filesystem-frontend-contribution.ts @@ -23,7 +23,8 @@ import { FrontendApplicationContribution, ApplicationShell, NavigatableWidget, NavigatableWidgetOptions, Saveable, WidgetManager, StatefulWidget, FrontendApplication, ExpandableTreeNode, waitForClosed, - CorePreferences + CorePreferences, + CommonCommands } from '@theia/core/lib/browser'; import { MimeService } from '@theia/core/lib/browser/mime-service'; import { TreeWidgetSelection } from '@theia/core/lib/browser/tree/tree-widget-selection'; @@ -36,11 +37,11 @@ import { Deferred } from '@theia/core/lib/common/promise-util'; export namespace FileSystemCommands { - export const UPLOAD: Command = { + export const UPLOAD = Command.toLocalizedCommand({ id: 'file.upload', - category: 'File', + category: CommonCommands.FILE_CATEGORY, label: 'Upload Files...' - }; + }, 'theia/filesystem/uploadFiles', CommonCommands.FILE_CATEGORY_KEY); } diff --git a/packages/filesystem/src/browser/filesystem-preferences.ts b/packages/filesystem/src/browser/filesystem-preferences.ts index 33bc2b9bacd73..bfc59f647e352 100644 --- a/packages/filesystem/src/browser/filesystem-preferences.ts +++ b/packages/filesystem/src/browser/filesystem-preferences.ts @@ -23,6 +23,7 @@ import { PreferenceContribution } from '@theia/core/lib/browser/preferences'; import { SUPPORTED_ENCODINGS } from '@theia/core/lib/browser/supported-encodings'; +import { nls } from '@theia/core/lib/common/nls'; // See https://github.com/Microsoft/vscode/issues/30180 export const WIN32_MAX_FILE_SIZE_MB = 300; // 300 MB @@ -38,7 +39,7 @@ export const filesystemPreferenceSchema: PreferenceSchema = { type: 'object', properties: { 'files.watcherExclude': { - description: 'List of paths to exclude from the filesystem watcher', + description: nls.localize('vscode/files.contribution/watcherExclude', 'List of paths to exclude from the filesystem watcher'), additionalProperties: { type: 'boolean' }, @@ -52,46 +53,60 @@ export const filesystemPreferenceSchema: PreferenceSchema = { 'files.exclude': { type: 'object', default: { '**/.git': true, '**/.svn': true, '**/.hg': true, '**/CVS': true, '**/.DS_Store': true }, - description: 'Configure glob patterns for excluding files and folders.', + description: nls.localize('vscode/files.contribution/exclude', 'Configure glob patterns for excluding files and folders.'), scope: 'resource' }, 'files.enableTrash': { type: 'boolean', default: true, - description: 'Moves files/folders to the OS trash (recycle bin on Windows) when deleting. Disabling this will delete files/folders permanently.' + description: nls.localize( + 'vscode/files.contribution/useTrash', + 'Moves files/folders to the OS trash (recycle bin on Windows) when deleting. Disabling this will delete files/folders permanently.' + ) }, 'files.associations': { type: 'object', - description: 'Configure file associations to languages (e.g. \"*.extension\": \"html\"). \ -These have precedence over the default associations of the languages installed.' + description: nls.localize( + 'vscode/files.contribution/associations', + 'Configure file associations to languages (e.g. \"*.extension\": \"html\"). These have precedence over the default associations of the languages installed.' + ) }, 'files.autoGuessEncoding': { type: 'boolean', default: false, - description: 'When enabled, the editor will attempt to guess the character set encoding when opening files. This setting can also be configured per language.', + description: nls.localize( + 'vscode/files.contribution/autoGuessEncoding', + 'When enabled, the editor will attempt to guess the character set encoding when opening files. This setting can also be configured per language.' + ), scope: 'language-overridable', included: Object.keys(SUPPORTED_ENCODINGS).length > 1 }, 'files.participants.timeout': { type: 'number', default: 5000, - markdownDescription: 'Timeout in milliseconds after which file participants for create, rename, and delete are cancelled. Use `0` to disable participants.' + markdownDescription: nls.localize( + 'vscode/mainThreadFileSystemEventService/files.participants.timeout', + 'Timeout in milliseconds after which file participants for create, rename, and delete are cancelled. Use `0` to disable participants.' + ) }, 'files.maxFileSizeMB': { type: 'number', default: MAX_FILE_SIZE_MB, - markdownDescription: 'Controls the max file size in MB which is possible to open.' + markdownDescription: nls.localize('theia/filesystem/maxFileSizeMB', 'Controls the max file size in MB which is possible to open.') }, 'files.trimTrailingWhitespace': { type: 'boolean', default: false, - description: 'When enabled, will trim trailing whitespace when saving a file.', + description: nls.localize('vscode/files.contribution/trimTrailingWhitespace', 'When enabled, will trim trailing whitespace when saving a file.'), scope: 'language-overridable' }, 'files.maxConcurrentUploads': { type: 'integer', default: 1, - description: 'Maximum number of concurrent files to upload when uploading multiple files. 0 means all files will be uploaded concurrently.', + description: nls.localize( + 'theia/filesystem/maxConcurrentUploads', + 'Maximum number of concurrent files to upload when uploading multiple files. 0 means all files will be uploaded concurrently.' + ), } } }; diff --git a/packages/getting-started/src/browser/getting-started-widget.tsx b/packages/getting-started/src/browser/getting-started-widget.tsx index 57c85ba111d99..27b6556bf74a4 100644 --- a/packages/getting-started/src/browser/getting-started-widget.tsx +++ b/packages/getting-started/src/browser/getting-started-widget.tsx @@ -26,6 +26,7 @@ import { ApplicationInfo, ApplicationServer } from '@theia/core/lib/common/appli import { FrontendApplicationConfigProvider } from '@theia/core/lib/browser/frontend-application-config-provider'; import { EnvVariablesServer } from '@theia/core/lib/common/env-variables'; import { WindowService } from '@theia/core/lib/browser/window/window-service'; +import { nls } from '@theia/core/lib/common/nls'; /** * Default implementation of the `GettingStartedWidget`. @@ -47,7 +48,7 @@ export class GettingStartedWidget extends ReactWidget { /** * The widget `label` which is used for display purposes. */ - static readonly LABEL = 'Getting Started'; + static readonly LABEL = nls.localize('vscode/gettingStarted.contribution/Getting Started', 'Getting Started'); /** * The `ApplicationInfo` for the application if available. @@ -150,7 +151,7 @@ export class GettingStartedWidget extends ReactWidget { */ protected renderHeader(): React.ReactNode { return
-

{this.applicationName} Getting Started

+

{this.applicationName}{' ' + GettingStartedWidget.LABEL}

; } @@ -167,7 +168,7 @@ export class GettingStartedWidget extends ReactWidget { tabIndex={0} onClick={this.doOpen} onKeyDown={this.doOpenEnter}> - Open + {nls.localize('vscode/dialogMainService/open', 'Open')}
; @@ -177,7 +178,7 @@ export class GettingStartedWidget extends ReactWidget { tabIndex={0} onClick={this.doOpenFile} onKeyDown={this.doOpenFileEnter}> - Open File + {nls.localize('vscode/dialogMainService/openFile', 'Open File')}
; @@ -187,7 +188,7 @@ export class GettingStartedWidget extends ReactWidget { tabIndex={0} onClick={this.doOpenFolder} onKeyDown={this.doOpenFolderEnter}> - Open Folder + {nls.localize('vscode/dialogMainService/openFolder', 'Open Folder')} ; @@ -197,12 +198,12 @@ export class GettingStartedWidget extends ReactWidget { tabIndex={0} onClick={this.doOpenWorkspace} onKeyDown={this.doOpenWorkspaceEnter}> - Open Workspace + {nls.localize('vscode/dialogMainService/openWorkspaceTitle', 'Open Workspace')} ); return
-

Open

+

{nls.localize('vscode/dialogMainService/open', 'Open')}

{open} {openFile} {openFolder} @@ -237,14 +238,14 @@ export class GettingStartedWidget extends ReactWidget { tabIndex={0} onClick={this.doOpenRecentWorkspace} onKeyDown={this.doOpenRecentWorkspaceEnter}> - More... + {nls.localize('vscode/vs_code_welcome_page/welcomePage.moreRecent', 'More...')}
; return

- Recent Workspaces + {nls.localize('vscode/vs_code_welcome_page/welcomePage.recent', 'Recently opened')}

- {items.length > 0 ? content :

No Recent Workspaces

} + {items.length > 0 ? content :

{nls.localize('vscode/vs_code_welcome_page/welcomePage.noRecentFolders', 'No Recent Workspaces')}

} {more}
; } @@ -257,7 +258,7 @@ export class GettingStartedWidget extends ReactWidget { return

- Settings + {nls.localize('vscode/preferences.contribution/settings', 'Settings')}

@@ -274,7 +275,7 @@ export class GettingStartedWidget extends ReactWidget { tabIndex={0} onClick={this.doOpenKeyboardShortcuts} onKeyDown={this.doOpenKeyboardShortcutsEnter}> - Open Keyboard Shortcuts + {nls.localize('vscode/preferences.contribution/openGlobalKeybindings', 'Open Keyboard Shortcuts')}
; @@ -287,7 +288,7 @@ export class GettingStartedWidget extends ReactWidget { return

- Help + {nls.localize('vscode/gettingStarted.contribution/help', 'Help')}

@@ -304,7 +305,7 @@ export class GettingStartedWidget extends ReactWidget { tabIndex={0} onClick={() => this.doOpenExternalLink(this.extensionUrl)} onKeyDown={(e: React.KeyboardEvent) => this.doOpenExternalLinkEnter(e, this.extensionUrl)}> - Building a New Extension + {nls.localize('theia/getting-started/newExtension', 'Building a New Extension')}
@@ -313,7 +314,7 @@ export class GettingStartedWidget extends ReactWidget { tabIndex={0} onClick={() => this.doOpenExternalLink(this.pluginUrl)} onKeyDown={(e: React.KeyboardEvent) => this.doOpenExternalLinkEnter(e, this.pluginUrl)}> - Building a New Plugin + {nls.localize('theia/getting-started/newPlugin', 'Building a New Plugin')}
; @@ -326,7 +327,7 @@ export class GettingStartedWidget extends ReactWidget { return

- {this.applicationInfo ? 'Version ' + this.applicationInfo.version : ''} + {this.applicationInfo ? nls.localize('vscode/extensions.contribution/extensionInfoVersion', 'Version: {0}', this.applicationInfo.version) : ''}

; diff --git a/packages/git/src/browser/blame/blame-contribution.ts b/packages/git/src/browser/blame/blame-contribution.ts index c376bf03c0129..506f8b6f6d94b 100644 --- a/packages/git/src/browser/blame/blame-contribution.ts +++ b/packages/git/src/browser/blame/blame-contribution.ts @@ -26,11 +26,11 @@ import { EDITOR_CONTEXT_MENU_SCM } from '@theia/scm-extra/lib/browser/scm-extra- import debounce = require('@theia/core/shared/lodash.debounce'); export namespace BlameCommands { - export const TOGGLE_GIT_ANNOTATIONS: Command = { + export const TOGGLE_GIT_ANNOTATIONS = Command.toLocalizedCommand({ id: 'git.editor.toggle.annotations', category: 'Git', label: 'Toggle Blame Annotations' - }; + }, 'theia/git/toggleBlameAnnotations', 'vscode.git/package/displayName'); export const CLEAR_GIT_ANNOTATIONS: Command = { id: 'git.editor.clear.annotations' }; diff --git a/packages/git/src/browser/diff/git-diff-contribution.ts b/packages/git/src/browser/diff/git-diff-contribution.ts index 6d8742658c1a7..0e61cb8d6026e 100644 --- a/packages/git/src/browser/diff/git-diff-contribution.ts +++ b/packages/git/src/browser/diff/git-diff-contribution.ts @@ -35,36 +35,42 @@ import { WorkspaceService } from '@theia/workspace/lib/browser'; import { TabBarToolbarContribution, TabBarToolbarRegistry, TabBarToolbarItem } from '@theia/core/lib/browser/shell/tab-bar-toolbar'; import { Emitter } from '@theia/core/lib/common/event'; import { FileService } from '@theia/filesystem/lib/browser/file-service'; +import { nls } from '@theia/core/lib/common/nls'; export namespace GitDiffCommands { - export const OPEN_FILE_DIFF: Command = { + export const OPEN_FILE_DIFF = Command.toLocalizedCommand({ id: 'git-diff:open-file-diff', category: 'Git Diff', - label: 'Compare With...' - }; + originalLabel: 'Compare With...', + label: nls.localize('vscode/fileActions/globalCompareFile', 'Compare With...') + }); export const TREE_VIEW_MODE = { id: 'git.viewmode.tree', - tooltip: 'Toggle to Tree View', + tooltip: nls.localize('vscode/scmViewPane/viewModeTree', 'Toggle to Tree View'), iconClass: codicon('list-tree'), - label: 'Toggle to Tree View', + originalLabel: 'Toggle to Tree View', + label: nls.localize('vscode/scmViewPane/viewModeTree', 'Toggle to Tree View') }; export const LIST_VIEW_MODE = { id: 'git.viewmode.list', - tooltip: 'Toggle to List View', + tooltip: nls.localize('vscode/scmViewPane/viewModeList', 'Toggle to List View'), iconClass: codicon('list-flat'), - label: 'Toggle to List View', + originalLabel: 'Toggle to List View', + label: nls.localize('vscode/scmViewPane/viewModeList', 'Toggle to List View') }; export const PREVIOUS_CHANGE = { id: 'git.navigate-changes.previous', - tooltip: 'Toggle to List View', + tooltip: nls.localize('vscode/editor.contribution/navigate.prev.label', 'Previous Change'), iconClass: codicon('arrow-left'), - label: 'Previous Change', + originalLabel: 'Previous Change', + label: nls.localize('vscode/editor.contribution/navigate.prev.label', 'Previous Change') }; export const NEXT_CHANGE = { id: 'git.navigate-changes.next', - tooltip: 'Toggle to List View', + tooltip: nls.localize('vscode/editor.contribution/navigate.next.label', 'Next Change'), iconClass: codicon('arrow-right'), - label: 'Next Change', + originalLabel: 'Next Change', + label: nls.localize('vscode/editor.contribution/navigate.next.label', 'Next Change') }; } diff --git a/packages/git/src/browser/git-contribution.ts b/packages/git/src/browser/git-contribution.ts index 0abcdab1c833c..3de1e5b15d644 100644 --- a/packages/git/src/browser/git-contribution.ts +++ b/packages/git/src/browser/git-contribution.ts @@ -49,170 +49,189 @@ import { ColorRegistry } from '@theia/core/lib/browser/color-registry'; import { ScmInputIssueType } from '@theia/scm/lib/browser/scm-input'; import { DecorationsService } from '@theia/core/lib/browser/decorations-service'; import { GitDecorationProvider } from './git-decoration-provider'; +import { nls } from '@theia/core/lib/common/nls'; export namespace GIT_COMMANDS { - export const CLONE = { + + const GIT_CATEGORY_KEY = 'vscode.git/package/displayName'; + const GIT_CATEGORY = 'Git'; + + export const CLONE = Command.toLocalizedCommand({ id: 'git.clone', - label: 'Git: Clone...' - }; - export const FETCH = { + category: GIT_CATEGORY, + label: 'Clone...' + }, 'vscode.git/package/command.clone', GIT_CATEGORY_KEY); + export const FETCH = Command.toLocalizedCommand({ id: 'git.fetch', - label: 'Git: Fetch...' - }; - export const PULL_DEFAULT = { + category: GIT_CATEGORY, + label: 'Fetch...' + }, 'vscode.git/package/command.fetch', GIT_CATEGORY_KEY); + export const PULL_DEFAULT = Command.toLocalizedCommand({ id: 'git.pull.default', - label: 'Git: Pull' - }; - export const PULL_DEFAULT_FAVORITE = { + category: GIT_CATEGORY, + label: 'Pull' + }, 'vscode.git/package/command.pull', GIT_CATEGORY_KEY); + export const PULL_DEFAULT_FAVORITE: Command = { id: PULL_DEFAULT.id + '.favorite', - label: PULL_DEFAULT.label + label: PULL_DEFAULT.label, + originalLabel: PULL_DEFAULT.originalLabel }; - export const PULL = { + export const PULL = Command.toLocalizedCommand({ id: 'git.pull', - label: 'Git: Pull from...' - }; - export const PUSH_DEFAULT = { + category: GIT_CATEGORY, + label: 'Pull from...' + }, 'vscode.git/package/command.pullFrom', GIT_CATEGORY_KEY); + export const PUSH_DEFAULT = Command.toLocalizedCommand({ id: 'git.push.default', - label: 'Git: Push' - }; - export const PUSH_DEFAULT_FAVORITE = { + category: GIT_CATEGORY, + label: 'Push' + }, 'vscode.git/package/command.push', GIT_CATEGORY_KEY); + export const PUSH_DEFAULT_FAVORITE: Command = { id: PUSH_DEFAULT.id + '.favorite', - label: PUSH_DEFAULT.label + label: PUSH_DEFAULT.label, + originalLabel: PUSH_DEFAULT.originalLabel }; - export const PUSH = { + export const PUSH = Command.toLocalizedCommand({ id: 'git.push', - label: 'Git: Push to...' - }; - export const MERGE = { + category: GIT_CATEGORY, + label: 'Push to...' + }, 'vscode.git/package/command.pushTo', GIT_CATEGORY_KEY); + export const MERGE = Command.toLocalizedCommand({ id: 'git.merge', - label: 'Git: Merge...' - }; - export const CHECKOUT = { + category: GIT_CATEGORY, + label: 'Merge...' + }, 'vscode.git/package/command.merge', GIT_CATEGORY_KEY); + export const CHECKOUT = Command.toLocalizedCommand({ id: 'git.checkout', - label: 'Git: Checkout' - }; + category: GIT_CATEGORY, + label: 'Checkout' + }, 'vscode.git/package/command.checkout', GIT_CATEGORY_KEY); export const COMMIT = { - id: 'git.commit.all', + ...Command.toLocalizedCommand({ + id: 'git.commit.all', + label: 'Commit', + iconClass: codicon('check') + }, 'vscode.git/package/command.commit'), tooltip: 'Commit all the staged changes', - label: 'Commit', - iconClass: codicon('check') }; - export const COMMIT_ADD_SIGN_OFF = { + export const COMMIT_ADD_SIGN_OFF = Command.toLocalizedCommand({ id: 'git-commit-add-sign-off', label: 'Add Signed-off-by', - category: 'Git', + category: GIT_CATEGORY, iconClass: codicon('edit') - }; + }, 'theia/git/addSignedOff', GIT_CATEGORY_KEY); export const COMMIT_AMEND = { id: 'git.commit.amend' }; export const COMMIT_SIGN_OFF = { id: 'git.commit.signOff' }; - export const OPEN_FILE: Command = { + export const OPEN_FILE = Command.toLocalizedCommand({ id: 'git.open.file', - category: 'Git', + category: GIT_CATEGORY, label: 'Open File', iconClass: codicon('go-to-file') - }; - export const OPEN_CHANGED_FILE: Command = { + }, 'vscode.git/package/command.openFile', GIT_CATEGORY_KEY); + export const OPEN_CHANGED_FILE = Command.toLocalizedCommand({ id: 'git.open.changed.file', - category: 'Git', + category: GIT_CATEGORY, label: 'Open File', iconClass: codicon('go-to-file') - }; - export const OPEN_CHANGES: Command = { + }, 'vscode.git/package/command.openFile', GIT_CATEGORY_KEY); + export const OPEN_CHANGES = Command.toLocalizedCommand({ id: 'git.open.changes', - category: 'Git', + category: GIT_CATEGORY, label: 'Open Changes', iconClass: codicon('git-compare') - }; - export const SYNC = { + }, 'vscode.git/package/command.openChange', GIT_CATEGORY_KEY); + export const SYNC = Command.toLocalizedCommand({ id: 'git.sync', - label: 'Git: Sync' - }; - export const PUBLISH = { + category: GIT_CATEGORY, + label: 'Sync' + }, 'vscode.git/package/command.sync', GIT_CATEGORY_KEY); + export const PUBLISH = Command.toLocalizedCommand({ id: 'git.publish', - label: 'Git: Publish Branch' - }; - export const STAGE = { + category: GIT_CATEGORY, + label: 'Publish Branch' + }, 'vscode.git/package/command.publish', GIT_CATEGORY_KEY); + export const STAGE = Command.toLocalizedCommand({ id: 'git.stage', - category: 'Git', + category: GIT_CATEGORY, label: 'Stage Changes', iconClass: codicon('add') - }; - export const STAGE_ALL = { + }, 'vscode.git/package/command.stage', GIT_CATEGORY_KEY); + export const STAGE_ALL = Command.toLocalizedCommand({ id: 'git.stage.all', - category: 'Git', + category: GIT_CATEGORY, label: 'Stage All Changes', iconClass: codicon('add') - }; - export const UNSTAGE = { + }, 'vscode.git/package/command.stageAll', GIT_CATEGORY_KEY); + export const UNSTAGE = Command.toLocalizedCommand({ id: 'git.unstage', - category: 'Git', + category: GIT_CATEGORY, label: 'Unstage Changes', iconClass: codicon('dash') - }; - export const UNSTAGE_ALL = { + }, 'vscode.git/package/command.unstage', GIT_CATEGORY_KEY); + export const UNSTAGE_ALL = Command.toLocalizedCommand({ id: 'git.unstage.all', - category: 'Git', + category: GIT_CATEGORY, label: 'Unstage All', iconClass: codicon('dash') - }; - export const DISCARD = { + }, 'vscode.git/package/command.unstageAll', GIT_CATEGORY_KEY); + export const DISCARD = Command.toLocalizedCommand({ id: 'git.discard', iconClass: codicon('discard'), - category: 'Git', + category: GIT_CATEGORY, label: 'Discard Changes' - }; - export const DISCARD_ALL = { + }, 'vscode.git/package/command.clean', GIT_CATEGORY_KEY); + export const DISCARD_ALL = Command.toLocalizedCommand({ id: 'git.discard.all', - category: 'Git', + category: GIT_CATEGORY, label: 'Discard All Changes', iconClass: codicon('discard') - }; - export const STASH = { + }, 'vscode.git/package/command.cleanAll', GIT_CATEGORY_KEY); + export const STASH = Command.toLocalizedCommand({ id: 'git.stash', - category: 'Git', + category: GIT_CATEGORY, label: 'Stash...' - }; - export const APPLY_STASH = { + }, 'vscode.git/package/command.stash', GIT_CATEGORY_KEY); + export const APPLY_STASH = Command.toLocalizedCommand({ id: 'git.stash.apply', - category: 'Git', + category: GIT_CATEGORY, label: 'Apply Stash...' - }; - export const APPLY_LATEST_STASH = { + }, 'vscode.git/package/command.stashApply', GIT_CATEGORY_KEY); + export const APPLY_LATEST_STASH = Command.toLocalizedCommand({ id: 'git.stash.apply.latest', - category: 'Git', + category: GIT_CATEGORY, label: 'Apply Latest Stash' - }; - export const POP_STASH = { + }, 'vscode.git/package/command.stashApplyLatest', GIT_CATEGORY_KEY); + export const POP_STASH = Command.toLocalizedCommand({ id: 'git.stash.pop', - category: 'Git', + category: GIT_CATEGORY, label: 'Pop Stash...' - }; - export const POP_LATEST_STASH = { + }, 'vscode.git/package/command.stashPop', GIT_CATEGORY_KEY); + export const POP_LATEST_STASH = Command.toLocalizedCommand({ id: 'git.stash.pop.latest', - category: 'Git', + category: GIT_CATEGORY, label: 'Pop Latest Stash' - }; - export const DROP_STASH = { + }, 'vscode.git/package/command.stashPopLatest', GIT_CATEGORY_KEY); + export const DROP_STASH = Command.toLocalizedCommand({ id: 'git.stash.drop', - category: 'Git', + category: GIT_CATEGORY, label: 'Drop Stash...' - }; - export const REFRESH = { + }, 'vscode.git/package/command.stashDrop', GIT_CATEGORY_KEY); + export const REFRESH = Command.toLocalizedCommand({ id: 'git-refresh', label: 'Refresh', - category: 'Git', + category: GIT_CATEGORY, iconClass: codicon('refresh') - }; - export const INIT_REPOSITORY = { + }, 'vscode.git/package/command.refresh', GIT_CATEGORY_KEY); + export const INIT_REPOSITORY = Command.toLocalizedCommand({ id: 'git-init', label: 'Initialize Repository', - category: 'Git', + category: GIT_CATEGORY, iconClass: codicon('add') - }; + }, 'vscode.git/package/command.init', GIT_CATEGORY_KEY); } export namespace GIT_MENUS { // Top level Groups @@ -221,22 +240,22 @@ export namespace GIT_MENUS { export const SUBMENU_COMMIT = { group: COMMANDS_GROUP, - label: 'Commit', + label: nls.localize('vscode.git/package/submenu.commit', 'Commit'), menuGroups: ['1_commit'], }; export const SUBMENU_CHANGES = { group: COMMANDS_GROUP, - label: 'Changes', + label: nls.localize('vscode.git/package/submenu.changes', 'Changes'), menuGroups: ['1_changes'] }; export const SUBMENU_PULL_PUSH = { group: COMMANDS_GROUP, - label: 'Pull, Push', + label: nls.localize('vscode.git/package/submenu.pullpush', 'Pull, Push'), menuGroups: ['2_pull', '3_push', '4_fetch'] }; export const SUBMENU_STASH = { group: COMMANDS_GROUP, - label: 'Stash', + label: nls.localize('vscode.git/package/submenu.stash', 'Stash'), menuGroups: ['1_stash'] }; } @@ -548,7 +567,7 @@ export class GitContribution implements CommandContribution, MenuContribution, T if (lastCommit === undefined) { scmRepository.input.issue = { type: ScmInputIssueType.Error, - message: 'No previous commit to amend' + message: nls.localize('theia/git/noPreviousCommit', 'No previous commit to amend') }; scmRepository.input.focus(); return; @@ -620,7 +639,7 @@ export class GitContribution implements CommandContribution, MenuContribution, T registerItem({ id: command.id + '_fav', command: command.id, - tooltip: command.label.slice('Git: '.length), + tooltip: command.label, group: GIT_MENUS.FAV_GROUP, priority: 100 - index }) @@ -629,20 +648,20 @@ export class GitContribution implements CommandContribution, MenuContribution, T registerItem({ id: GIT_COMMANDS.COMMIT_AMEND.id, command: GIT_COMMANDS.COMMIT_AMEND.id, - tooltip: 'Commit (Amend)', + tooltip: nls.localize('vscode.git/package/command.commitStagedAmend', 'Commit (Amend)'), group: this.asSubMenuItemOf(GIT_MENUS.SUBMENU_COMMIT) }); registerItem({ id: GIT_COMMANDS.COMMIT_SIGN_OFF.id, command: GIT_COMMANDS.COMMIT_SIGN_OFF.id, - tooltip: 'Commit (Signed Off)', + tooltip: nls.localize('vscode.git/package/command.commitStagedSigned', 'Commit (Signed Off)'), group: this.asSubMenuItemOf(GIT_MENUS.SUBMENU_COMMIT) }); [GIT_COMMANDS.PULL_DEFAULT, GIT_COMMANDS.PULL].forEach(command => registerItem({ id: command.id, command: command.id, - tooltip: command.label.slice('Git: '.length), + tooltip: command.label, group: this.asSubMenuItemOf(GIT_MENUS.SUBMENU_PULL_PUSH) }) ); @@ -650,14 +669,14 @@ export class GitContribution implements CommandContribution, MenuContribution, T registerItem({ id: command.id, command: command.id, - tooltip: command.label.slice('Git: '.length), + tooltip: command.label, group: this.asSubMenuItemOf(GIT_MENUS.SUBMENU_PULL_PUSH, 1) }) ); registerItem({ id: GIT_COMMANDS.FETCH.id, command: GIT_COMMANDS.FETCH.id, - tooltip: GIT_COMMANDS.FETCH.label.slice('Git: '.length), + tooltip: GIT_COMMANDS.FETCH.label, group: this.asSubMenuItemOf(GIT_MENUS.SUBMENU_PULL_PUSH, 2) }); @@ -677,28 +696,28 @@ export class GitContribution implements CommandContribution, MenuContribution, T registerItem({ id: GIT_COMMANDS.STAGE_ALL.id, command: GIT_COMMANDS.STAGE_ALL.id, - tooltip: 'Stage All Changes', + tooltip: GIT_COMMANDS.STAGE_ALL.label, group: this.asSubMenuItemOf(GIT_MENUS.SUBMENU_CHANGES), priority: 30 }); registerItem({ id: GIT_COMMANDS.UNSTAGE_ALL.id, command: GIT_COMMANDS.UNSTAGE_ALL.id, - tooltip: 'Unstage All Changes', + tooltip: GIT_COMMANDS.UNSTAGE_ALL.label, group: this.asSubMenuItemOf(GIT_MENUS.SUBMENU_CHANGES), priority: 20 }); registerItem({ id: GIT_COMMANDS.DISCARD_ALL.id, command: GIT_COMMANDS.DISCARD_ALL.id, - tooltip: 'Discard All Changes', + tooltip: GIT_COMMANDS.DISCARD_ALL.label, group: this.asSubMenuItemOf(GIT_MENUS.SUBMENU_CHANGES), priority: 10 }); registerItem({ id: GIT_COMMANDS.MERGE.id, command: GIT_COMMANDS.MERGE.id, - tooltip: GIT_COMMANDS.MERGE.label.slice('Git: '.length), + tooltip: GIT_COMMANDS.MERGE.label, group: GIT_MENUS.COMMANDS_GROUP }); } @@ -802,7 +821,7 @@ export class GitContribution implements CommandContribution, MenuContribution, T if (this.syncService.isSyncing()) { return { title: '$(codicon-sync~spin)', - tooltip: 'Synchronizing Changes...' + tooltip: nls.localize('vscode.git/statusbar/syncing changes', 'Synchronizing Changes...') }; } const { upstreamBranch, aheadBehind } = status; @@ -810,13 +829,13 @@ export class GitContribution implements CommandContribution, MenuContribution, T return { title: '$(codicon-sync)' + (aheadBehind && (aheadBehind.ahead + aheadBehind.behind) > 0 ? ` ${aheadBehind.behind}↓ ${aheadBehind.ahead}↑` : ''), command: GIT_COMMANDS.SYNC.id, - tooltip: 'Synchronize Changes' + tooltip: nls.localize('vscode.git/repository/sync changes', 'Synchronize Changes') }; } return { title: '$(codicon-cloud-upload)', command: GIT_COMMANDS.PUBLISH.id, - tooltip: 'Publish Changes' + tooltip: nls.localize('vscode.git/statusbar/publish changes', 'Publish Changes') }; } @@ -829,7 +848,7 @@ export class GitContribution implements CommandContribution, MenuContribution, T if (!message.trim()) { scmRepository.input.issue = { type: ScmInputIssueType.Error, - message: 'Please provide a commit message' + message: nls.localize('vscode.git/repository/commitMessageWhitespacesOnlyWarning', 'Please provide a commit message') }; scmRepository.input.focus(); return; @@ -837,7 +856,7 @@ export class GitContribution implements CommandContribution, MenuContribution, T if (!scmRepository.provider.stagedChanges.length) { scmRepository.input.issue = { type: ScmInputIssueType.Error, - message: 'No changes added to commit' + message: nls.localize('vscode.git/commands/no changes', 'No changes added to commit') }; scmRepository.input.focus(); return; @@ -878,7 +897,7 @@ export class GitContribution implements CommandContribution, MenuContribution, T } catch (e) { scmRepository.input.issue = { type: ScmInputIssueType.Warning, - message: 'Make sure you configure your \'user.name\' and \'user.email\' in git.' + message: nls.localize('vscode/commands/missing user info', 'Make sure you configure your \'user.name\' and \'user.email\' in git.') }; } diff --git a/packages/git/src/browser/git-preferences.ts b/packages/git/src/browser/git-preferences.ts index 482de64530de8..97ff863aee619 100644 --- a/packages/git/src/browser/git-preferences.ts +++ b/packages/git/src/browser/git-preferences.ts @@ -16,33 +16,34 @@ import { interfaces } from '@theia/core/shared/inversify'; import { createPreferenceProxy, PreferenceProxy, PreferenceService, PreferenceContribution, PreferenceSchema } from '@theia/core/lib/browser'; +import { nls } from '@theia/core/lib/common/nls'; export const GitConfigSchema: PreferenceSchema = { 'type': 'object', 'properties': { 'git.decorations.enabled': { 'type': 'boolean', - 'description': 'Show Git file status in the navigator.', + 'description': nls.localize('vscode.git/package/config.decorations.enabled', 'Show Git file status in the navigator.'), 'default': true }, 'git.decorations.colors': { 'type': 'boolean', - 'description': 'Use color decoration in the navigator.', + 'description': nls.localize('theia/git/gitDecorationsColors', 'Use color decoration in the navigator.'), 'default': false }, 'git.editor.decorations.enabled': { 'type': 'boolean', - 'description': 'Show git decorations in the editor.', + 'description': nls.localize('theia/git/editorDecorationsEnabled', 'Show git decorations in the editor.'), 'default': true }, 'git.editor.dirtyDiff.linesLimit': { 'type': 'number', - 'description': 'Do not show dirty diff decorations, if editor\'s line count exceeds this limit.', + 'description': nls.localize('theia/git/dirtyDiffLinesLimit', 'Do not show dirty diff decorations, if editor\'s line count exceeds this limit.'), 'default': 1000 }, 'git.alwaysSignOff': { 'type': 'boolean', - 'description': 'Always sign off commits.', + 'description': nls.localize('vscode.git/package/config.alwaysSignOff', 'Always sign off commits.'), 'default': false } } diff --git a/packages/git/src/browser/git-scm-provider.ts b/packages/git/src/browser/git-scm-provider.ts index 76fab62e8988b..d8000649ca96f 100644 --- a/packages/git/src/browser/git-scm-provider.ts +++ b/packages/git/src/browser/git-scm-provider.ts @@ -33,6 +33,7 @@ import { LabelProvider } from '@theia/core/lib/browser/label-provider'; import { GitCommitDetailWidgetOptions } from './history/git-commit-detail-widget-options'; import { FileService } from '@theia/filesystem/lib/browser/file-service'; import { ScmInput } from '@theia/scm/lib/browser/scm-input'; +import { nls } from '@theia/core/lib/common/nls'; @injectable() export class GitScmProviderOptions { @@ -84,7 +85,7 @@ export class GitScmProvider implements ScmProvider { protected readonly labelProvider: LabelProvider; readonly id = 'git'; - readonly label = 'Git'; + readonly label = nls.localize('vscode.git/package/displayName', 'Git'); dispose(): void { this.toDispose.dispose(); @@ -110,8 +111,8 @@ export class GitScmProvider implements ScmProvider { get acceptInputCommand(): ScmCommand | undefined { return { command: 'git.commit.all', - tooltip: 'Commit all the staged changes', - title: 'Commit' + tooltip: nls.localize('vscode.git/package/command.commitAll', 'Commit all the staged changes'), + title: nls.localize('vscode.git/package/command.commit', 'Commit') }; } @@ -159,11 +160,16 @@ export class GitScmProvider implements ScmProvider { } } } - state.groups.push(this.createGroup('merge', 'Merge Changes', state.mergeChanges, true)); - state.groups.push(this.createGroup('index', 'Staged changes', state.stagedChanges, true)); - state.groups.push(this.createGroup('workingTree', 'Changes', state.unstagedChanges, false)); + state.groups.push(this.createGroup('merge', nls.localize('vscode.git/repository/merge changes', 'Merge Changes'), state.mergeChanges, true)); + state.groups.push(this.createGroup('index', nls.localize('vscode.git/repository/staged changes', 'Staged changes'), state.stagedChanges, true)); + state.groups.push(this.createGroup('workingTree', nls.localize('vscode.git/repository/changes', 'Changes'), state.unstagedChanges, false)); this.state = state; - this.input.placeholder = `Message (press {0} to commit${status && status.branch ? ' on \'' + status.branch + '\'' : ''})`; + if (status && status.branch) { + this.input.placeholder = nls.localize('vscode.git/repository/commitMessageWithHeadLabel', 'Message (press {0} to commit on {1})', '{0}', status.branch); + } else { + this.input.placeholder = nls.localize('vscode.git/repository/commitMessage', 'Message (press {0} to commit)'); + } + this.fireDidChange(); } @@ -392,14 +398,14 @@ export class GitScmProvider implements ScmProvider { } return new ConfirmDialog({ title: 'Discard changes', - msg: `Do you really want to discard changes in ${fileText}?` + msg: nls.localize('vscode.git/commands/confirm discard', 'Do you really want to discard changes in {0}?', fileText) }).open(); } protected confirmAll(): Promise { return new ConfirmDialog({ title: 'Discard All Changes', - msg: 'Do you really want to discard all changes?' + msg: nls.localize('vscode.git/commands/confirm discard all', 'Do you really want to discard all changes?') }).open(); } diff --git a/packages/git/src/common/git-model.ts b/packages/git/src/common/git-model.ts index a340db4f65352..9b7df15fbf3e4 100644 --- a/packages/git/src/common/git-model.ts +++ b/packages/git/src/common/git-model.ts @@ -16,6 +16,8 @@ import URI from '@theia/core/lib/common/uri'; import { Path } from '@theia/core'; +// eslint-disable-next-line @theia/runtime-import-check +import { nls } from '@theia/core/lib/common/nls'; export interface WorkingDirectoryStatus { @@ -104,12 +106,12 @@ export namespace GitFileStatus { */ export const toString = (status: GitFileStatus, staged?: boolean): string => { switch (status) { - case GitFileStatus.New: return !!staged ? 'Added' : 'Unstaged'; - case GitFileStatus.Renamed: return 'Renamed'; - case GitFileStatus.Copied: return 'Copied'; - case GitFileStatus.Modified: return 'Modified'; - case GitFileStatus.Deleted: return 'Deleted'; - case GitFileStatus.Conflicted: return 'Conflicted'; + case GitFileStatus.New: return !!staged ? nls.localize('theia/git/added', 'Added') : nls.localize('theia/git/unstaged', 'Unstaged'); + case GitFileStatus.Renamed: return nls.localize('theia/git/renamed', 'Renamed'); + case GitFileStatus.Copied: return nls.localize('theia/git/copied', 'Copied'); + case GitFileStatus.Modified: return nls.localize('vscode.git/repository/modified', 'Modified'); + case GitFileStatus.Deleted: return nls.localize('vscode.git/repository/deleted', 'Deleted'); + case GitFileStatus.Conflicted: return nls.localize('theia/git/conflicted', 'Conflicted'); default: throw new Error(`Unexpected Git file stats: ${status}.`); } }; @@ -117,7 +119,17 @@ export namespace GitFileStatus { /** * Returns with the human readable abbreviation of the Git file status argument. `staged` argument defaults to `false`. */ - export const toAbbreviation = (status: GitFileStatus, staged?: boolean): string => GitFileStatus.toString(status, staged).charAt(0); + export const toAbbreviation = (status: GitFileStatus, staged?: boolean): string => { + switch (status) { + case GitFileStatus.New: return !!staged ? 'A' : 'U'; + case GitFileStatus.Renamed: return 'R'; + case GitFileStatus.Copied: return 'C'; + case GitFileStatus.Modified: return 'M'; + case GitFileStatus.Deleted: return 'D'; + case GitFileStatus.Conflicted: return 'C'; + default: throw new Error(`Unexpected Git file stats: ${status}.`); + } + }; /** * It should be aligned with https://github.com/microsoft/vscode/blob/0dfa355b3ad185a6289ba28a99c141ab9e72d2be/extensions/git/src/repository.ts#L197 diff --git a/packages/keymaps/src/browser/keymaps-frontend-contribution.ts b/packages/keymaps/src/browser/keymaps-frontend-contribution.ts index 75b50e39c7199..bbac5bf18a7ce 100644 --- a/packages/keymaps/src/browser/keymaps-frontend-contribution.ts +++ b/packages/keymaps/src/browser/keymaps-frontend-contribution.ts @@ -23,23 +23,24 @@ import { MenuModelRegistry } from '@theia/core/lib/common'; import { AbstractViewContribution, codicon, Widget } from '@theia/core/lib/browser'; -import { CommonMenus } from '@theia/core/lib/browser/common-frontend-contribution'; +import { CommonCommands, CommonMenus } from '@theia/core/lib/browser/common-frontend-contribution'; import { KeymapsService } from './keymaps-service'; import { KeybindingRegistry } from '@theia/core/lib/browser/keybinding'; import { KeybindingWidget } from './keybindings-widget'; import { TabBarToolbarContribution, TabBarToolbarRegistry } from '@theia/core/lib/browser/shell/tab-bar-toolbar'; +import { nls } from '@theia/core/lib/common/nls'; export namespace KeymapsCommands { - export const OPEN_KEYMAPS: Command = { + export const OPEN_KEYMAPS = Command.toLocalizedCommand({ id: 'keymaps:open', - category: 'Settings', + category: CommonCommands.PREFERENCES_CATEGORY, label: 'Open Keyboard Shortcuts', - }; - export const OPEN_KEYMAPS_JSON: Command = { + }, 'vscode/preferences.contribution/openGlobalKeybindings', CommonCommands.PREFERENCES_CATEGORY_KEY); + export const OPEN_KEYMAPS_JSON = Command.toLocalizedCommand({ id: 'keymaps:openJson', - category: 'Settings', + category: CommonCommands.PREFERENCES_CATEGORY, label: 'Open Keyboard Shortcuts (JSON)', - }; + }, 'vscode/preferences.contribution/openGlobalKeybindingsFile', CommonCommands.PREFERENCES_CATEGORY_KEY); export const OPEN_KEYMAPS_JSON_TOOLBAR: Command = { id: 'keymaps:openJson.toolbar', iconClass: codicon('json') @@ -111,13 +112,13 @@ export class KeymapsFrontendContribution extends AbstractViewContribution constructor() { super({ widgetId: PROBLEMS_WIDGET_ID, - widgetName: 'Problems', + widgetName: nls.localize('vscode/markers.contribution/problems', 'Problems'), defaultWidgetOptions: { area: 'bottom' }, @@ -109,17 +110,18 @@ export class ProblemContribution extends AbstractViewContribution */ protected getStatusBarTooltip(stat: ProblemStat): string { if (stat.errors <= 0 && stat.warnings <= 0 && stat.infos <= 0) { - return 'No Problems'; + return nls.localize('vscode/markers.contribution/noProblems', 'No Problems'); } + const localize = (text: string, value: number): string => nls.localize(`vscode/markers.contribution/total${text}`, `{0} ${text}`, value.toString()); const tooltip: string[] = []; if (stat.errors > 0) { - tooltip.push(`${stat.errors} Errors`); + tooltip.push(localize('Errors', stat.errors)); } if (stat.warnings > 0) { - tooltip.push(`${stat.warnings} Warnings`); + tooltip.push(localize('Warnings', stat.warnings)); } if (stat.infos > 0) { - tooltip.push(`${stat.infos} Infos`); + tooltip.push(localize('Infos', stat.infos)); } return tooltip.join(', '); @@ -162,17 +164,17 @@ export class ProblemContribution extends AbstractViewContribution super.registerMenus(menus); menus.registerMenuAction(ProblemsMenu.CLIPBOARD, { commandId: ProblemsCommands.COPY.id, - label: 'Copy', + label: nls.localize('vscode/markers.contribution/copyMarker', 'Copy'), order: '0' }); menus.registerMenuAction(ProblemsMenu.CLIPBOARD, { commandId: ProblemsCommands.COPY_MESSAGE.id, - label: 'Copy Message', + label: nls.localize('vscode/markers.contribution/copyMessage', 'Copy Message'), order: '1' }); menus.registerMenuAction(ProblemsMenu.PROBLEMS, { commandId: ProblemsCommands.COLLAPSE_ALL.id, - label: 'Collapse All', + label: nls.localize('vscode/markers.contribution/collapseAll', 'Collapse All'), order: '2' }); } @@ -181,13 +183,13 @@ export class ProblemContribution extends AbstractViewContribution toolbarRegistry.registerItem({ id: ProblemsCommands.COLLAPSE_ALL_TOOLBAR.id, command: ProblemsCommands.COLLAPSE_ALL_TOOLBAR.id, - tooltip: 'Collapse All', + tooltip: nls.localize('vscode/markers.contribution/collapseAll', 'Collapse All'), priority: 0, }); toolbarRegistry.registerItem({ id: ProblemsCommands.CLEAR_ALL.id, command: ProblemsCommands.CLEAR_ALL.id, - tooltip: 'Clear All', + tooltip: ProblemsCommands.CLEAR_ALL.label, priority: 1, }); } diff --git a/packages/markers/src/browser/problem/problem-preferences.ts b/packages/markers/src/browser/problem/problem-preferences.ts index fe9a6ff95922d..f4de045029cf3 100644 --- a/packages/markers/src/browser/problem/problem-preferences.ts +++ b/packages/markers/src/browser/problem/problem-preferences.ts @@ -16,23 +16,24 @@ import { interfaces } from '@theia/core/shared/inversify'; import { createPreferenceProxy, PreferenceProxy, PreferenceService, PreferenceContribution, PreferenceSchema } from '@theia/core/lib/browser'; +import { nls } from '@theia/core/lib/common/nls'; export const ProblemConfigSchema: PreferenceSchema = { 'type': 'object', 'properties': { 'problems.decorations.enabled': { 'type': 'boolean', - 'description': 'Show problem decorators (diagnostic markers) in tree widgets.', + 'description': nls.localize('vscode/markersFileDecorations/markers.showOnFile', 'Show Errors & Warnings on files and folder.'), 'default': true, }, 'problems.decorations.tabbar.enabled': { 'type': 'boolean', - 'description': 'Show problem decorators (diagnostic markers) in the tab bars.', + 'description': nls.localize('theia/markers/tabbarDecorationsEnabled', 'Show problem decorators (diagnostic markers) in the tab bars.'), 'default': true }, 'problems.autoReveal': { 'type': 'boolean', - 'description': 'Controls whether Problems view should reveal markers when file is opened.', + 'description': nls.localize('vscode/messages/problems.panel.configuration.autoreveal', 'Controls whether Problems view should reveal markers when file is opened.'), 'default': true } } diff --git a/packages/markers/src/browser/problem/problem-widget.tsx b/packages/markers/src/browser/problem/problem-widget.tsx index f7c79196888b4..f8c429b952257 100644 --- a/packages/markers/src/browser/problem/problem-widget.tsx +++ b/packages/markers/src/browser/problem/problem-widget.tsx @@ -27,6 +27,7 @@ import { DiagnosticSeverity } from '@theia/core/shared/vscode-languageserver-typ import * as React from '@theia/core/shared/react'; import { ProblemPreferences } from './problem-preferences'; import { DisposableCollection } from '@theia/core/lib/common/disposable'; +import { nls } from '@theia/core/lib/common/nls'; export const PROBLEMS_WIDGET_ID = 'problems'; @@ -50,8 +51,8 @@ export class ProblemWidget extends TreeWidget { super(treeProps, model, contextMenuRenderer); this.id = PROBLEMS_WIDGET_ID; - this.title.label = 'Problems'; - this.title.caption = 'Problems'; + this.title.label = nls.localize('vscode/settingsLayout/problems', 'Problems'); + this.title.caption = this.title.label; this.title.iconClass = codicon('warning'); this.title.closable = true; this.addClass('theia-marker-container'); diff --git a/packages/messages/src/browser/notification-center-component.tsx b/packages/messages/src/browser/notification-center-component.tsx index 9c0e021694a9d..87af6056b5173 100644 --- a/packages/messages/src/browser/notification-center-component.tsx +++ b/packages/messages/src/browser/notification-center-component.tsx @@ -19,6 +19,7 @@ import { DisposableCollection } from '@theia/core'; import { NotificationManager, NotificationUpdateEvent } from './notifications-manager'; import { NotificationComponent } from './notification-component'; import { codicon } from '@theia/core/lib/browser'; +import { nls } from '@theia/core/lib/common/nls'; const PerfectScrollbar = require('react-perfect-scrollbar'); @@ -56,15 +57,19 @@ export class NotificationCenterComponent extends React.Component
{title}
    -
  • -
  • +
  • +
diff --git a/packages/messages/src/browser/notification-component.tsx b/packages/messages/src/browser/notification-component.tsx index a709c8298d3cd..bcee3cc32b9a4 100644 --- a/packages/messages/src/browser/notification-component.tsx +++ b/packages/messages/src/browser/notification-component.tsx @@ -18,6 +18,7 @@ import * as React from '@theia/core/shared/react'; import * as DOMPurify from '@theia/core/shared/dompurify'; import { NotificationManager, Notification } from './notifications-manager'; import { codicon } from '@theia/core/lib/browser'; +import { nls } from '@theia/core/lib/common/nls'; export interface NotificationComponentProps { readonly manager: NotificationManager; @@ -86,7 +87,8 @@ export class NotificationComponent extends React.Component )} - {!isProgress && (
  • )} + {!isProgress && (
  • )} {(source || !!actions.length) && ( diff --git a/packages/messages/src/browser/notification-preferences.ts b/packages/messages/src/browser/notification-preferences.ts index fb445eeeceda3..002f462546475 100644 --- a/packages/messages/src/browser/notification-preferences.ts +++ b/packages/messages/src/browser/notification-preferences.ts @@ -22,13 +22,14 @@ import { PreferenceContribution, PreferenceSchema } from '@theia/core/lib/browser/preferences'; +import { nls } from '@theia/core/lib/common/nls'; export const NotificationConfigSchema: PreferenceSchema = { 'type': 'object', 'properties': { 'notification.timeout': { 'type': 'number', - 'description': 'Informative notifications will be hidden after this timeout.', + 'description': nls.localize('theia/messages/notificationTimeout', 'Informative notifications will be hidden after this timeout.'), 'default': 30 * 1000 // `0` and negative values are treated as no timeout. } } diff --git a/packages/messages/src/browser/notifications-commands.ts b/packages/messages/src/browser/notifications-commands.ts index b061967b7875a..2c4a3ce51f040 100644 --- a/packages/messages/src/browser/notifications-commands.ts +++ b/packages/messages/src/browser/notifications-commands.ts @@ -19,23 +19,32 @@ import { codicon } from '@theia/core/lib/browser'; export namespace NotificationsCommands { + const NOTIFICATIONS_CATEGORY_KEY = 'vscode/notificationsCommands/notifications'; const NOTIFICATIONS_CATEGORY = 'Notifications'; - export const TOGGLE: Command = { + export const TOGGLE = Command.toLocalizedCommand({ id: 'notifications.commands.toggle', category: NOTIFICATIONS_CATEGORY, iconClass: codicon('list-unordered'), label: 'Toggle Notifications' - }; + }, 'theia/messages/toggleNotifications', NOTIFICATIONS_CATEGORY_KEY); - export const HIDE: Command = { + export const SHOW = Command.toLocalizedCommand({ + id: 'notifications.commands.show', + category: NOTIFICATIONS_CATEGORY, + label: 'Show Notifications' + }, 'vscode/notificationsCommands/showNotifications', NOTIFICATIONS_CATEGORY_KEY); + + export const HIDE = Command.toLocalizedCommand({ id: 'notifications.commands.hide', - }; + category: NOTIFICATIONS_CATEGORY, + label: 'Hide Notifications' + }, 'vscode/notificationsCommands/hideNotifications', NOTIFICATIONS_CATEGORY_KEY); - export const CLEAR_ALL: Command = { + export const CLEAR_ALL = Command.toLocalizedCommand({ id: 'notifications.commands.clearAll', category: NOTIFICATIONS_CATEGORY, iconClass: codicon('clear-all'), label: 'Clear All Notifications' - }; + }, 'vscode/notificationsCommands/clearAllNotifications', NOTIFICATIONS_CATEGORY_KEY); } diff --git a/packages/messages/src/browser/notifications-contribution.ts b/packages/messages/src/browser/notifications-contribution.ts index b72d0b589feea..82155010da988 100644 --- a/packages/messages/src/browser/notifications-contribution.ts +++ b/packages/messages/src/browser/notifications-contribution.ts @@ -25,6 +25,7 @@ import { NotificationManager } from './notifications-manager'; import { NotificationsRenderer } from './notifications-renderer'; import { ColorContribution } from '@theia/core/lib/browser/color-application-contribution'; import { ColorRegistry, Color } from '@theia/core/lib/browser/color-registry'; +import { nls } from '@theia/core/lib/common/nls'; @injectable() export class NotificationsContribution implements FrontendApplicationContribution, CommandContribution, KeybindingContribution, ColorContribution { @@ -62,11 +63,13 @@ export class NotificationsContribution implements FrontendApplicationContributio } protected getStatusBarItemTooltip(count: number): string { if (this.manager.centerVisible) { - return 'Hide Notifications'; + return nls.localize('vscode/notificationsCommands/hideNotifications', 'Hide Notifications'); } return count === 0 - ? 'No Notifications' - : count === 1 ? '1 Notification' : `${count} Notifications`; + ? nls.localize('vscode/notificationsStatus/zeroNotifications', 'No Notifications') + : count === 1 + ? nls.localize('vscode/notificationsStatus/oneNotification', '1 Notification') + : nls.localize('vscode/notificationsStatus/notifications', '{0} Notifications', count.toString()); } registerCommands(commands: CommandRegistry): void { @@ -74,6 +77,10 @@ export class NotificationsContribution implements FrontendApplicationContributio isEnabled: () => true, execute: () => this.manager.toggleCenter() }); + commands.registerCommand(NotificationsCommands.SHOW, { + isEnabled: () => true, + execute: () => this.manager.showCenter() + }); commands.registerCommand(NotificationsCommands.HIDE, { execute: () => this.manager.hide() }); diff --git a/packages/messages/src/browser/notifications-manager.ts b/packages/messages/src/browser/notifications-manager.ts index 2532f69f2368a..7b5fc90f892ab 100644 --- a/packages/messages/src/browser/notifications-manager.ts +++ b/packages/messages/src/browser/notifications-manager.ts @@ -112,6 +112,9 @@ export class NotificationManager extends MessageClient { hideCenter(): void { this.setVisibilityState('hidden'); } + showCenter(): void { + this.setVisibilityState('center'); + } toggleCenter(): void { this.setVisibilityState(this.centerVisible ? 'hidden' : 'center'); } diff --git a/packages/mini-browser/src/browser/mini-browser-frontend-security-warnings.ts b/packages/mini-browser/src/browser/mini-browser-frontend-security-warnings.ts index ed6da3af330f1..3f8c33ace2b03 100644 --- a/packages/mini-browser/src/browser/mini-browser-frontend-security-warnings.ts +++ b/packages/mini-browser/src/browser/mini-browser-frontend-security-warnings.ts @@ -15,8 +15,9 @@ ********************************************************************************/ import { MessageService } from '@theia/core'; -import { FrontendApplicationContribution } from '@theia/core/lib/browser'; +import { Dialog, FrontendApplicationContribution } from '@theia/core/lib/browser'; import { FrontendApplicationConfigProvider } from '@theia/core/lib/browser/frontend-application-config-provider'; +import { nls } from '@theia/core/lib/common/nls'; import { WindowService } from '@theia/core/lib/browser/window/window-service'; import { inject, injectable } from '@theia/core/shared/inversify'; import { MiniBrowserEndpoint } from '../common/mini-browser-endpoint'; @@ -44,12 +45,12 @@ export class MiniBrowserFrontendSecurityWarnings implements FrontendApplicationC } const hostPattern = await this.miniBrowserEnvironment.hostPatternPromise; if (hostPattern !== MiniBrowserEndpoint.HOST_PATTERN_DEFAULT) { - this.messageService.warn(`\ -The mini-browser endpoint's host pattern has been changed to \`${hostPattern}\`; changing the pattern can lead to security vulnerabilities. \ -See \`@theia/mini-browser/README.md\` for more information.`, - /* actions: */ 'Ok', 'Go To README', - ).then(action => { - if (action === 'Go To README') { + const goToReadme = nls.localize('theia/webview/goToReadme', 'Go To README'); + const message = nls.localize('theia/webview/messageWarning', '\ + The {0} endpoint\'s host pattern has been changed to `{1}`; changing the pattern can lead to security vulnerabilities. \ + See `{2}` for more information.', 'mini-browser', hostPattern, '@theia/mini-browser/README.md'); + this.messageService.warn(message, Dialog.OK, goToReadme).then(action => { + if (action === goToReadme) { this.windowService.openNewWindow('https://www.npmjs.com/package/@theia/mini-browser', { external: true }); } }); diff --git a/packages/mini-browser/src/browser/mini-browser-open-handler.ts b/packages/mini-browser/src/browser/mini-browser-open-handler.ts index 4b4fce89cc487..6c0a0584d1ae0 100644 --- a/packages/mini-browser/src/browser/mini-browser-open-handler.ts +++ b/packages/mini-browser/src/browser/mini-browser-open-handler.ts @@ -31,22 +31,27 @@ import { WidgetOpenerOptions } from '@theia/core/lib/browser/widget-open-handler import { MiniBrowserService } from '../common/mini-browser-service'; import { MiniBrowser, MiniBrowserProps } from './mini-browser'; import { LocationMapperService } from './location-mapper-service'; +import { nls } from '@theia/core/lib/common/nls'; export namespace MiniBrowserCommands { - export const PREVIEW: Command = { + + export const PREVIEW_CATEGORY_KEY = 'vscode/extensionEditor/preview'; + export const PREVIEW_CATEGORY = 'Preview'; + + export const PREVIEW = Command.toLocalizedCommand({ id: 'mini-browser.preview', label: 'Open Preview', iconClass: codicon('open-preview') - }; + }, 'vscode/mainThreadFileSystemEventService/preview'); export const OPEN_SOURCE: Command = { id: 'mini-browser.open.source', iconClass: codicon('go-to-file') }; - export const OPEN_URL: Command = { + export const OPEN_URL = Command.toLocalizedCommand({ id: 'mini-browser.openUrl', - category: 'Preview', + category: PREVIEW_CATEGORY, label: 'Open URL' - }; + }, 'vscode/url.contribution/openUrl', PREVIEW_CATEGORY_KEY); } /** @@ -78,7 +83,7 @@ export class MiniBrowserOpenHandler extends NavigatableWidgetOpenHandler = new Map(); readonly id = MiniBrowser.ID; - readonly label = 'Preview'; + readonly label = nls.localize(MiniBrowserCommands.PREVIEW_CATEGORY_KEY, MiniBrowserCommands.PREVIEW_CATEGORY); @inject(OpenerService) protected readonly openerService: OpenerService; @@ -215,12 +220,12 @@ export class MiniBrowserOpenHandler extends NavigatableWidgetOpenHandler { const url = arg ? arg : await this.quickInputService?.input({ - prompt: 'URL to open', - placeHolder: 'Type a URL' + prompt: nls.localize('vscode/url.contribution/urlToOpen', 'URL to open'), + placeHolder: nls.localize('theia/mini-browser/typeUrl', 'Type a URL') }); if (url) { await this.openPreview(url); @@ -292,7 +297,7 @@ export class MiniBrowserOpenHandler extends NavigatableWidgetOpenHandler { const resetBackground = await this.resetBackground(new URI(startPage)); return { - name: 'Preview', + name: nls.localize(MiniBrowserCommands.PREVIEW_CATEGORY_KEY, MiniBrowserCommands.PREVIEW_CATEGORY), startPage, toolbar: 'read-only', widgetOptions: { diff --git a/packages/monaco/src/browser/monaco-command.ts b/packages/monaco/src/browser/monaco-command.ts index bff6ef444de11..b444c5bdbb946 100644 --- a/packages/monaco/src/browser/monaco-command.ts +++ b/packages/monaco/src/browser/monaco-command.ts @@ -24,6 +24,7 @@ import { MonacoCommandRegistry, MonacoEditorCommandHandler } from './monaco-comm import { MonacoEditorService } from './monaco-editor-service'; import { MonacoTextModelService } from './monaco-text-model-service'; import { ProtocolToMonacoConverter } from './protocol-to-monaco-converter'; +import { nls } from '@theia/core/lib/common/nls'; export namespace MonacoCommands { @@ -215,11 +216,10 @@ export class MonacoEditorCommandHandlers implements CommandContribution { } protected configureIndentation(editor: MonacoEditor): void { const items = [true, false].map(useSpaces => ({ - label: `Indent Using ${useSpaces ? 'Spaces' : 'Tabs'}`, + label: nls.localize(`vscode/indentation/indentUsing${useSpaces ? 'Spaces' : 'Tabs'}`, `Indent Using ${useSpaces ? 'Spaces' : 'Tabs'}`), execute: () => this.configureTabSize(editor, useSpaces) - }) - ); - this.quickInputService?.showQuickPick(items, { placeholder: 'Select Action' }); + })); + this.quickInputService?.showQuickPick(items, { placeholder: nls.localize('vscode/editorStatus/pickAction', 'Select Action') }); } protected newConfigEolHandler(): MonacoEditorCommandHandler { @@ -235,7 +235,7 @@ export class MonacoEditorCommandHandlers implements CommandContribution { execute: () => this.setEol(editor, lineEnding) }) ); - this.quickInputService?.showQuickPick(items, { placeholder: 'Select End of Line Sequence' }); + this.quickInputService?.showQuickPick(items, { placeholder: nls.localize('vscode/editorStatus/selectEOL', 'Select End of Line Sequence') }); } protected setEol(editor: MonacoEditor, lineEnding: string): void { @@ -261,7 +261,7 @@ export class MonacoEditorCommandHandlers implements CommandContribution { const sizes = Array.from(Array(8), (_, x) => x + 1); const tabSizeOptions = sizes.map(size => ({ - label: size === tabSize ? `${size} Configured Tab Size` : size.toString(), + label: size === tabSize ? size + ' ' + nls.localize('vscode/indentation/configuredTabSize', 'Configured Tab Size') : size.toString(), // eslint-disable-next-line @typescript-eslint/no-explicit-any execute: () => model.updateOptions({ tabSize: size || tabSize, @@ -269,7 +269,7 @@ export class MonacoEditorCommandHandlers implements CommandContribution { }) }) ); - this.quickInputService?.showQuickPick(tabSizeOptions, { placeholder: 'Select Tab Size for Current File' }); + this.quickInputService?.showQuickPick(tabSizeOptions, { placeholder: nls.localize('vscode/indentation/selectTabWidth', 'Select Tab Size for Current File') }); } } diff --git a/packages/monaco/src/browser/monaco-menu.ts b/packages/monaco/src/browser/monaco-menu.ts index e0c02baaf4f44..b458542680283 100644 --- a/packages/monaco/src/browser/monaco-menu.ts +++ b/packages/monaco/src/browser/monaco-menu.ts @@ -18,6 +18,7 @@ import { injectable, inject } from '@theia/core/shared/inversify'; import { MenuContribution, MenuModelRegistry, MAIN_MENU_BAR, MenuPath } from '@theia/core/lib/common'; import { EDITOR_CONTEXT_MENU } from '@theia/editor/lib/browser'; import { MonacoCommandRegistry } from './monaco-command-registry'; +import { nls } from '@theia/core/lib/common/nls'; import MenuRegistry = monaco.actions.MenuRegistry; export interface MonacoActionGroup { @@ -50,7 +51,7 @@ export class MonacoEditorMenuContribution implements MenuContribution { this.registerPeekSubmenu(registry); - registry.registerSubmenu(MonacoMenus.SELECTION, 'Selection'); + registry.registerSubmenu(MonacoMenus.SELECTION, nls.localize('vscode/menubar/mSelection', 'Selection')); for (const item of MenuRegistry.getMenuItems(monaco.actions.MenuId.MenubarSelectionMenu)) { if (!monaco.actions.isIMenuItem(item)) { continue; @@ -67,7 +68,7 @@ export class MonacoEditorMenuContribution implements MenuContribution { } protected registerPeekSubmenu(registry: MenuModelRegistry): void { - registry.registerSubmenu(MonacoMenus.PEEK_CONTEXT_SUBMENU, 'Peek'); + registry.registerSubmenu(MonacoMenus.PEEK_CONTEXT_SUBMENU, nls.localize('vscode/goToCommands/peek.submenu', 'Peek')); for (const item of MenuRegistry.getMenuItems(monaco.actions.MenuId.EditorContextPeek)) { if (!monaco.actions.isIMenuItem(item)) { diff --git a/packages/monaco/src/browser/workspace-symbol-command.ts b/packages/monaco/src/browser/workspace-symbol-command.ts index 3ade3079ac0a8..8f52746700574 100644 --- a/packages/monaco/src/browser/workspace-symbol-command.ts +++ b/packages/monaco/src/browser/workspace-symbol-command.ts @@ -19,7 +19,7 @@ import { environment } from '@theia/core/shared/@theia/application-package/lib/e import { KeybindingContribution, KeybindingRegistry, OpenerService, LabelProvider } from '@theia/core/lib/browser'; import { QuickAccessContribution, QuickAccessProvider, QuickInputService, QuickAccessRegistry, QuickPicks, QuickPickItem, findMatches } from '@theia/core/lib/browser/quick-input'; -import { CommandRegistry, CommandHandler, Command, SelectionService, CancellationToken, CommandContribution } from '@theia/core/lib/common'; +import { CommandRegistry, CommandHandler, Command, SelectionService, CancellationToken, CommandContribution, nls } from '@theia/core/lib/common'; import { Range, Position, SymbolInformation } from '@theia/core/shared/vscode-languageserver-types'; import { WorkspaceSymbolParams } from '@theia/core/shared/vscode-languageserver-protocol'; import { MonacoLanguages, WorkspaceSymbolProvider } from './monaco-languages'; @@ -29,10 +29,10 @@ import URI from '@theia/core/lib/common/uri'; export class WorkspaceSymbolCommand implements QuickAccessProvider, CommandContribution, KeybindingContribution, CommandHandler, QuickAccessContribution { public static readonly PREFIX = '#'; - private command: Command = { + private command = Command.toLocalizedCommand({ id: 'languages.workspace.symbol', label: 'Go to Symbol in Workspace...' - }; + }, 'vscode/search.contribution/showTriggerActions'); @inject(MonacoLanguages) protected readonly languages: MonacoLanguages; @inject(OpenerService) protected readonly openerService: OpenerService; @@ -69,7 +69,7 @@ export class WorkspaceSymbolCommand implements QuickAccessProvider, CommandContr getInstance: () => this, prefix: WorkspaceSymbolCommand.PREFIX, placeholder: '', - helpEntries: [{ description: 'Go to Symbol in Workspace', needsEditor: false }] + helpEntries: [{ description: nls.localize('vscode/search.contribution/symbolsQuickAccess', 'Go to Symbol in Workspace'), needsEditor: false }] }); } @@ -97,7 +97,9 @@ export class WorkspaceSymbolCommand implements QuickAccessProvider, CommandContr const filteredSymbols = symbols.filter(el => el && el.length !== 0); if (filteredSymbols.length === 0) { items.push({ - label: filter.length === 0 ? 'Type to search for symbols' : 'No symbols matching', + label: filter.length === 0 + ? nls.localize('theia/monaco/typeToSearchForSymbols', 'Type to search for symbols') + : nls.localize('theia/monaco/noSymbolsMatching', 'No symbols matching'), }); } }).catch(); diff --git a/packages/navigator/src/browser/navigator-contribution.ts b/packages/navigator/src/browser/navigator-contribution.ts index c61a2014bbd9e..70d2bf33285c4 100644 --- a/packages/navigator/src/browser/navigator-contribution.ts +++ b/packages/navigator/src/browser/navigator-contribution.ts @@ -53,7 +53,7 @@ import { WorkspacePreferences, WorkspaceService } from '@theia/workspace/lib/browser'; -import { EXPLORER_VIEW_CONTAINER_ID } from './navigator-widget-factory'; +import { EXPLORER_VIEW_CONTAINER_ID, EXPLORER_VIEW_CONTAINER_TITLE_OPTIONS } from './navigator-widget-factory'; import { FILE_NAVIGATOR_ID, FileNavigatorWidget } from './navigator-widget'; import { FileNavigatorPreferences } from './navigator-preferences'; import { NavigatorKeybindingContexts } from './navigator-keybinding-context'; @@ -77,50 +77,51 @@ import URI from '@theia/core/lib/common/uri'; import { OpenEditorsWidget } from './open-editors-widget/navigator-open-editors-widget'; import { OpenEditorsContextMenu } from './open-editors-widget/navigator-open-editors-menus'; import { OpenEditorsCommands } from './open-editors-widget/navigator-open-editors-commands'; +import { nls } from '@theia/core/lib/common/nls'; export namespace FileNavigatorCommands { - export const REVEAL_IN_NAVIGATOR: Command = { + export const REVEAL_IN_NAVIGATOR = Command.toLocalizedCommand({ id: 'navigator.reveal', label: 'Reveal in Explorer' - }; - export const TOGGLE_HIDDEN_FILES: Command = { + }, 'theia/navigator/reveal'); + export const TOGGLE_HIDDEN_FILES = Command.toLocalizedCommand({ id: 'navigator.toggle.hidden.files', label: 'Toggle Hidden Files' - }; - export const TOGGLE_AUTO_REVEAL: Command = { + }, 'theia/navigator/toggleHiddenFiles'); + export const TOGGLE_AUTO_REVEAL = Command.toLocalizedCommand({ id: 'navigator.toggle.autoReveal', - category: 'File', + category: CommonCommands.FILE_CATEGORY, label: 'Auto Reveal' - }; - export const REFRESH_NAVIGATOR: Command = { + }, 'theia/navigator/autoReveal', CommonCommands.FILE_CATEGORY_KEY); + export const REFRESH_NAVIGATOR = Command.toLocalizedCommand({ id: 'navigator.refresh', - category: 'File', + category: CommonCommands.FILE_CATEGORY, label: 'Refresh in Explorer', iconClass: codicon('refresh') - }; - export const COLLAPSE_ALL: Command = { + }, 'theia/navigator/refresh', CommonCommands.FILE_CATEGORY_KEY); + export const COLLAPSE_ALL = Command.toLocalizedCommand({ id: 'navigator.collapse.all', - category: 'File', + category: CommonCommands.FILE_CATEGORY, label: 'Collapse Folders in Explorer', iconClass: codicon('collapse-all') - }; + }, 'vscode/explorerView/collapseExplorerFolders', CommonCommands.FILE_CATEGORY_KEY); export const ADD_ROOT_FOLDER: Command = { id: 'navigator.addRootFolder' }; - export const FOCUS: Command = { + export const FOCUS = Command.toLocalizedCommand({ id: 'workbench.files.action.focusFilesExplorer', - category: 'File', + category: CommonCommands.FILE_CATEGORY, label: 'Focus on Files Explorer' - }; - export const COPY_RELATIVE_FILE_PATH: Command = { + }, 'vscode/fileActions/focusFilesExplorer', CommonCommands.FILE_CATEGORY_KEY); + export const COPY_RELATIVE_FILE_PATH = Command.toLocalizedCommand({ id: 'navigator.copyRelativeFilePath', label: 'Copy Relative Path' - }; - export const OPEN: Command = { + }, 'vscode/fileActions.contribution/copyRelativePath'); + export const OPEN = Command.toLocalizedCommand({ id: 'navigator.open', - category: 'File', + category: CommonCommands.FILE_CATEGORY, label: 'Open' - }; + }, 'vscode/dialogMainService/open', CommonCommands.FILE_CATEGORY_KEY); } /** @@ -206,7 +207,7 @@ export class FileNavigatorContribution extends AbstractViewContribution { for (const opener of openers) { const openWithCommand = WorkspaceCommands.FILE_OPEN_WITH(opener); @@ -499,7 +500,7 @@ export class FileNavigatorContribution extends AbstractViewContribution
    You have not yet added a folder to the workspace.
    diff --git a/packages/navigator/src/browser/open-editors-widget/navigator-open-editors-commands.ts b/packages/navigator/src/browser/open-editors-widget/navigator-open-editors-commands.ts index 504cceca2fd44..e1219b49fa87a 100644 --- a/packages/navigator/src/browser/open-editors-widget/navigator-open-editors-commands.ts +++ b/packages/navigator/src/browser/open-editors-widget/navigator-open-editors-commands.ts @@ -14,34 +14,35 @@ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 ********************************************************************************/ +import { CommonCommands } from '@theia/core/lib/browser'; import { Command } from '@theia/core/lib/common'; export namespace OpenEditorsCommands { - export const CLOSE_ALL_TABS_FROM_TOOLBAR: Command = { + export const CLOSE_ALL_TABS_FROM_TOOLBAR = Command.toLocalizedCommand({ id: 'navigator.close.all.editors.toolbar', - category: 'File', + category: CommonCommands.FILE_CATEGORY, label: 'Close All Editors', iconClass: 'codicon codicon-close-all' - }; + }, 'vscode/editorActions/closeAllEditors', CommonCommands.FILE_CATEGORY_KEY); - export const SAVE_ALL_TABS_FROM_TOOLBAR: Command = { + export const SAVE_ALL_TABS_FROM_TOOLBAR = Command.toLocalizedCommand({ id: 'navigator.save.all.editors.toolbar', - category: 'File', + category: CommonCommands.FILE_CATEGORY, label: 'Save All Editors', iconClass: 'codicon codicon-save-all' - }; + }, 'vscode/fileActions.contribution/saveFiles', CommonCommands.FILE_CATEGORY_KEY); - export const CLOSE_ALL_EDITORS_IN_GROUP_FROM_ICON: Command = { + export const CLOSE_ALL_EDITORS_IN_GROUP_FROM_ICON = Command.toLocalizedCommand({ id: 'navigator.close.all.in.area.icon', - category: 'View', + category: CommonCommands.VIEW_CATEGORY, label: 'Close Group', iconClass: 'codicon codicon-close-all' - }; + }, 'vscode/fileActions/closeGroup', CommonCommands.VIEW_CATEGORY_KEY); - export const SAVE_ALL_IN_GROUP_FROM_ICON: Command = { + export const SAVE_ALL_IN_GROUP_FROM_ICON = Command.toLocalizedCommand({ id: 'navigator.save.all.in.area.icon', - category: 'File', + category: CommonCommands.FILE_CATEGORY, label: 'Save All in Group', iconClass: 'codicon codicon-save-all' - }; + }, 'vscode/fileActions.contribution/saveAllInGroup', CommonCommands.FILE_CATEGORY_KEY); } diff --git a/packages/navigator/src/browser/open-editors-widget/navigator-open-editors-widget.tsx b/packages/navigator/src/browser/open-editors-widget/navigator-open-editors-widget.tsx index 1e4e957ff06b1..2fb67afa70408 100644 --- a/packages/navigator/src/browser/open-editors-widget/navigator-open-editors-widget.tsx +++ b/packages/navigator/src/browser/open-editors-widget/navigator-open-editors-widget.tsx @@ -38,6 +38,7 @@ import { OpenEditorsTreeDecoratorService } from './navigator-open-editors-decora import { OPEN_EDITORS_CONTEXT_MENU } from './navigator-open-editors-menus'; import { CommandService } from '@theia/core/lib/common'; import { OpenEditorsCommands } from './navigator-open-editors-commands'; +import { nls } from '@theia/core/lib/common/nls'; export const OPEN_EDITORS_PROPS: TreeProps = { ...defaultTreeProps, @@ -51,7 +52,7 @@ export interface OpenEditorsNodeRow extends TreeWidget.NodeRow { @injectable() export class OpenEditorsWidget extends FileTreeWidget { static ID = 'theia-open-editors-widget'; - static LABEL = 'Open Editors'; + static LABEL = nls.localize('vscode/openEditorsView/openEditors', 'Open Editors'); @inject(ApplicationShell) protected readonly applicationShell: ApplicationShell; @inject(CommandService) protected readonly commandService: CommandService; diff --git a/packages/outline-view/src/browser/outline-view-contribution.ts b/packages/outline-view/src/browser/outline-view-contribution.ts index db1dd6f6c3bee..2aa0bc88d6bd7 100644 --- a/packages/outline-view/src/browser/outline-view-contribution.ts +++ b/packages/outline-view/src/browser/outline-view-contribution.ts @@ -23,6 +23,7 @@ import { codicon, Widget } from '@theia/core/lib/browser/widgets'; import { OutlineViewWidget } from './outline-view-widget'; import { CompositeTreeNode } from '@theia/core/lib/browser/tree'; import { OS } from '@theia/core/lib/common/os'; +import { nls } from '@theia/core/lib/common/nls'; export const OUTLINE_WIDGET_FACTORY_ID = 'outline-view'; @@ -46,7 +47,7 @@ export class OutlineViewContribution extends AbstractViewContribution(); constructor( @@ -83,8 +86,8 @@ export class OutlineViewWidget extends TreeWidget { super(treeProps, model, contextMenuRenderer); this.id = 'outline-view'; - this.title.label = 'Outline'; - this.title.caption = 'Outline'; + this.title.label = OutlineViewWidget.LABEL; + this.title.caption = OutlineViewWidget.LABEL; this.title.closable = true; this.title.iconClass = codicon('symbol-class'); this.addClass('theia-outline-view'); @@ -104,7 +107,7 @@ export class OutlineViewWidget extends TreeWidget { protected getRoot(children: TreeNode[]): CompositeTreeNode { return { id: 'outline-view-root', - name: 'Outline Root', + name: OutlineViewWidget.LABEL, visible: false, children, parent: undefined @@ -177,7 +180,7 @@ export class OutlineViewWidget extends TreeWidget { protected renderTree(model: TreeModel): React.ReactNode { if (CompositeTreeNode.is(this.model.root) && !this.model.root.children.length) { - return
    No outline information available.
    ; + return
    {nls.localize('vscode/outlinePane/no-editor', 'No outline information available.')}
    ; } return super.renderTree(model); } diff --git a/packages/output/src/browser/output-commands.ts b/packages/output/src/browser/output-commands.ts index 80f99b599c47d..7680175af8726 100644 --- a/packages/output/src/browser/output-commands.ts +++ b/packages/output/src/browser/output-commands.ts @@ -19,6 +19,7 @@ import { Command } from '@theia/core/lib/common'; export namespace OutputCommands { + const OUTPUT_CATEGORY_KEY = 'vscode/outputView/output'; const OUTPUT_CATEGORY = 'Output'; /* #region VS Code `OutputChannel` API */ @@ -50,47 +51,47 @@ export namespace OutputCommands { /* #endregion VS Code `OutputChannel` API */ - export const CLEAR__WIDGET: Command = { + export const CLEAR__WIDGET = Command.toLocalizedCommand({ id: 'output:widget:clear', category: OUTPUT_CATEGORY, iconClass: codicon('clear-all') - }; + }, '', OUTPUT_CATEGORY_KEY); - export const LOCK__WIDGET: Command = { + export const LOCK__WIDGET = Command.toLocalizedCommand({ id: 'output:widget:lock', category: OUTPUT_CATEGORY, iconClass: codicon('unlock') - }; + }, '', OUTPUT_CATEGORY_KEY); - export const UNLOCK__WIDGET: Command = { + export const UNLOCK__WIDGET = Command.toLocalizedCommand({ id: 'output:widget:unlock', category: OUTPUT_CATEGORY, iconClass: codicon('lock') - }; + }, '', OUTPUT_CATEGORY_KEY); - export const CLEAR__QUICK_PICK: Command = { + export const CLEAR__QUICK_PICK = Command.toLocalizedCommand({ id: 'output:pick-clear', label: 'Clear Output Channel...', category: OUTPUT_CATEGORY - }; + }, 'theia/output/clearOutputChannel', OUTPUT_CATEGORY_KEY); - export const SHOW__QUICK_PICK: Command = { + export const SHOW__QUICK_PICK = Command.toLocalizedCommand({ id: 'output:pick-show', label: 'Show Output Channel...', category: OUTPUT_CATEGORY - }; + }, 'theia/output/showOutputChannel', OUTPUT_CATEGORY_KEY); - export const HIDE__QUICK_PICK: Command = { + export const HIDE__QUICK_PICK = Command.toLocalizedCommand({ id: 'output:pick-hide', label: 'Hide Output Channel...', category: OUTPUT_CATEGORY - }; + }, 'theia/output/hideOutputChannel', OUTPUT_CATEGORY_KEY); - export const DISPOSE__QUICK_PICK: Command = { + export const DISPOSE__QUICK_PICK = Command.toLocalizedCommand({ id: 'output:pick-dispose', label: 'Close Output Channel...', category: OUTPUT_CATEGORY - }; + }, 'theia/output/closeOutputChannel', OUTPUT_CATEGORY_KEY); export const COPY_ALL: Command = { id: 'output:copy-all', diff --git a/packages/output/src/browser/output-contribution.ts b/packages/output/src/browser/output-contribution.ts index e1e6db88e2ca8..9121e8c775dc3 100644 --- a/packages/output/src/browser/output-contribution.ts +++ b/packages/output/src/browser/output-contribution.ts @@ -28,6 +28,7 @@ import { ClipboardService } from '@theia/core/lib/browser/clipboard-service'; import { OutputChannelManager, OutputChannel } from './output-channel'; import { OutputCommands } from './output-commands'; import { QuickPickService } from '@theia/core/lib/common/quick-pick-service'; +import { nls } from '@theia/core/lib/common/nls'; @injectable() export class OutputContribution extends AbstractViewContribution implements OpenHandler { @@ -52,7 +53,7 @@ export class OutputContribution extends AbstractViewContribution i constructor() { super({ widgetId: OutputWidget.ID, - widgetName: 'Output', + widgetName: OutputWidget.LABEL, defaultWidgetOptions: { area: 'bottom' }, @@ -162,7 +163,7 @@ export class OutputContribution extends AbstractViewContribution i registry.registerCommand(OutputCommands.CLEAR__QUICK_PICK, { execute: async () => { const channel = await this.pick({ - placeholder: 'Clear output channel.', + placeholder: OutputCommands.CLEAR__QUICK_PICK.label!, channels: this.outputChannelManager.getChannels().slice() }); if (channel) { @@ -175,7 +176,7 @@ export class OutputContribution extends AbstractViewContribution i registry.registerCommand(OutputCommands.SHOW__QUICK_PICK, { execute: async () => { const channel = await this.pick({ - placeholder: 'Show output channel.', + placeholder: OutputCommands.SHOW__QUICK_PICK.label!, channels: this.outputChannelManager.getChannels().slice() }); if (channel) { @@ -189,7 +190,7 @@ export class OutputContribution extends AbstractViewContribution i registry.registerCommand(OutputCommands.HIDE__QUICK_PICK, { execute: async () => { const channel = await this.pick({ - placeholder: 'Hide output channel.', + placeholder: OutputCommands.HIDE__QUICK_PICK.label!, channels: this.outputChannelManager.getVisibleChannels().slice() }); if (channel) { @@ -203,7 +204,7 @@ export class OutputContribution extends AbstractViewContribution i registry.registerCommand(OutputCommands.DISPOSE__QUICK_PICK, { execute: async () => { const channel = await this.pick({ - placeholder: 'Close output channel.', + placeholder: OutputCommands.DISPOSE__QUICK_PICK.label!, channels: this.outputChannelManager.getChannels().slice() }); if (channel) { @@ -223,15 +224,15 @@ export class OutputContribution extends AbstractViewContribution i }); registry.registerMenuAction(OutputContextMenu.TEXT_EDIT_GROUP, { commandId: OutputCommands.COPY_ALL.id, - label: 'Copy All' + label: nls.localize('vscode/search.contribution/copyAllLabel', 'Copy All') }); registry.registerMenuAction(OutputContextMenu.COMMAND_GROUP, { commandId: quickCommand.id, - label: 'Find Command...' + label: nls.localize('vscode/quickAccess.contribution/commandsQuickAccess', 'Find Command...') }); registry.registerMenuAction(OutputContextMenu.WIDGET_GROUP, { commandId: OutputCommands.CLEAR__WIDGET.id, - label: 'Clear Output' + label: nls.localize('vscode/output.contribution/clearOutput.label', 'Clear Output') }); } @@ -256,12 +257,14 @@ export class OutputContribution extends AbstractViewContribution i protected async pick({ channels, placeholder }: { channels: OutputChannel[], placeholder: string }): Promise { const items: Array | QuickPickItem> = []; + const outputChannels = nls.localize('theia/output/outputChannels', 'Output Channels'); + const hiddenChannels = nls.localize('theia/output/hiddenChannels', 'Hidden Channels'); for (let i = 0; i < channels.length; i++) { const channel = channels[i]; if (i === 0) { - items.push({ label: channel.isVisible ? 'Output Channels' : 'Hidden Channels', type: 'separator' }); + items.push({ label: channel.isVisible ? outputChannels : hiddenChannels, type: 'separator' }); } else if (!channel.isVisible && channels[i - 1].isVisible) { - items.push({ label: 'Hidden Channels', type: 'separator' }); + items.push({ label: hiddenChannels, type: 'separator' }); } items.push({ label: channel.name, value: channel }); } diff --git a/packages/output/src/browser/output-preferences.ts b/packages/output/src/browser/output-preferences.ts index f0bcb8c2e6304..592a3d88f723e 100644 --- a/packages/output/src/browser/output-preferences.ts +++ b/packages/output/src/browser/output-preferences.ts @@ -22,13 +22,14 @@ import { PreferenceService, createPreferenceProxy } from '@theia/core/lib/browser/preferences'; +import { nls } from '@theia/core/lib/common/nls'; export const OutputConfigSchema: PreferenceSchema = { 'type': 'object', 'properties': { 'output.maxChannelHistory': { 'type': 'number', - 'description': 'The maximum number of entries in an output channel.', + 'description': nls.localize('theia/output/maxChannelHistory', 'The maximum number of entries in an output channel.'), 'default': 1000 } } diff --git a/packages/output/src/browser/output-toolbar-contribution.tsx b/packages/output/src/browser/output-toolbar-contribution.tsx index 8ba4648f81bd2..a1c8f8774c635 100644 --- a/packages/output/src/browser/output-toolbar-contribution.tsx +++ b/packages/output/src/browser/output-toolbar-contribution.tsx @@ -22,6 +22,7 @@ import { OutputWidget } from './output-widget'; import { OutputCommands } from './output-commands'; import { OutputContribution } from './output-contribution'; import { OutputChannelManager } from './output-channel'; +import { nls } from '@theia/core/lib/common/nls'; @injectable() export class OutputToolbarContribution implements TabBarToolbarContribution { @@ -61,20 +62,20 @@ export class OutputToolbarContribution implements TabBarToolbarContribution { toolbarRegistry.registerItem({ id: OutputCommands.CLEAR__WIDGET.id, command: OutputCommands.CLEAR__WIDGET.id, - tooltip: 'Clear Output', + tooltip: nls.localize('vscode/output.contribution/clearOutput.label', 'Clear Output'), priority: 1, }); toolbarRegistry.registerItem({ id: OutputCommands.LOCK__WIDGET.id, command: OutputCommands.LOCK__WIDGET.id, - tooltip: 'Turn Auto Scrolling Off', + tooltip: nls.localize('vscode/output.contribution/outputScrollOff', 'Turn Auto Scrolling Off'), onDidChange: this.onOutputWidgetStateChanged, priority: 2 }); toolbarRegistry.registerItem({ id: OutputCommands.UNLOCK__WIDGET.id, command: OutputCommands.UNLOCK__WIDGET.id, - tooltip: 'Turn Auto Scrolling On', + tooltip: nls.localize('vscode/output.contribution/outputScrollOn', 'Turn Auto Scrolling On'), onDidChange: this.onOutputWidgetStateChanged, priority: 2 }); diff --git a/packages/output/src/browser/output-widget.ts b/packages/output/src/browser/output-widget.ts index ab294e30ab6d9..d03b894b383dd 100644 --- a/packages/output/src/browser/output-widget.ts +++ b/packages/output/src/browser/output-widget.ts @@ -27,11 +27,13 @@ import { Message, BaseWidget, DockPanel, Widget, MessageLoop, StatefulWidget, co import { OutputUri } from '../common/output-uri'; import { OutputChannelManager, OutputChannel } from './output-channel'; import { Emitter, Event, deepClone } from '@theia/core'; +import { nls } from '@theia/core/lib/common/nls'; @injectable() export class OutputWidget extends BaseWidget implements StatefulWidget { static readonly ID = 'outputView'; + static readonly LABEL = nls.localize('vscode/settingsLayout/output', 'Output'); @inject(SelectionService) protected readonly selectionService: SelectionService; @@ -50,8 +52,8 @@ export class OutputWidget extends BaseWidget implements StatefulWidget { constructor() { super(); this.id = OutputWidget.ID; - this.title.label = 'Output'; - this.title.caption = 'Output'; + this.title.label = OutputWidget.LABEL; + this.title.caption = OutputWidget.LABEL; this.title.iconClass = codicon('output'); this.title.closable = true; this.addClass('theia-output'); diff --git a/packages/plugin-dev/src/browser/hosted-plugin-controller.ts b/packages/plugin-dev/src/browser/hosted-plugin-controller.ts index 8bd178bbad482..18bb1ee41cf34 100644 --- a/packages/plugin-dev/src/browser/hosted-plugin-controller.ts +++ b/packages/plugin-dev/src/browser/hosted-plugin-controller.ts @@ -26,6 +26,7 @@ import { HostedPluginServer } from '../common/plugin-dev-protocol'; import { HostedPluginManagerClient, HostedInstanceState, HostedPluginCommands, HostedInstanceData } from './hosted-plugin-manager-client'; import { HostedPluginLogViewer } from './hosted-plugin-log-viewer'; import { HostedPluginPreferences } from './hosted-plugin-preferences'; +import { nls } from '@theia/core/lib/common/nls'; /** * Adds a status bar element displaying the state of secondary Theia instance with hosted plugin and @@ -114,7 +115,7 @@ export class HostedPluginController implements FrontendApplicationContribution { this.pluginState = HostedInstanceState.STOPPED; this.entry = { - text: 'Hosted Plugin: Stopped $(angle-up)', + text: `${nls.localize('theia/plugin-dev/hostedPluginStopped', 'Hosted Plugin: Stopped')} $(angle-up)`, alignment: StatusBarAlignment.LEFT, priority: 100, onclick: e => { @@ -135,7 +136,7 @@ export class HostedPluginController implements FrontendApplicationContribution { this.hostedPluginLogViewer.showLogConsole(); this.entry = { - text: '$(cog~spin) Hosted Plugin: Starting', + text: `$(cog~spin) ${nls.localize('theia/plugin-dev/hostedPluginStarting', 'Hosted Plugin: Starting')}`, alignment: StatusBarAlignment.LEFT, priority: 100 }; @@ -152,9 +153,9 @@ export class HostedPluginController implements FrontendApplicationContribution { let entryText: string; if (this.hostedPluginPreferences['hosted-plugin.watchMode'] && this.watcherSuccess) { - entryText = '$(cog~spin) Hosted Plugin: Watching $(angle-up)'; + entryText = `$(cog~spin) ${nls.localize('theia/plugin-dev/hostedPluginWatching', 'Hosted Plugin: Watching')}$(angle-up)`; } else { - entryText = '$(cog~spin) Hosted Plugin: Running $(angle-up)'; + entryText = `$(cog~spin) ${nls.localize('theia/plugin-dev/hostedPluginRunning', 'Hosted Plugin: Running')} $(angle-up)`; } this.entry = { @@ -177,7 +178,7 @@ export class HostedPluginController implements FrontendApplicationContribution { this.pluginState = HostedInstanceState.FAILED; this.entry = { - text: 'Hosted Plugin: Stopped $(angle-up)', + text: `${nls.localize('theia/plugin-dev/hostedPluginStopped', 'Hosted Plugin: Stopped')} $(angle-up)`, alignment: StatusBarAlignment.LEFT, priority: 100, onclick: e => { @@ -258,7 +259,7 @@ export class HostedPluginController implements FrontendApplicationContribution { // Re-set the element only if it's visible on status bar if (this.entry) { const offlineElement = { - text: 'Hosted Plugin: Stopped', + text: nls.localize('theia/plugin-dev/hostedPluginStopped', 'Hosted Plugin: Stopped'), alignment: StatusBarAlignment.LEFT, priority: 100 }; @@ -303,7 +304,7 @@ export class HostedPluginController implements FrontendApplicationContribution { */ protected addCommandsForRunningPlugin(commands: CommandRegistry, menu: Menu): void { commands.addCommand(HostedPluginCommands.STOP.id, { - label: 'Stop Instance', + label: nls.localize('theia/plugin-dev/stopInstance', 'Stop Instance'), icon: codicon('debug-stop'), execute: () => setTimeout(() => this.hostedPluginManagerClient.stop(), 100) }); @@ -314,7 +315,7 @@ export class HostedPluginController implements FrontendApplicationContribution { }); commands.addCommand(HostedPluginCommands.RESTART.id, { - label: 'Restart Instance', + label: nls.localize('theia/plugin-dev/restartInstance', 'Restart Instance'), icon: codicon('debug-restart'), execute: () => setTimeout(() => this.hostedPluginManagerClient.restart(), 100) }); @@ -330,7 +331,7 @@ export class HostedPluginController implements FrontendApplicationContribution { */ protected addCommandsForStoppedPlugin(commands: CommandRegistry, menu: Menu): void { commands.addCommand(HostedPluginCommands.START.id, { - label: 'Start Instance', + label: nls.localize('theia/plugin-dev/startInstance', 'Start Instance'), icon: codicon('play'), execute: () => setTimeout(() => this.hostedPluginManagerClient.start(), 100) }); @@ -341,7 +342,7 @@ export class HostedPluginController implements FrontendApplicationContribution { }); commands.addCommand(HostedPluginCommands.DEBUG.id, { - label: 'Debug Instance', + label: nls.localize('theia/plugin-dev/debugInstance', 'Debug Instance'), icon: codicon('debug'), execute: () => setTimeout(() => this.hostedPluginManagerClient.debug(), 100) }); diff --git a/packages/plugin-dev/src/browser/hosted-plugin-informer.ts b/packages/plugin-dev/src/browser/hosted-plugin-informer.ts index 88a38578712cd..1943f877a9860 100644 --- a/packages/plugin-dev/src/browser/hosted-plugin-informer.ts +++ b/packages/plugin-dev/src/browser/hosted-plugin-informer.ts @@ -22,6 +22,7 @@ import { HostedPluginServer } from '../common/plugin-dev-protocol'; import { ConnectionStatusService, ConnectionStatus } from '@theia/core/lib/browser/connection-status-service'; import { FileStat } from '@theia/filesystem/lib/common/files'; import { FrontendApplicationStateService } from '@theia/core/lib/browser/frontend-application-state'; +import { nls } from '@theia/core/lib/common/nls'; /** * Informs the user whether Theia is running with hosted plugin. @@ -62,7 +63,7 @@ export class HostedPluginInformer implements FrontendApplicationContribution { this.entry = { text: `$(cube) ${HostedPluginInformer.DEVELOPMENT_HOST_TITLE}`, - tooltip: `Hosted Plugin '${pluginMetadata.model.name}'`, + tooltip: `${nls.localize('theia/plugin-dev/hostedPlugin', 'Hosted Plugin')} '${pluginMetadata.model.name}'`, alignment: StatusBarAlignment.LEFT, priority: 100 }; diff --git a/packages/plugin-dev/src/browser/hosted-plugin-manager-client.ts b/packages/plugin-dev/src/browser/hosted-plugin-manager-client.ts index 77487e62202ff..9d1af379a4e40 100644 --- a/packages/plugin-dev/src/browser/hosted-plugin-manager-client.ts +++ b/packages/plugin-dev/src/browser/hosted-plugin-manager-client.ts @@ -29,39 +29,43 @@ import { HostedPluginPreferences } from './hosted-plugin-preferences'; import { FileService } from '@theia/filesystem/lib/browser/file-service'; import { EnvVariablesServer } from '@theia/core/lib/common/env-variables'; import { DebugSessionConnection } from '@theia/debug/lib/browser/debug-session-connection'; +import { nls } from '@theia/core/lib/common/nls'; /** * Commands to control Hosted plugin instances. */ export namespace HostedPluginCommands { + const HOSTED_PLUGIN_CATEGORY_KEY = 'theia/plugin-dev/hostedPlugin'; const HOSTED_PLUGIN_CATEGORY = 'Hosted Plugin'; - export const START: Command = { + export const START = Command.toLocalizedCommand({ id: 'hosted-plugin:start', category: HOSTED_PLUGIN_CATEGORY, label: 'Start Instance' - }; + }, 'theia/plugin-dev/startInstance', HOSTED_PLUGIN_CATEGORY_KEY); - export const DEBUG: Command = { + export const DEBUG = Command.toLocalizedCommand({ id: 'hosted-plugin:debug', category: HOSTED_PLUGIN_CATEGORY, label: 'Debug Instance' - }; + }, 'theia/plugin-dev/debugInstance', HOSTED_PLUGIN_CATEGORY_KEY); - export const STOP: Command = { + export const STOP = Command.toLocalizedCommand({ id: 'hosted-plugin:stop', category: HOSTED_PLUGIN_CATEGORY, label: 'Stop Instance' - }; - export const RESTART: Command = { + }, 'theia/plugin-dev/stopInstance', HOSTED_PLUGIN_CATEGORY_KEY); + + export const RESTART = Command.toLocalizedCommand({ id: 'hosted-plugin:restart', category: HOSTED_PLUGIN_CATEGORY, label: 'Restart Instance' - }; - export const SELECT_PATH: Command = { + }, 'theia/plugin-dev/restartInstance', HOSTED_PLUGIN_CATEGORY_KEY); + + export const SELECT_PATH = Command.toLocalizedCommand({ id: 'hosted-plugin:select-path', category: HOSTED_PLUGIN_CATEGORY, label: 'Select Path' - }; + }, 'theia/plugin-dev/selectPath', HOSTED_PLUGIN_CATEGORY_KEY); } /** @@ -143,7 +147,7 @@ export class HostedPluginManagerClient { async start(debugConfig?: DebugPluginConfiguration): Promise { if (await this.hostedPluginServer.isHostedPluginInstanceRunning()) { - this.messageService.warn('Hosted instance is already running.'); + this.messageService.warn(nls.localize('theia/plugin-dev/alreadyRunning', 'Hosted instance is already running.')); return; } @@ -157,7 +161,7 @@ export class HostedPluginManagerClient { try { this.stateChanged.fire({ state: HostedInstanceState.STARTING, pluginLocation: this.pluginLocation }); - this.messageService.info('Starting hosted instance server ...'); + this.messageService.info(nls.localize('theia/plugin-dev/starting', 'Starting hosted instance server ...')); if (debugConfig) { this.isDebug = true; @@ -168,10 +172,10 @@ export class HostedPluginManagerClient { } await this.openPluginWindow(); - this.messageService.info('Hosted instance is running at: ' + this.pluginInstanceURL); + this.messageService.info(`${nls.localize('theia/plugin-dev/running', 'Hosted instance is running at:')} ${this.pluginInstanceURL}`); this.stateChanged.fire({ state: HostedInstanceState.RUNNING, pluginLocation: this.pluginLocation }); } catch (error) { - this.messageService.error('Failed to run hosted plugin instance: ' + this.getErrorMessage(error)); + this.messageService.error(nls.localize('theia/plugin-dev/failed', 'Failed to run hosted plugin instance: {0}', this.getErrorMessage(error))); this.stateChanged.fire({ state: HostedInstanceState.FAILED, pluginLocation: this.pluginLocation }); this.stop(); } @@ -199,7 +203,7 @@ export class HostedPluginManagerClient { type: 'node', request: 'attach', timeout: 30000, - name: 'Hosted Plugin', + name: nls.localize('theia/plugin-dev/hostedPlugin', 'Hosted Plugin'), smartStep: true, sourceMaps: !!outFiles, outFiles @@ -209,13 +213,15 @@ export class HostedPluginManagerClient { async stop(checkRunning: boolean = true): Promise { if (checkRunning && !await this.hostedPluginServer.isHostedPluginInstanceRunning()) { - this.messageService.warn('Hosted instance is not running.'); + this.messageService.warn(nls.localize('theia/plugin-dev/notRunning', 'Hosted instance is not running.')); return; } try { this.stateChanged.fire({ state: HostedInstanceState.STOPPING, pluginLocation: this.pluginLocation! }); await this.hostedPluginServer.terminateHostedPluginInstance(); - this.messageService.info((this.pluginInstanceURL ? this.pluginInstanceURL : 'The instance') + ' has been terminated.'); + this.messageService.info((this.pluginInstanceURL + ? nls.localize('theia/plugin-dev/instanceTerminated', '{0} has been terminated', this.pluginInstanceURL) + : nls.localize('theia/plugin-dev/unknownTerminated', 'The instance has been terminated'))); this.stateChanged.fire({ state: HostedInstanceState.STOPPED, pluginLocation: this.pluginLocation! }); } catch (error) { this.messageService.error(this.getErrorMessage(error)); @@ -226,7 +232,7 @@ export class HostedPluginManagerClient { if (await this.hostedPluginServer.isHostedPluginInstanceRunning()) { await this.stop(false); - this.messageService.info('Starting hosted instance server ...'); + this.messageService.info(nls.localize('theia/plugin-dev/starting', 'Starting hosted instance server ...')); // It takes some time before OS released all resources e.g. port. // Keep trying to run hosted instance with delay. @@ -243,7 +249,7 @@ export class HostedPluginManagerClient { this.pluginInstanceURL = await this.hostedPluginServer.runHostedPluginInstance(this.pluginLocation!.toString()); } await this.openPluginWindow(); - this.messageService.info('Hosted instance is running at: ' + this.pluginInstanceURL); + this.messageService.info(`${nls.localize('theia/plugin-dev/running', 'Hosted instance is running at:')} ${this.pluginInstanceURL}`); this.stateChanged.fire({ state: HostedInstanceState.RUNNING, pluginLocation: this.pluginLocation! @@ -254,11 +260,11 @@ export class HostedPluginManagerClient { await new Promise(resolve => setTimeout(resolve, 500)); } } - this.messageService.error('Failed to run hosted plugin instance: ' + this.getErrorMessage(lastError)); + this.messageService.error(nls.localize('theia/plugin-dev/failed', 'Failed to run hosted plugin instance: {0}', this.getErrorMessage(lastError))); this.stateChanged.fire({ state: HostedInstanceState.FAILED, pluginLocation: this.pluginLocation! }); this.stop(); } else { - this.messageService.warn('Hosted Plugin instance was not running.'); + this.messageService.warn(nls.localize('theia/plugin-dev/notRunning', 'Hosted instance is not running.')); this.start(); } } @@ -274,7 +280,7 @@ export class HostedPluginManagerClient { const result = await this.fileDialogService.showOpenDialog({ title: HostedPluginCommands.SELECT_PATH.label!, - openLabel: 'Select', + openLabel: nls.localize('theia/plugin-dev/select', 'Select'), canSelectFiles: false, canSelectFolders: true, canSelectMany: false @@ -283,9 +289,9 @@ export class HostedPluginManagerClient { if (result) { if (await this.hostedPluginServer.isPluginValid(result.toString())) { this.pluginLocation = result; - this.messageService.info('Plugin folder is set to: ' + this.labelProvider.getLongName(result)); + this.messageService.info(nls.localize('theia/plugin-dev/pluginFolder', 'Plugin folder is set to: {0}', this.labelProvider.getLongName(result))); } else { - this.messageService.error('Specified folder does not contain valid plugin.'); + this.messageService.error(nls.localize('theia/plugin-dev/noValidPlugin', 'Specified folder does not contain valid plugin.')); } } } @@ -386,7 +392,7 @@ class OpenHostedInstanceLinkDialog extends AbstractDialog { constructor(windowService: WindowService) { super({ - title: 'Your browser prevented opening of a new tab' + title: nls.localize('theia/plugin-dev/preventedNewTab', 'Your browser prevented opening of a new tab') }); this.windowService = windowService; @@ -396,7 +402,7 @@ class OpenHostedInstanceLinkDialog extends AbstractDialog { this.contentNode.appendChild(this.linkNode); const messageNode = document.createElement('div'); - messageNode.innerText = 'Hosted instance is started at: '; + messageNode.innerText = nls.localize('theia/plugin-dev/running', 'Hosted instance is running at:') + ' '; messageNode.appendChild(this.linkNode); this.contentNode.appendChild(messageNode); diff --git a/packages/plugin-dev/src/browser/hosted-plugin-preferences.ts b/packages/plugin-dev/src/browser/hosted-plugin-preferences.ts index 211d60fe91301..8372769c54ff1 100644 --- a/packages/plugin-dev/src/browser/hosted-plugin-preferences.ts +++ b/packages/plugin-dev/src/browser/hosted-plugin-preferences.ts @@ -16,18 +16,19 @@ import { interfaces } from '@theia/core/shared/inversify'; import { createPreferenceProxy, PreferenceProxy, PreferenceService, PreferenceContribution, PreferenceSchema } from '@theia/core/lib/browser'; +import { nls } from '@theia/core/lib/common/nls'; export const HostedPluginConfigSchema: PreferenceSchema = { 'type': 'object', properties: { 'hosted-plugin.watchMode': { type: 'boolean', - description: 'Run watcher on plugin under development', + description: nls.localize('theia/plugin-dev/watchMode', 'Run watcher on plugin under development'), default: true }, 'hosted-plugin.debugMode': { type: 'string', - description: 'Using inspect or inspect-brk for Node.js debug', + description: nls.localize('theia/plugin-dev/debugMode', 'Using inspect or inspect-brk for Node.js debug'), default: 'inspect', enum: ['inspect', 'inspect-brk'] }, @@ -36,7 +37,10 @@ export const HostedPluginConfigSchema: PreferenceSchema = { items: { type: 'string' }, - description: 'Array of glob patterns for locating generated JavaScript files (`${pluginPath}` will be replaced by plugin actual path).', + description: nls.localize( + 'theia/plugin-dev/launchOutFiles', + 'Array of glob patterns for locating generated JavaScript files (`${pluginPath}` will be replaced by plugin actual path).' + ), default: ['${pluginPath}/out/**/*.js'] } } diff --git a/packages/plugin-ext-vscode/src/browser/plugin-vscode-commands-contribution.ts b/packages/plugin-ext-vscode/src/browser/plugin-vscode-commands-contribution.ts index 31c64497c5d5b..bbaa040021a56 100755 --- a/packages/plugin-ext-vscode/src/browser/plugin-vscode-commands-contribution.ts +++ b/packages/plugin-ext-vscode/src/browser/plugin-vscode-commands-contribution.ts @@ -77,6 +77,7 @@ import { toDefinition } from '@theia/plugin-ext/lib/main/browser/callhierarchy/callhierarchy-type-converters'; import { CustomEditorOpener } from '@theia/plugin-ext/lib/main/browser/custom-editors/custom-editor-opener'; +import { nls } from '@theia/core/lib/common/nls'; export namespace VscodeCommands { export const OPEN: Command = { @@ -378,13 +379,13 @@ export class PluginVscodeCommandsContribution implements CommandContribution { commands.registerCommand({ id: 'workbench.action.closeEditorsInGroup', - label: 'Close All Editors in Group' + label: nls.localize('vscode/editor.contribution/closeEditorsInGroup', 'Close All Editors in Group') }, { execute: (uri?: monaco.Uri) => performActionOnGroup(this.shell.closeTabs, uri) }); commands.registerCommand({ id: 'workbench.files.saveAllInGroup', - label: 'Save All in Group' + label: nls.localize('vscode/fileActions.contribution/saveAllInGroup', 'Save All in Group') }, { execute: (uri?: monaco.Uri) => performActionOnGroup(this.shell.saveTabs, uri) }); diff --git a/packages/plugin-ext/src/main/browser/webview/webview-frontend-security-warnings.ts b/packages/plugin-ext/src/main/browser/webview/webview-frontend-security-warnings.ts index df765dac8cc6a..29c6890612482 100644 --- a/packages/plugin-ext/src/main/browser/webview/webview-frontend-security-warnings.ts +++ b/packages/plugin-ext/src/main/browser/webview/webview-frontend-security-warnings.ts @@ -15,8 +15,9 @@ ********************************************************************************/ import { MessageService } from '@theia/core'; -import { FrontendApplicationContribution } from '@theia/core/lib/browser'; +import { Dialog, FrontendApplicationContribution } from '@theia/core/lib/browser'; import { FrontendApplicationConfigProvider } from '@theia/core/lib/browser/frontend-application-config-provider'; +import { nls } from '@theia/core/lib/common/nls'; import { WindowService } from '@theia/core/lib/browser/window/window-service'; import { inject, injectable } from '@theia/core/shared/inversify'; import { WebviewExternalEndpoint } from '../../common/webview-protocol'; @@ -44,12 +45,12 @@ export class WebviewFrontendSecurityWarnings implements FrontendApplicationContr } const hostPattern = await this.webviewEnvironment.hostPatternPromise; if (hostPattern !== WebviewExternalEndpoint.defaultPattern) { - this.messageService.warn(`\ -The webview endpoint's host pattern has been changed to \`${hostPattern}\`; changing the pattern can lead to security vulnerabilities. \ -See \`@theia/plugin-ext/README.md\` for more information.`, - /* actions: */ 'Ok', 'Go To README', - ).then(action => { - if (action === 'Go To README') { + const goToReadme = nls.localize('theia/webview/goToReadme', 'Go To README'); + const message = nls.localize('theia/webview/messageWarning', '\ + The {0} endpoint\'s host pattern has been changed to `{1}`; changing the pattern can lead to security vulnerabilities. \ + See `{2}` for more information.', 'webview', hostPattern, '@theia/plugin-ext/README.md'); + this.messageService.warn(message, Dialog.OK, goToReadme).then(action => { + if (action === goToReadme) { this.windowService.openNewWindow('https://www.npmjs.com/package/@theia/plugin-ext', { external: true }); } }); diff --git a/packages/plugin-ext/src/main/browser/webview/webview-preferences.ts b/packages/plugin-ext/src/main/browser/webview/webview-preferences.ts index 0ea4e4991283f..dfe5641a73934 100644 --- a/packages/plugin-ext/src/main/browser/webview/webview-preferences.ts +++ b/packages/plugin-ext/src/main/browser/webview/webview-preferences.ts @@ -23,6 +23,7 @@ import { PreferenceContribution, PreferenceSchema } from '@theia/core/lib/browser/preferences'; +import { nls } from '@theia/core/lib/common/nls'; const frontendConfig = FrontendApplicationConfigProvider.get(); @@ -32,7 +33,7 @@ export const WebviewConfigSchema: PreferenceSchema = { 'webview.trace': { type: 'string', enum: ['off', 'on', 'verbose'], - description: 'Controls communication tracing with webviews.', + description: nls.localize('theia/plugin-ext/webviewTrace', 'Controls communication tracing with webviews.'), default: 'off' } } @@ -42,7 +43,7 @@ if (frontendConfig.securityWarnings) { WebviewConfigSchema.properties['webview.warnIfUnsecure'] = { scope: 'application', type: 'boolean', - description: 'Warns users that webviews are currently deployed unsecurely.', + description: nls.localize('theia/plugin-ext/webviewWarnIfUnsecure', 'Warns users that webviews are currently deployed unsecurely.'), default: true, }; } diff --git a/packages/preferences/src/browser/preferences-contribution.ts b/packages/preferences/src/browser/preferences-contribution.ts index 82d215c708882..28c2789d35094 100644 --- a/packages/preferences/src/browser/preferences-contribution.ts +++ b/packages/preferences/src/browser/preferences-contribution.ts @@ -177,7 +177,7 @@ export class PreferencesContribution extends AbstractViewContribution; } @@ -138,7 +146,7 @@ export class PreferencesSearchbarWidget extends ReactWidget implements StatefulW type="text" id={PreferencesSearchbarWidget.SEARCHBAR_ID} spellCheck={false} - placeholder="Search Settings" + placeholder={nls.localize('vscode/settingsEditor2/SearchSettings.AriaLabel', 'Search Settings')} className="settings-search-input theia-input" onChange={this.handleSearch} ref={this.searchbarRef} diff --git a/packages/preferences/src/browser/views/preference-widget.tsx b/packages/preferences/src/browser/views/preference-widget.tsx index 8aa904d39364f..59dee5c2927dd 100644 --- a/packages/preferences/src/browser/views/preference-widget.tsx +++ b/packages/preferences/src/browser/views/preference-widget.tsx @@ -22,6 +22,7 @@ import { PreferencesSearchbarState, PreferencesSearchbarWidget } from './prefere import { PreferencesScopeTabBar, PreferencesScopeTabBarState } from './preference-scope-tabbar-widget'; import { Preference } from '../util/preference-types'; import URI from '@theia/core/lib/common/uri'; +import { nls } from '@theia/core/lib/common/nls'; interface PreferencesWidgetState { scopeTabBarState: PreferencesScopeTabBarState, @@ -38,7 +39,7 @@ export class PreferencesWidget extends Panel implements StatefulWidget { /** * The widget `label` which is used for display purposes. */ - static readonly LABEL = 'Preferences'; + static readonly LABEL = nls.localize('vscode/actions/preferences', 'Preferences'); @inject(PreferencesEditorWidget) protected readonly editorWidget: PreferencesEditorWidget; @inject(PreferencesTreeWidget) protected readonly treeWidget: PreferencesTreeWidget; diff --git a/packages/preview/src/browser/preview-contribution.ts b/packages/preview/src/browser/preview-contribution.ts index b4ffdb5e8f6f0..451a5ff9d0ecb 100644 --- a/packages/preview/src/browser/preview-contribution.ts +++ b/packages/preview/src/browser/preview-contribution.ts @@ -20,12 +20,14 @@ import { FrontendApplicationContribution, WidgetOpenerOptions, NavigatableWidget import { EditorManager, TextEditor, EditorWidget, EditorContextMenu } from '@theia/editor/lib/browser'; import { DisposableCollection, CommandContribution, CommandRegistry, Command, MenuContribution, MenuModelRegistry, Disposable } from '@theia/core/lib/common'; import { TabBarToolbarContribution, TabBarToolbarRegistry } from '@theia/core/lib/browser/shell/tab-bar-toolbar'; +import { MiniBrowserCommands } from '@theia/mini-browser/lib/browser/mini-browser-open-handler'; import URI from '@theia/core/lib/common/uri'; import { Position } from '@theia/core/shared/vscode-languageserver-types'; import { PreviewWidget } from './preview-widget'; import { PreviewHandlerProvider } from './preview-handler'; import { PreviewUri } from './preview-uri'; import { PreviewPreferences } from './preview-preferences'; +import { nls } from '@theia/core/lib/common/nls'; import debounce = require('@theia/core/shared/lodash.debounce'); @@ -34,11 +36,11 @@ export namespace PreviewCommands { * No `label`. Otherwise, it would show up in the `Command Palette` and we already have the `Preview` open handler. * See in (`WorkspaceCommandContribution`)[https://bit.ly/2DncrSD]. */ - export const OPEN: Command = { + export const OPEN = Command.toLocalizedCommand({ id: 'preview:open', label: 'Open Preview', iconClass: codicon('open-preview') - }; + }, 'vscode/mainThreadFileSystemEventService/preview'); export const OPEN_SOURCE: Command = { id: 'preview.open.source', iconClass: codicon('go-to-file') @@ -54,7 +56,7 @@ export interface PreviewOpenerOptions extends WidgetOpenerOptions { export class PreviewContribution extends NavigatableWidgetOpenHandler implements CommandContribution, MenuContribution, FrontendApplicationContribution, TabBarToolbarContribution { readonly id = PreviewUri.id; - readonly label = 'Preview'; + readonly label = nls.localize(MiniBrowserCommands.PREVIEW_CATEGORY_KEY, MiniBrowserCommands.PREVIEW_CATEGORY); @inject(EditorManager) protected readonly editorManager: EditorManager; @@ -227,12 +229,12 @@ export class PreviewContribution extends NavigatableWidgetOpenHandler this.status = { state: 'error', errorMessage: History is not supported for {repository.provider.label} source control. }; } } else { - this.status = { state: 'error', errorMessage: There is no repository selected in this workspace. }; + this.status = { + state: 'error', + errorMessage: {nls.localize('vscode/scm.contribution/no open repo', 'There is no repository selected in this workspace.')} + }; } } diff --git a/packages/scm/src/browser/scm-amend-component.tsx b/packages/scm/src/browser/scm-amend-component.tsx index 3d59e7b48a540..5a3bdf468fa85 100644 --- a/packages/scm/src/browser/scm-amend-component.tsx +++ b/packages/scm/src/browser/scm-amend-component.tsx @@ -23,6 +23,7 @@ import { Disposable, DisposableCollection } from '@theia/core'; import { ScmRepository } from './scm-repository'; import { ScmAmendSupport, ScmCommit } from './scm-provider'; +import { nls } from '@theia/core/lib/common/nls'; export interface ScmAmendComponentProps { style: React.CSSProperties | undefined, @@ -298,7 +299,7 @@ export class ScmAmendComponent extends React.Component
    - HEAD Commit + {nls.localize('theia/scm/amendHeadCommit', 'HEAD Commit')}
    {this.renderLastCommit()}
    @@ -375,8 +376,8 @@ export class ScmAmendComponent extends React.Component -
    : '' @@ -451,8 +452,8 @@ export class ScmAmendComponent extends React.Component - : '' diff --git a/packages/scm/src/browser/scm-contribution.ts b/packages/scm/src/browser/scm-contribution.ts index f2ceb6eb56a0a..6ece5be4a5f1a 100644 --- a/packages/scm/src/browser/scm-contribution.ts +++ b/packages/scm/src/browser/scm-contribution.ts @@ -23,7 +23,7 @@ import { StatusBarEntry, KeybindingRegistry, ViewContainerTitleOptions, - codicon, + codicon } from '@theia/core/lib/browser'; import { TabBarToolbarContribution, TabBarToolbarRegistry, TabBarToolbarItem } from '@theia/core/lib/browser/shell/tab-bar-toolbar'; import { CommandRegistry, Command, Disposable, DisposableCollection, CommandService } from '@theia/core/lib/common'; @@ -36,42 +36,46 @@ import { ColorContribution } from '@theia/core/lib/browser/color-application-con import { ColorRegistry, Color } from '@theia/core/lib/browser/color-registry'; import { ScmCommand } from './scm-provider'; import { ScmDecorationsService } from '../browser/decorations/scm-decorations-service'; +import { nls } from '@theia/core/lib/common/nls'; export const SCM_WIDGET_FACTORY_ID = ScmWidget.ID; export const SCM_VIEW_CONTAINER_ID = 'scm-view-container'; export const SCM_VIEW_CONTAINER_TITLE_OPTIONS: ViewContainerTitleOptions = { - label: 'Source Control', + label: nls.localize('vscode/scm.contribution/source control', 'Source Control'), iconClass: codicon('source-control'), closeable: true }; export namespace SCM_COMMANDS { - export const CHANGE_REPOSITORY = { + export const CHANGE_REPOSITORY = Command.toLocalizedCommand({ id: 'scm.change.repository', category: 'SCM', - label: 'Change Repository...' - }; + label: nls.localize('theia/scm/changeRepository', 'Change Repository...') + }); export const ACCEPT_INPUT = { id: 'scm.acceptInput' }; export const TREE_VIEW_MODE = { id: 'scm.viewmode.tree', - tooltip: 'Toggle to Tree View', + tooltip: nls.localize('vscode/scmViewPane/viewModeTree', 'Toggle to Tree View'), iconClass: codicon('list-tree'), - label: 'Toggle to Tree View', + originalLabel: 'Toggle to Tree View', + label: nls.localize('vscode/scmViewPane/viewModeTree', 'Toggle to Tree View') }; export const LIST_VIEW_MODE = { id: 'scm.viewmode.list', - tooltip: 'Toggle to List View', + tooltip: nls.localize('vscode/scmViewPane/viewModeList', 'Toggle to List View'), iconClass: codicon('list-flat'), - label: 'Toggle to List View', + originalLabel: 'Toggle to List View', + label: nls.localize('vscode/scmViewPane/viewModeList', 'Toggle to List View') }; export const COLLAPSE_ALL = { id: 'scm.collapseAll', category: 'SCM', - tooltip: 'Collapse All', + tooltip: nls.localize('vscode/treeView/collapseAll', 'Collapse All'), iconClass: codicon('collapse-all'), - label: 'Collapse All', + label: nls.localize('vscode/treeView/collapseAll', 'Collapse All'), + originalLabel: 'Collapse All' }; } @@ -99,7 +103,7 @@ export class ScmContribution extends AbstractViewContribution impleme super({ viewContainerId: SCM_VIEW_CONTAINER_ID, widgetId: SCM_WIDGET_FACTORY_ID, - widgetName: 'Source Control', + widgetName: SCM_VIEW_CONTAINER_TITLE_OPTIONS.label, defaultWidgetOptions: { area: 'left', rank: 300 diff --git a/packages/scm/src/browser/scm-no-repository-widget.tsx b/packages/scm/src/browser/scm-no-repository-widget.tsx index 7fee6aa53f1ed..fed9e012fac8d 100644 --- a/packages/scm/src/browser/scm-no-repository-widget.tsx +++ b/packages/scm/src/browser/scm-no-repository-widget.tsx @@ -18,6 +18,7 @@ import { injectable } from '@theia/core/shared/inversify'; import * as React from '@theia/core/shared/react'; import { ReactWidget } from '@theia/core/lib/browser'; import { AlertMessage } from '@theia/core/lib/browser/widgets/alert-message'; +import { nls } from '@theia/core/lib/common/nls'; @injectable() export class ScmNoRepositoryWidget extends ReactWidget { @@ -33,7 +34,7 @@ export class ScmNoRepositoryWidget extends ReactWidget { protected render(): React.ReactNode { return ; } diff --git a/packages/scm/src/browser/scm-preferences.ts b/packages/scm/src/browser/scm-preferences.ts index ef8bc953d82fe..f2353b0da9c0b 100644 --- a/packages/scm/src/browser/scm-preferences.ts +++ b/packages/scm/src/browser/scm-preferences.ts @@ -22,6 +22,7 @@ import { PreferenceSchema, PreferenceContribution } from '@theia/core/lib/browser/preferences'; +import { nls } from '@theia/core/lib/common/nls'; export const scmPreferenceSchema: PreferenceSchema = { type: 'object', @@ -30,10 +31,10 @@ export const scmPreferenceSchema: PreferenceSchema = { type: 'string', enum: ['tree', 'list'], enumDescriptions: [ - 'Show the repository changes as a tree.', - 'Show the repository changes as a list.' + nls.localize('vscode/scm.contribution/scm.defaultViewMode.tree', 'Show the repository changes as a tree.'), + nls.localize('vscode/scm.contribution/scm.defaultViewMode.list', 'Show the repository changes as a list.') ], - description: 'Controls the default source control view mode.', + description: nls.localize('vscode/scm.contribution/scm.defaultViewMode', 'Controls the default source control view mode.'), default: 'list' } } diff --git a/packages/scm/src/browser/scm-widget.tsx b/packages/scm/src/browser/scm-widget.tsx index 1260d3d3e6df5..d2c885eb34eb8 100644 --- a/packages/scm/src/browser/scm-widget.tsx +++ b/packages/scm/src/browser/scm-widget.tsx @@ -28,6 +28,7 @@ import { ScmNoRepositoryWidget } from './scm-no-repository-widget'; import { ScmService } from './scm-service'; import { ScmTreeWidget } from './scm-tree-widget'; import { ScmPreferences } from './scm-preferences'; +import { nls } from '@theia/core/lib/common/nls'; @injectable() export class ScmWidget extends BaseWidget implements StatefulWidget { @@ -103,7 +104,7 @@ export class ScmWidget extends BaseWidget implements StatefulWidget { this.toDisposeOnRefresh.dispose(); this.toDispose.push(this.toDisposeOnRefresh); const repository = this.scmService.selectedRepository; - this.title.label = repository ? repository.provider.label : 'no repository found'; + this.title.label = repository ? repository.provider.label : nls.localize('vscode/scm.contribution/no open repo', 'No repository found'); this.title.caption = this.title.label; this.update(); if (repository) { diff --git a/packages/search-in-workspace/src/browser/search-in-workspace-frontend-contribution.ts b/packages/search-in-workspace/src/browser/search-in-workspace-frontend-contribution.ts index c53e46b5d4012..f7d249cd52f54 100644 --- a/packages/search-in-workspace/src/browser/search-in-workspace-frontend-contribution.ts +++ b/packages/search-in-workspace/src/browser/search-in-workspace-frontend-contribution.ts @@ -31,51 +31,51 @@ import { FileService } from '@theia/filesystem/lib/browser/file-service'; import { SEARCH_VIEW_CONTAINER_ID } from './search-in-workspace-factory'; export namespace SearchInWorkspaceCommands { + const SEARCH_CATEGORY_KEY = 'vscode/search.contribution/search'; const SEARCH_CATEGORY = 'Search'; export const TOGGLE_SIW_WIDGET = { id: 'search-in-workspace.toggle' }; - export const OPEN_SIW_WIDGET: Command = { + export const OPEN_SIW_WIDGET = Command.toLocalizedCommand({ id: 'search-in-workspace.open', category: SEARCH_CATEGORY, label: 'Find in Files' - - }; - export const FIND_IN_FOLDER: Command = { + }, 'vscode/search.contribution/findInFiles', SEARCH_CATEGORY_KEY); + export const FIND_IN_FOLDER = Command.toLocalizedCommand({ id: 'search-in-workspace.in-folder', category: SEARCH_CATEGORY, label: 'Find in Folder' - }; - export const REFRESH_RESULTS: Command = { + }, 'vscode/search.contribution/findInFolder', SEARCH_CATEGORY_KEY); + export const REFRESH_RESULTS = Command.toLocalizedCommand({ id: 'search-in-workspace.refresh', category: SEARCH_CATEGORY, label: 'Refresh', iconClass: codicon('refresh') - }; - export const CANCEL_SEARCH: Command = { + }, 'vscode/search.contribution/RefreshAction.label', SEARCH_CATEGORY_KEY); + export const CANCEL_SEARCH = Command.toLocalizedCommand({ id: 'search-in-workspace.cancel', category: SEARCH_CATEGORY, label: 'Cancel Search', iconClass: codicon('search-stop') - }; - export const COLLAPSE_ALL: Command = { + }, 'vscode/search.contribution/CancelSearchAction.label', SEARCH_CATEGORY_KEY); + export const COLLAPSE_ALL = Command.toLocalizedCommand({ id: 'search-in-workspace.collapse-all', category: SEARCH_CATEGORY, label: 'Collapse All', iconClass: codicon('collapse-all') - }; - export const EXPAND_ALL: Command = { + }, 'vscode/search.contribution/CollapseDeepestExpandedLevelAction.label', SEARCH_CATEGORY_KEY); + export const EXPAND_ALL = Command.toLocalizedCommand({ id: 'search-in-workspace.expand-all', category: SEARCH_CATEGORY, label: 'Expand All', iconClass: codicon('expand-all') - }; - export const CLEAR_ALL: Command = { + }, 'vscode/search.contribution/ExpandAllAction.label', SEARCH_CATEGORY_KEY); + export const CLEAR_ALL = Command.toLocalizedCommand({ id: 'search-in-workspace.clear-all', category: SEARCH_CATEGORY, label: 'Clear Search Results', iconClass: codicon('clear-all') - }; + }, 'vscode/search.contribution/ClearSearchResultsAction.label', SEARCH_CATEGORY_KEY); } @injectable() diff --git a/packages/search-in-workspace/src/browser/search-in-workspace-preferences.ts b/packages/search-in-workspace/src/browser/search-in-workspace-preferences.ts index 6c3c8436a204d..c2fbea4fc8237 100644 --- a/packages/search-in-workspace/src/browser/search-in-workspace-preferences.ts +++ b/packages/search-in-workspace/src/browser/search-in-workspace-preferences.ts @@ -14,6 +14,7 @@ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 ********************************************************************************/ +import { nls } from '@theia/core/lib/common/nls'; import { PreferenceSchema, PreferenceProxy, PreferenceService, createPreferenceProxy, PreferenceContribution } from '@theia/core/lib/browser/preferences'; import { interfaces } from '@theia/core/shared/inversify'; @@ -21,34 +22,35 @@ export const searchInWorkspacePreferencesSchema: PreferenceSchema = { type: 'object', properties: { 'search.lineNumbers': { - description: 'Controls whether to show line numbers for search results.', + description: nls.localize('vscode/search.contribution/search.showLineNumbers', 'Controls whether to show line numbers for search results.'), default: false, type: 'boolean', }, 'search.collapseResults': { - description: 'Controls whether the search results will be collapsed or expanded.', + description: nls.localize('vscode/search.contribution/search.collapseAllResults', 'Controls whether the search results will be collapsed or expanded.'), default: 'auto', type: 'string', enum: ['auto', 'alwaysCollapse', 'alwaysExpand'], }, 'search.searchOnType': { - description: 'Search all files as you type in the search field.', + description: nls.localize('vscode/search.contribution/search.searchOnType', 'Search all files as you type in the search field.'), default: true, type: 'boolean', }, 'search.searchOnTypeDebouncePeriod': { // eslint-disable-next-line max-len - description: 'When `search.searchOnType` is enabled, controls the timeout in milliseconds between a character being typed and the search starting. Has no effect when `search.searchOnType` is disabled.', + description: nls.localize('vscode/search.contribution/search.searchOnTypeDebouncePeriod', 'When `search.searchOnType` is enabled, controls the timeout in milliseconds between a character being typed and the search starting. Has no effect when `search.searchOnType` is disabled.'), default: 300, type: 'number', }, 'search.searchOnEditorModification': { - description: 'Search the active editor when modified.', + description: nls.localize('theia/search-in-workspace/searchOnEditorModification', 'Search the active editor when modified.'), default: true, type: 'boolean', }, 'search.smartCase': { - description: 'Search case-insensitively if the pattern is all lowercase, otherwise, search case-sensitively.', + // eslint-disable-next-line max-len + description: nls.localize('vscode/search.contribution/search.smartCase', 'Search case-insensitively if the pattern is all lowercase, otherwise, search case-sensitively.'), default: false, type: 'boolean', } diff --git a/packages/search-in-workspace/src/browser/search-in-workspace-result-tree-widget.tsx b/packages/search-in-workspace/src/browser/search-in-workspace-result-tree-widget.tsx index 72fb53c3a04ef..b4fb6a550b7b7 100644 --- a/packages/search-in-workspace/src/browser/search-in-workspace-result-tree-widget.tsx +++ b/packages/search-in-workspace/src/browser/search-in-workspace-result-tree-widget.tsx @@ -50,6 +50,7 @@ import { ColorRegistry } from '@theia/core/lib/browser/color-registry'; import * as minimatch from 'minimatch'; import { DisposableCollection } from '@theia/core/lib/common/disposable'; import debounce = require('@theia/core/shared/lodash.debounce'); +import { nls } from '@theia/core/lib/common/nls'; const ROOT_ID = 'ResultTree'; @@ -121,7 +122,7 @@ export class SearchInWorkspaceResultTreeWidget extends TreeWidget { protected readonly toDisposeOnActiveEditorChanged = new DisposableCollection(); // The default root name to add external search results in the case that a workspace is opened. - protected readonly defaultRootName = 'Other files'; + protected readonly defaultRootName = nls.localize('theia/searchResultsView/searchFolderMatch.other.label', 'Other files'); protected forceVisibleRootNode = false; protected appliedDecorations = new Map(); @@ -738,7 +739,10 @@ export class SearchInWorkspaceResultTreeWidget extends TreeWidget { const isResultLineNode = SearchInWorkspaceResultLineNode.is(node); return this.doReplace(node, e)} - title={isResultLineNode ? 'Replace' : 'Replace All'}>; + title={isResultLineNode + ? nls.localize('vscode/findWidget/label.replaceButton', 'Replace') + : nls.localize('vscode/findWidget/label.replaceAllButton', 'Replace All') + }>; } protected getFileCount(node: TreeNode): number { @@ -781,14 +785,52 @@ export class SearchInWorkspaceResultTreeWidget extends TreeWidget { } protected confirmReplaceAll(resultNumber: number, fileNumber: number): Promise { - const go = fileNumber > 1; return new ConfirmDialog({ - title: 'Replace all', - msg: `Do you really want to replace ${resultNumber} match${resultNumber > 1 ? 'es' : ''} ${go ? 'across' : 'in'} ` - + `${fileNumber} file${go ? 's' : ''} with "${this._replaceTerm}"?` + title: nls.localize('vscode/findWidget/label.replaceAllButton', 'Replace All'), + msg: this.buildReplaceAllConfirmationMessage(resultNumber, fileNumber, this._replaceTerm) }).open(); } + protected buildReplaceAllConfirmationMessage(occurrences: number, fileCount: number, replaceValue: string): string { + if (occurrences === 1) { + if (fileCount === 1) { + if (replaceValue) { + return nls.localize('vscode/searchView/removeAll.occurrence.file.confirmation.message', + "Replace {0} occurrence across {1} file with '{2}'?", occurrences, fileCount, replaceValue); + } + + return nls.localize('vscode/searchView/replaceAll.occurrence.file.confirmation.message', + 'Replace {0} occurrence across {1} file?', occurrences, fileCount); + } + + if (replaceValue) { + return nls.localize('vscode/searchView/removeAll.occurrence.files.confirmation.message', + "Replace {0} occurrence across {1} files with '{2}'?", occurrences, fileCount, replaceValue); + } + + return nls.localize('vscode/searchView/replaceAll.occurrence.files.confirmation.message', + 'Replace {0} occurrence across {1} files?', occurrences, fileCount); + } + + if (fileCount === 1) { + if (replaceValue) { + return nls.localize('vscode/searchView/removeAll.occurrences.file.confirmation.message', + "Replace {0} occurrences across {1} file with '{2}'?", occurrences, fileCount, replaceValue); + } + + return nls.localize('vscode/searchView/replaceAll.occurrences.file.confirmation.message', + 'Replace {0} occurrences across {1} file?', occurrences, fileCount); + } + + if (replaceValue) { + return nls.localize('vscode/searchView/removeAll.occurrences.files.confirmation.message', + "Replace {0} occurrences across {1} files with '{2}'?", occurrences, fileCount, replaceValue); + } + + return nls.localize('vscode/searchView/replaceAll.occurrences.files.confirmation.message', + 'Replace {0} occurrences across {1} files?', occurrences, fileCount); + } + protected updateRightResults(node: SearchInWorkspaceResultLineNode): void { const fileNode = node.parent; const rightPositionedNodes = fileNode.children.filter(rl => rl.line === node.line && rl.character > node.character); diff --git a/packages/search-in-workspace/src/browser/search-in-workspace-widget.tsx b/packages/search-in-workspace/src/browser/search-in-workspace-widget.tsx index 5dd6485b7ad10..719ac4337284d 100644 --- a/packages/search-in-workspace/src/browser/search-in-workspace-widget.tsx +++ b/packages/search-in-workspace/src/browser/search-in-workspace-widget.tsx @@ -28,6 +28,7 @@ import { ProgressBarFactory } from '@theia/core/lib/browser/progress-bar-factory import { EditorManager } from '@theia/editor/lib/browser'; import { SearchInWorkspacePreferences } from './search-in-workspace-preferences'; import { SearchInWorkspaceInput } from './components/search-in-workspace-input'; +import { nls } from '@theia/core/lib/common/nls'; export interface SearchFieldState { className: string; @@ -39,7 +40,7 @@ export interface SearchFieldState { export class SearchInWorkspaceWidget extends BaseWidget implements StatefulWidget { static ID = 'search-in-workspace'; - static LABEL = 'Search'; + static LABEL = nls.localize('vscode/search.contribution/search', 'Search'); protected matchCaseState: SearchFieldState; protected wholeWordState: SearchFieldState; @@ -117,22 +118,22 @@ export class SearchInWorkspaceWidget extends BaseWidget implements StatefulWidge this.matchCaseState = { className: codicon('case-sensitive'), enabled: false, - title: 'Match Case' + title: nls.localize('vscode/findInputCheckboxes/caseDescription', 'Match Case') }; this.wholeWordState = { className: codicon('whole-word'), enabled: false, - title: 'Match Whole Word' + title: nls.localize('vscode/findInputCheckboxes/wordsDescription', 'Match Whole Word') }; this.regExpState = { className: codicon('regex'), enabled: false, - title: 'Use Regular Expression' + title: nls.localize('vscode/findInputCheckboxes/regexDescription', 'Use Regular Expression') }; this.includeIgnoredState = { className: codicon('eye'), enabled: false, - title: 'Include Ignored Files' + title: nls.localize('theia/search-in-workspace/includeIgnoredFiles', 'Include Ignored Files') }; this.searchInWorkspaceOptions = { matchCase: false, @@ -195,6 +196,11 @@ export class SearchInWorkspaceWidget extends BaseWidget implements StatefulWidge this.wholeWordState = oldState.wholeWordState; this.regExpState = oldState.regExpState; this.includeIgnoredState = oldState.includeIgnoredState; + // Override the title of the restored state, as we could have changed languages in between + this.matchCaseState.title = nls.localize('vscode/findInputCheckboxes/caseDescription', 'Match Case'); + this.wholeWordState.title = nls.localize('vscode/findInputCheckboxes/wordsDescription', 'Match Whole Word'); + this.regExpState.title = nls.localize('vscode/findInputCheckboxes/regexDescription', 'Use Regular Expression'); + this.includeIgnoredState.title = nls.localize('theia/search-in-workspace/includeIgnoredFiles', 'Include Ignored Files'); this.showSearchDetails = oldState.showSearchDetails; this.searchInWorkspaceOptions = oldState.searchInWorkspaceOptions; this.searchTerm = oldState.searchTerm; @@ -357,7 +363,7 @@ export class SearchInWorkspaceWidget extends BaseWidget implements StatefulWidge protected renderReplaceFieldToggle(): React.ReactNode { const toggle = ; return
    { @@ -376,14 +382,13 @@ export class SearchInWorkspaceWidget extends BaseWidget implements StatefulWidge protected renderNotification(): React.ReactNode { if (this.workspaceService.tryGetRoots().length <= 0 && this.editorManager.all.length <= 0) { return
    -
    You have not opened or specified a folder. Only open files are currently searched.
    +
    {nls.localize('theia/search-in-workspace/noFolderSpecified', 'You have not opened or specified a folder. Only open files are currently searched.')}
    ; } return
    = this.searchInWorkspaceOptions.maxResults ? 'show' : ''}`}> -
    - This is only a subset of all results. Use a more specific search term to narrow down the result list. -
    +
    {nls.localize('theia/search-in-workspace/resultSubset', + 'This is only a subset of all results. Use a more specific search term to narrow down the result list.')}
    ; } @@ -466,10 +471,10 @@ export class SearchInWorkspaceWidget extends BaseWidget implements StatefulWidge const input = 0; return
    { if (enabled) { @@ -588,7 +594,7 @@ export class SearchInWorkspaceWidget extends BaseWidget implements StatefulWidge protected renderExpandGlobFieldsButton(): React.ReactNode { return
    { this.showSearchDetails = !this.showSearchDetails; @@ -600,8 +606,9 @@ export class SearchInWorkspaceWidget extends BaseWidget implements StatefulWidge protected renderGlobField(kind: 'include' | 'exclude'): React.ReactNode { const currentValue = this.searchInWorkspaceOptions[kind]; const value = currentValue && currentValue.join(', ') || ''; + const labelKey = `vscode/searchView/searchScope.${kind}s`; return
    -
    {'files to ' + kind}
    +
    {nls.localize(labelKey, 'files to ' + kind)}
    0; const isExcludesPresent = this.searchInWorkspaceOptions.exclude && this.searchInWorkspaceOptions.exclude.length > 0; + let message: string; if (isIncludesPresent && isExcludesPresent) { - return `No results found in '${this.searchInWorkspaceOptions.include}' excluding '${this.searchInWorkspaceOptions.exclude}'`; + message = nls.localize('vscode/searchView/noResultsIncludesExcludes', "No results found in '{0}' excluding '{1}' - ", + this.searchInWorkspaceOptions.include!.toString(), this.searchInWorkspaceOptions.exclude!.toString()); } else if (isIncludesPresent) { - return `No results found in '${this.searchInWorkspaceOptions.include}'`; + message = nls.localize('vscode/searchView/noResultsIncludes', "No results found in '{0}' - ", + this.searchInWorkspaceOptions.include!.toString()); } else if (isExcludesPresent) { - return `No results found excluding '${this.searchInWorkspaceOptions.exclude}'`; + message = nls.localize('vscode/searchView/noResultsExcludes', "No results found excluding '{0}' - ", + this.searchInWorkspaceOptions.exclude!.toString()); } else { - return 'No results found.'; + message = nls.localize('vscode/searchView/noResultsFound', 'No results found. - '); } + // We have to trim here as vscode will always add a trailing " - " string + return message.substring(0, message.length - 2).trim(); } else { if (this.resultNumber === 1 && this.resultTreeWidget.fileNumber === 1) { - return `${this.resultNumber} result in ${this.resultTreeWidget.fileNumber} file`; + return nls.localize('vscode/searchView/search.file.result', '{0} result in {1} file', + this.resultNumber.toString(), this.resultTreeWidget.fileNumber.toString()); } else if (this.resultTreeWidget.fileNumber === 1) { - return `${this.resultNumber} results in ${this.resultTreeWidget.fileNumber} file`; + return nls.localize('vscode/searchView/search.file.results', '{0} results in {1} file', + this.resultNumber.toString(), this.resultTreeWidget.fileNumber.toString()); } else if (this.resultTreeWidget.fileNumber > 0) { - return `${this.resultNumber} results in ${this.resultTreeWidget.fileNumber} files`; + return nls.localize('vscode/searchView/search.files.results', '{0} results in {1} files', + this.resultNumber.toString(), this.resultTreeWidget.fileNumber.toString()); } else { // if fileNumber === 0, return undefined so that `onUpdateRequest()` would not re-render component return undefined; diff --git a/packages/task/src/browser/task-frontend-contribution.ts b/packages/task/src/browser/task-frontend-contribution.ts index 9f3289b153116..ae1ffc60a14b5 100644 --- a/packages/task/src/browser/task-frontend-contribution.ts +++ b/packages/task/src/browser/task-frontend-contribution.ts @@ -31,83 +31,84 @@ import { EditorManager } from '@theia/editor/lib/browser'; import { WorkspaceService } from '@theia/workspace/lib/browser/workspace-service'; export namespace TaskCommands { + const TASK_CATEGORY_KEY = 'vscode/settingsLayout/task'; const TASK_CATEGORY = 'Task'; - export const TASK_RUN: Command = { + export const TASK_RUN = Command.toLocalizedCommand({ id: 'task:run', category: TASK_CATEGORY, label: 'Run Task...' - }; + }, 'vscode/task.contribution/RunTaskAction.label', TASK_CATEGORY_KEY); - export const TASK_RUN_BUILD: Command = { + export const TASK_RUN_BUILD = Command.toLocalizedCommand({ id: 'task:run:build', category: TASK_CATEGORY, label: 'Run Build Task...' - }; + }, 'vscode/task.contribution/BuildAction.label', TASK_CATEGORY_KEY); - export const TASK_RUN_TEST: Command = { + export const TASK_RUN_TEST = Command.toLocalizedCommand({ id: 'task:run:test', category: TASK_CATEGORY, label: 'Run Test Task...' - }; + }, 'vscode/task.contribution/TestAction.label', TASK_CATEGORY_KEY); - export const WORKBENCH_RUN_TASK: Command = { + export const WORKBENCH_RUN_TASK = Command.toLocalizedCommand({ id: 'workbench.action.tasks.runTask', category: TASK_CATEGORY - }; + }, '', TASK_CATEGORY_KEY); - export const TASK_RUN_LAST: Command = { + export const TASK_RUN_LAST = Command.toLocalizedCommand({ id: 'task:run:last', category: TASK_CATEGORY, label: 'Run Last Task' - }; + }, 'vscode/task.contribution/ReRunTaskAction.label', TASK_CATEGORY_KEY); - export const TASK_ATTACH: Command = { + export const TASK_ATTACH = Command.toLocalizedCommand({ id: 'task:attach', category: TASK_CATEGORY, label: 'Attach Task...' - }; + }, 'theia/task/attachTask', TASK_CATEGORY_KEY); - export const TASK_RUN_TEXT: Command = { + export const TASK_RUN_TEXT = Command.toLocalizedCommand({ id: 'task:run:text', category: TASK_CATEGORY, label: 'Run Selected Text' - }; + }, 'vscode/terminalMenu/miRunSelectedText', TASK_CATEGORY_KEY); - export const TASK_CONFIGURE: Command = { + export const TASK_CONFIGURE = Command.toLocalizedCommand({ id: 'task:configure', category: TASK_CATEGORY, label: 'Configure Tasks...' - }; + }, 'vscode/task.contribution/miConfigureTask', TASK_CATEGORY_KEY); - export const TASK_OPEN_USER: Command = { + export const TASK_OPEN_USER = Command.toLocalizedCommand({ id: 'task:open_user', category: TASK_CATEGORY, label: 'Open User Tasks' - }; + }, 'theia/task/openUserTasks', TASK_CATEGORY_KEY); - export const TASK_CLEAR_HISTORY: Command = { + export const TASK_CLEAR_HISTORY = Command.toLocalizedCommand({ id: 'task:clear-history', category: TASK_CATEGORY, label: 'Clear History' - }; + }, 'theia/task/clearHistory', TASK_CATEGORY_KEY); - export const TASK_SHOW_RUNNING: Command = { + export const TASK_SHOW_RUNNING = Command.toLocalizedCommand({ id: 'task:show-running', category: TASK_CATEGORY, label: 'Show Running Tasks' - }; + }, 'vscode/task.contribution/runningTasks', TASK_CATEGORY_KEY); - export const TASK_TERMINATE: Command = { + export const TASK_TERMINATE = Command.toLocalizedCommand({ id: 'task:terminate', category: TASK_CATEGORY, label: 'Terminate Task' - }; + }, 'vscode/abstractTaskService/terminateTask', TASK_CATEGORY_KEY); - export const TASK_RESTART_RUNNING: Command = { + export const TASK_RESTART_RUNNING = Command.toLocalizedCommand({ id: 'task:restart-running', category: TASK_CATEGORY, label: 'Restart Running Task...' - }; + }, 'vscode/abstractTaskService/restartTask', TASK_CATEGORY_KEY); } const TASKS_STORAGE_KEY = 'tasks'; @@ -201,7 +202,7 @@ export class TaskFrontendContribution implements CommandContribution, MenuContri if (!!items.length) { this.statusBar.setElement(id, { text: `$(tools) ${items.length}`, - tooltip: 'Show Running Tasks', + tooltip: TaskCommands.TASK_SHOW_RUNNING.label, alignment: StatusBarAlignment.LEFT, priority: 2, command: TaskCommands.TASK_SHOW_RUNNING.id, @@ -361,7 +362,7 @@ export class TaskFrontendContribution implements CommandContribution, MenuContri menus.registerMenuAction(TerminalMenus.TERMINAL_TASKS_INFO, { commandId: TaskCommands.TASK_SHOW_RUNNING.id, - label: 'Show Running Tasks...', + label: TaskCommands.TASK_SHOW_RUNNING.label + '...', order: '0' }); @@ -373,7 +374,7 @@ export class TaskFrontendContribution implements CommandContribution, MenuContri menus.registerMenuAction(TerminalMenus.TERMINAL_TASKS_INFO, { commandId: TaskCommands.TASK_TERMINATE.id, - label: 'Terminate Task...', + label: TaskCommands.TASK_TERMINATE.label + '...', order: '2' }); diff --git a/packages/terminal/src/browser/terminal-frontend-contribution.ts b/packages/terminal/src/browser/terminal-frontend-contribution.ts index 7aeca758f906e..e14ad513030a8 100644 --- a/packages/terminal/src/browser/terminal-frontend-contribution.ts +++ b/packages/terminal/src/browser/terminal-frontend-contribution.ts @@ -29,10 +29,10 @@ import { } from '@theia/core/lib/common'; import { ApplicationShell, KeybindingContribution, KeyCode, Key, WidgetManager, - KeybindingRegistry, Widget, LabelProvider, WidgetOpenerOptions, StorageService, QuickInputService, codicon + KeybindingRegistry, Widget, LabelProvider, WidgetOpenerOptions, StorageService, QuickInputService, codicon, CommonCommands } from '@theia/core/lib/browser'; import { TabBarToolbarContribution, TabBarToolbarRegistry } from '@theia/core/lib/browser/shell/tab-bar-toolbar'; -import { TERMINAL_WIDGET_FACTORY_ID, TerminalWidgetFactoryOptions } from './terminal-widget-impl'; +import { TERMINAL_WIDGET_FACTORY_ID, TerminalWidgetFactoryOptions, TerminalWidgetImpl } from './terminal-widget-impl'; import { TerminalKeybindingContexts } from './terminal-keybinding-contexts'; import { TerminalService } from './base/terminal-service'; import { TerminalWidgetOptions, TerminalWidget } from './base/terminal-widget'; @@ -52,6 +52,7 @@ import { ENVIRONMENT_VARIABLE_COLLECTIONS_KEY, SerializableExtensionEnvironmentVariableCollection } from '../common/base-terminal-protocol'; +import { nls } from '@theia/core/lib/common/nls'; export namespace TerminalMenus { export const TERMINAL = [...MAIN_MENU_BAR, '7_terminal']; @@ -64,77 +65,78 @@ export namespace TerminalMenus { } export namespace TerminalCommands { + const TERMINAL_CATEGORY_KEY = 'vscode/settingsLayout/terminal'; const TERMINAL_CATEGORY = 'Terminal'; - export const NEW: Command = { + export const NEW = Command.toLocalizedCommand({ id: 'terminal:new', category: TERMINAL_CATEGORY, label: 'Open New Terminal' - }; - export const NEW_ACTIVE_WORKSPACE: Command = { + }, 'vscode/terminalActions/workbench.action.terminal.new', TERMINAL_CATEGORY_KEY); + export const NEW_ACTIVE_WORKSPACE = Command.toLocalizedCommand({ id: 'terminal:new:active:workspace', category: TERMINAL_CATEGORY, label: 'Open New Terminal (In Active Workspace)' - }; - export const TERMINAL_CLEAR: Command = { + }, 'vscode/terminalActions/workbench.action.terminal.newInActiveWorkspace', TERMINAL_CATEGORY_KEY); + export const TERMINAL_CLEAR = Command.toLocalizedCommand({ id: 'terminal:clear', category: TERMINAL_CATEGORY, label: 'Clear Terminal' - }; - export const TERMINAL_CONTEXT: Command = { + }, 'vscode/terminalActions/workbench.action.terminal.clear', TERMINAL_CATEGORY_KEY); + export const TERMINAL_CONTEXT = Command.toLocalizedCommand({ id: 'terminal:context', category: TERMINAL_CATEGORY, label: 'Open in Terminal' - }; - export const SPLIT: Command = { + }, 'vscode/scm.contribution/open in terminal', TERMINAL_CATEGORY_KEY); + export const SPLIT = Command.toLocalizedCommand({ id: 'terminal:split', category: TERMINAL_CATEGORY, label: 'Split Terminal' - }; - export const TERMINAL_FIND_TEXT: Command = { + }, 'vscode/terminalActions/workbench.action.terminal.split', TERMINAL_CATEGORY_KEY); + export const TERMINAL_FIND_TEXT = Command.toLocalizedCommand({ id: 'terminal:find', category: TERMINAL_CATEGORY, label: 'Find' - }; - export const TERMINAL_FIND_TEXT_CANCEL: Command = { + }, 'vscode/findController/startFindAction', TERMINAL_CATEGORY_KEY); + export const TERMINAL_FIND_TEXT_CANCEL = Command.toLocalizedCommand({ id: 'terminal:find:cancel', category: TERMINAL_CATEGORY, label: 'Hide find widget' - }; + }, 'vscode/terminalActions/workbench.action.terminal.hideFind', TERMINAL_CATEGORY_KEY); - export const SCROLL_LINE_UP: Command = { + export const SCROLL_LINE_UP = Command.toLocalizedCommand({ id: 'terminal:scroll:line:up', category: TERMINAL_CATEGORY, label: 'Scroll line up' - }; - export const SCROLL_LINE_DOWN: Command = { + }, 'vscode/terminalActions/workbench.action.terminal.scrollUp', TERMINAL_CATEGORY_KEY); + export const SCROLL_LINE_DOWN = Command.toLocalizedCommand({ id: 'terminal:scroll:line:down', category: TERMINAL_CATEGORY, label: 'Scroll line down' - }; - export const SCROLL_TO_TOP: Command = { + }, 'vscode/terminalActions/workbench.action.terminal.scrollDown', TERMINAL_CATEGORY_KEY); + export const SCROLL_TO_TOP = Command.toLocalizedCommand({ id: 'terminal:scroll:top', category: TERMINAL_CATEGORY, label: 'Scroll to top' - }; - export const SCROLL_PAGE_UP: Command = { + }, 'vscode/terminalActions/workbench.action.terminal.scrollToTop', TERMINAL_CATEGORY_KEY); + export const SCROLL_PAGE_UP = Command.toLocalizedCommand({ id: 'terminal:scroll:page:up', category: TERMINAL_CATEGORY, label: 'Scroll page up' - }; - export const SCROLL_PAGE_DOWN: Command = { + }, 'vscode/terminalActions/workbench.action.terminal.scrollUpPage', TERMINAL_CATEGORY_KEY); + export const SCROLL_PAGE_DOWN = Command.toLocalizedCommand({ id: 'terminal:scroll:page:down', category: TERMINAL_CATEGORY, label: 'Scroll page down' - }; + }, 'vscode/terminalActions/workbench.action.terminal.scrollDownPage', TERMINAL_CATEGORY_KEY); /** * Command that displays all terminals that are currently opened */ - export const SHOW_ALL_OPENED_TERMINALS: Command = { + export const SHOW_ALL_OPENED_TERMINALS = Command.toLocalizedCommand({ id: 'workbench.action.showAllTerminals', - category: 'View', + category: CommonCommands.VIEW_CATEGORY, label: 'Show All Opened Terminals' - }; + }, 'vscode/terminal.contribution/tasksQuickAccessHelp', CommonCommands.VIEW_CATEGORY_KEY); } @injectable() @@ -389,10 +391,10 @@ export class TerminalFrontendContribution implements TerminalService, CommandCon } registerMenus(menus: MenuModelRegistry): void { - menus.registerSubmenu(TerminalMenus.TERMINAL, 'Terminal'); + menus.registerSubmenu(TerminalMenus.TERMINAL, TerminalWidgetImpl.LABEL); menus.registerMenuAction(TerminalMenus.TERMINAL_NEW, { commandId: TerminalCommands.NEW.id, - label: 'New Terminal', + label: nls.localize('vscode/terminalActions/workbench.action.terminal.new.short', 'New Terminal'), order: '0' }); menus.registerMenuAction(TerminalMenus.TERMINAL_NEW, { @@ -598,7 +600,7 @@ export class TerminalFrontendContribution implements TerminalService, CommandCon resource })); const selectedItem = await this.quickInputService?.showQuickPick(items, { - placeholder: 'Select current working directory for new terminal' + placeholder: nls.localize('vscode/terminalActions/workbench.action.terminal.newWorkspacePlaceholder', 'Select current working directory for new terminal') }); resolve(selectedItem?.resource?.toString()); } diff --git a/packages/terminal/src/browser/terminal-linkmatcher.ts b/packages/terminal/src/browser/terminal-linkmatcher.ts index b44ed42d1bae3..6fa17f665d0a5 100644 --- a/packages/terminal/src/browser/terminal-linkmatcher.ts +++ b/packages/terminal/src/browser/terminal-linkmatcher.ts @@ -87,11 +87,7 @@ export abstract class AbstractCmdClickTerminalContribution implements TerminalCo } protected getHoverMessage(): string { - if (isOSX) { - return 'Cmd + click to follow link'; - } else { - return 'Ctrl + click to follow link'; - } + return TerminalWidgetImpl.getFollowLinkHover(); } } diff --git a/packages/terminal/src/browser/terminal-preferences.ts b/packages/terminal/src/browser/terminal-preferences.ts index de92a37a02690..1db95d96378e5 100644 --- a/packages/terminal/src/browser/terminal-preferences.ts +++ b/packages/terminal/src/browser/terminal-preferences.ts @@ -14,135 +14,131 @@ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 ********************************************************************************/ +/* eslint-disable max-len */ + import { interfaces } from '@theia/core/shared/inversify'; import { createPreferenceProxy, PreferenceProxy, PreferenceService, PreferenceContribution, PreferenceSchema } from '@theia/core/lib/browser'; import { EDITOR_FONT_DEFAULTS } from '@theia/editor/lib/browser'; +import { nls } from '@theia/core/lib/common/nls'; export const TerminalConfigSchema: PreferenceSchema = { type: 'object', properties: { 'terminal.enableCopy': { type: 'boolean', - description: 'Enable ctrl-c (cmd-c on macOS) to copy selected text', + description: nls.localize('theia/terminal/enableCopy', 'Enable ctrl-c (cmd-c on macOS) to copy selected text'), default: true }, 'terminal.enablePaste': { type: 'boolean', - description: 'Enable ctrl-v (cmd-v on macOS) to paste from clipboard', + description: nls.localize('theia/terminal/enablePaste', 'Enable ctrl-v (cmd-v on macOS) to paste from clipboard'), default: true }, 'terminal.integrated.fontFamily': { type: 'string', - description: 'Controls the font family of the terminal.', + description: nls.localize('vscode/terminalConfiguration/terminal.integrated.fontFamily', 'Controls the font family of the terminal.'), default: EDITOR_FONT_DEFAULTS.fontFamily }, 'terminal.integrated.fontSize': { type: 'number', - description: 'Controls the font size in pixels of the terminal.', + description: nls.localize('vscode/terminalConfiguration/terminal.integrated.fontSize', 'Controls the font size in pixels of the terminal.'), minimum: 6, default: EDITOR_FONT_DEFAULTS.fontSize }, 'terminal.integrated.fontWeight': { type: 'string', enum: ['normal', 'bold', '100', '200', '300', '400', '500', '600', '700', '800', '900'], - description: 'The font weight to use within the terminal for non-bold text.', + description: nls.localize('vscode/terminalConfiguration/terminal.integrated.fontWeight', 'The font weight to use within the terminal for non-bold text.'), default: 'normal' }, 'terminal.integrated.fontWeightBold': { type: 'string', enum: ['normal', 'bold', '100', '200', '300', '400', '500', '600', '700', '800', '900'], - description: 'The font weight to use within the terminal for bold text.', + description: nls.localize('vscode/terminalConfiguration/terminal.integrated.fontWeightBold', 'The font weight to use within the terminal for bold text.'), default: 'bold' }, 'terminal.integrated.drawBoldTextInBrightColors': { - description: 'Controls whether to draw bold text in bright colors.', + description: nls.localize('vscode/terminalConfiguration/terminal.integrated.drawBoldTextInBrightColors', 'Controls whether to draw bold text in bright colors.'), type: 'boolean', default: true, }, 'terminal.integrated.letterSpacing': { - description: 'Controls the letter spacing of the terminal, this is an integer value which represents the amount of additional pixels to add between characters.', + description: nls.localize('vscode/terminalConfiguration/terminal.integrated.letterSpacing', 'Controls the letter spacing of the terminal, this is an integer value which represents the amount of additional pixels to add between characters.'), type: 'number', default: 1 }, 'terminal.integrated.lineHeight': { - description: 'Controls the line height of the terminal, this number is multiplied by the terminal font size to get the actual line-height in pixels.', + description: nls.localize('vscode/terminalConfiguration/terminal.integrated.lineHeight', 'Controls the line height of the terminal, this number is multiplied by the terminal font size to get the actual line-height in pixels.'), type: 'number', minimum: 1, default: 1 }, 'terminal.integrated.scrollback': { - description: 'Controls the maximum amount of lines the terminal keeps in its buffer.', + description: nls.localize('vscode/terminalConfiguration/terminal.integrated.scrollback', 'Controls the maximum amount of lines the terminal keeps in its buffer.'), type: 'number', default: 1000 }, 'terminal.integrated.fastScrollSensitivity': { - description: 'Controls the scrolling speed when pressing \'alt\'.', + description: nls.localize('vscode/terminalConfiguration/terminal.integrated.fastScrollSensitivity', 'Controls the scrolling speed when pressing \'alt\'.'), type: 'number', default: 5, }, 'terminal.integrated.rendererType': { - description: 'Controls how the terminal is rendered.', + description: nls.localize('vscode/terminalConfiguration/terminal.integrated.rendererType', 'Controls how the terminal is rendered.'), type: 'string', enum: ['canvas', 'dom'], default: 'canvas' }, 'terminal.integrated.copyOnSelection': { - description: 'Controls whether text selected in the terminal will be copied to the clipboard.', + description: nls.localize('vscode/terminalConfiguration/terminal.integrated.copyOnSelection', 'Controls whether text selected in the terminal will be copied to the clipboard.'), type: 'boolean', default: false, }, 'terminal.integrated.cursorBlinking': { - description: 'Controls whether the terminal cursor blinks.', + description: nls.localize('vscode/terminalConfiguration/terminal.integrated.cursorBlinking', 'Controls whether the terminal cursor blinks.'), type: 'boolean', default: false }, 'terminal.integrated.cursorStyle': { - description: 'Controls the style of the terminal cursor.', + description: nls.localize('vscode/terminalConfiguration/terminal.integrated.cursorStyle', 'Controls the style of the terminal cursor.'), enum: ['block', 'underline', 'line'], default: 'block' }, 'terminal.integrated.cursorWidth': { - description: 'Controls the width of the cursor when \'terminal.integrated.cursorStyle\' is set to \'line\'.', - markdownDescription: 'Controls the width of the cursor when `#terminal.integrated.cursorStyle#` is set to `line`.', + markdownDescription: nls.localize('vscode/terminalConfiguration/terminal.integrated.cursorWidth', 'Controls the width of the cursor when `#terminal.integrated.cursorStyle#` is set to `line`.'), type: 'number', default: 1 }, 'terminal.integrated.shell.windows': { type: ['string', 'null'], - description: 'The path of the shell that the terminal uses on Windows. (default: C:\\Windows\\System32\\cmd.exe).', - markdownDescription: 'The path of the shell that the terminal uses on Windows. (default: C:\\Windows\\System32\\cmd.exe).', + markdownDescription: nls.localize('vscode/terminalConfiguration/terminal.integrated.shell.windows', 'The path of the shell that the terminal uses on Windows. (default: C:\\Windows\\System32\\cmd.exe).'), default: undefined }, 'terminal.integrated.shell.osx': { type: ['string', 'null'], - description: 'The path of the shell that the terminal uses on macOS (default: \'/bin/bash\'}).', - markdownDescription: 'The path of the shell that the terminal uses on macOS (default: \'/bin/bash\'}).', + markdownDescription: nls.localize('vscode/terminalConfiguration/terminal.integrated.shell.osx', 'The path of the shell that the terminal uses on macOS (default: \'/bin/bash\'}).'), default: undefined }, 'terminal.integrated.shell.linux': { type: ['string', 'null'], - description: 'The path of the shell that the terminal uses on Linux (default: \'/bin/bash\'}).', - markdownDescription: 'The path of the shell that the terminal uses on Linux (default: \'/bin/bash\'}).', + markdownDescription: nls.localize('vscode/terminalConfiguration/terminal.integrated.shell.linux', 'The path of the shell that the terminal uses on Linux (default: \'/bin/bash\'}).'), default: undefined }, 'terminal.integrated.shellArgs.windows': { type: 'array', - description: 'The command line arguments to use when on the Windows terminal.', - markdownDescription: 'The command line arguments to use when on the Windows terminal.', + markdownDescription: nls.localize('vscode/terminalConfiguration/terminal.integrated.shellArgs.windows', 'The command line arguments to use when on the Windows terminal.'), default: [] }, 'terminal.integrated.shellArgs.osx': { type: 'array', - description: 'The command line arguments to use when on the macOS terminal.', - markdownDescription: 'The command line arguments to use when on the macOS terminal.', + markdownDescription: nls.localize('vscode/terminalConfiguration/terminal.integrated.shellArgs.osx', 'The command line arguments to use when on the macOS terminal.'), default: [ '-l' ] }, 'terminal.integrated.shellArgs.linux': { type: 'array', - description: 'The command line arguments to use when on the Linux terminal.', - markdownDescription: 'The command line arguments to use when on the Linux terminal.', + markdownDescription: nls.localize('vscode/terminalConfiguration/terminal.integrated.shellArgs.linux', 'The command line arguments to use when on the Linux terminal.'), default: [] }, } diff --git a/packages/terminal/src/browser/terminal-widget-impl.ts b/packages/terminal/src/browser/terminal-widget-impl.ts index 2a70632a25d49..60eeb8747b685 100644 --- a/packages/terminal/src/browser/terminal-widget-impl.ts +++ b/packages/terminal/src/browser/terminal-widget-impl.ts @@ -37,6 +37,7 @@ import { TerminalCopyOnSelectionHandler } from './terminal-copy-on-selection-han import { TerminalThemeService } from './terminal-theme-service'; import { CommandLineOptions, ShellCommandBuilder } from '@theia/process/lib/common/shell-command-builder'; import { Key } from '@theia/core/lib/browser/keys'; +import { nls } from '@theia/core/lib/common/nls'; export const TERMINAL_WIDGET_FACTORY_ID = 'terminal'; @@ -48,7 +49,7 @@ export interface TerminalWidgetFactoryOptions extends Partial(); @@ -94,7 +95,7 @@ export class TerminalWidgetImpl extends TerminalWidget implements StatefulWidget @postConstruct() protected init(): void { - this.setTitle(this.options.title || this.TERMINAL); + this.setTitle(this.options.title || TerminalWidgetImpl.LABEL); this.title.iconClass = codicon('terminal'); if (this.options.kind) { @@ -131,7 +132,7 @@ export class TerminalWidgetImpl extends TerminalWidget implements StatefulWidget this.term.loadAddon(this.fitAddon); this.hoverMessage = document.createElement('div'); - this.hoverMessage.textContent = 'Cmd + click to follow link'; + this.hoverMessage.textContent = TerminalWidgetImpl.getFollowLinkHover(); this.hoverMessage.style.position = 'fixed'; // TODO use `var(--theia-editorHoverWidget-foreground) with a newer Monaco version this.hoverMessage.style.color = 'var(--theia-editorWidget-foreground)'; @@ -246,6 +247,12 @@ export class TerminalWidgetImpl extends TerminalWidget implements StatefulWidget this.toDispose.push(this.searchBox); } + static getFollowLinkHover(): string { + const cmdCtrl = isOSX ? 'Cmd' : 'Ctrl'; + return nls.localize('vscode/terminalLinkManager/followLink', 'Follow link') + ' (' + + nls.localize(`vscode/terminalLinkManager/terminalLinkHandler.followLink${cmdCtrl}`, `${cmdCtrl} + Click`) + ')'; + } + get kind(): 'user' | string { return this.terminalKind; } diff --git a/packages/typehierarchy/src/browser/tree/typehierarchy-tree-widget.tsx b/packages/typehierarchy/src/browser/tree/typehierarchy-tree-widget.tsx index 10deb35b76688..7a83e882ed45a 100644 --- a/packages/typehierarchy/src/browser/tree/typehierarchy-tree-widget.tsx +++ b/packages/typehierarchy/src/browser/tree/typehierarchy-tree-widget.tsx @@ -26,6 +26,7 @@ import { TreeWidget, TreeProps } from '@theia/core/lib/browser/tree/tree-widget' import { TypeHierarchyTreeModel } from './typehierarchy-tree-model'; import { TypeHierarchyTree } from './typehierarchy-tree'; import { codicon } from '@theia/core/lib/browser'; +import { nls } from '@theia/core/lib/common/nls'; @injectable() export class TypeHierarchyTreeWidget extends TreeWidget { @@ -93,7 +94,7 @@ export class TypeHierarchyTreeWidget extends TreeWidget { export namespace TypeHierarchyTreeWidget { export const WIDGET_ID = 'theia-typehierarchy'; - export const WIDGET_LABEL = 'Type Hierarchy'; + export const WIDGET_LABEL = nls.localize('theia/typehierarchy/typeHierarchy', 'Type Hierarchy'); /** * CSS styles for the `Type Hierarchy` widget. diff --git a/packages/typehierarchy/src/browser/typehierarchy-contribution.ts b/packages/typehierarchy/src/browser/typehierarchy-contribution.ts index adcaff2a7dfef..168c804c7f262 100644 --- a/packages/typehierarchy/src/browser/typehierarchy-contribution.ts +++ b/packages/typehierarchy/src/browser/typehierarchy-contribution.ts @@ -137,14 +137,14 @@ export namespace TypeHierarchyCommands { id: 'typehierarchy:toggle' }; - export const OPEN_SUBTYPE: Command = { + export const OPEN_SUBTYPE = Command.toLocalizedCommand({ id: 'typehierarchy:open-subtype', label: 'Subtype Hierarchy' - }; + }, 'theia/typehierarchy/subtypeHierarchy'); - export const OPEN_SUPERTYPE: Command = { + export const OPEN_SUPERTYPE = Command.toLocalizedCommand({ id: 'typehierarchy:open-supertype', label: 'Supertype Hierarchy' - }; + }, 'theia/typehierarchy/supertypeHierarchy'); } diff --git a/packages/vsx-registry/src/browser/recommended-extensions/recommended-extensions-preference-contribution.ts b/packages/vsx-registry/src/browser/recommended-extensions/recommended-extensions-preference-contribution.ts index 489bb0dfcaa2d..cb267a83bcb06 100644 --- a/packages/vsx-registry/src/browser/recommended-extensions/recommended-extensions-preference-contribution.ts +++ b/packages/vsx-registry/src/browser/recommended-extensions/recommended-extensions-preference-contribution.ts @@ -16,6 +16,7 @@ import { createPreferenceProxy, PreferenceContribution, PreferenceSchema, PreferenceScope, PreferenceService } from '@theia/core/lib/browser'; import { JsonSchemaContribution } from '@theia/core/lib/browser/json-schema-store'; +import { nls } from '@theia/core/lib/common/nls'; import { PreferenceConfiguration } from '@theia/core/lib/browser/preferences/preference-configurations'; import { interfaces } from '@theia/core/shared/inversify'; import { ExtensionSchemaContribution, extensionsSchemaID } from './recommended-extensions-json-schema'; @@ -31,7 +32,7 @@ export const recommendedExtensionsPreferencesSchema: PreferenceSchema = { properties: { extensions: { $ref: extensionsSchemaID, - description: 'A list of the names of extensions recommended for use in this workspace.', + description: nls.localize('theia/vsx-registry/recommendedExtensions', 'A list of the names of extensions recommended for use in this workspace.'), defaultValue: { recommendations: [] }, }, }, @@ -44,7 +45,7 @@ export const recommendedExtensionNotificationPreferencesSchema: PreferenceSchema scope: PreferenceScope.Folder, properties: { [IGNORE_RECOMMENDATIONS_ID]: { - description: 'Controls whether notifications are shown for extension recommendations.', + description: nls.localize('theia/vsx-registry/showRecommendedExtensions', 'Controls whether notifications are shown for extension recommendations.'), default: false, type: 'boolean' } diff --git a/packages/vsx-registry/src/browser/vsx-extension-commands.ts b/packages/vsx-registry/src/browser/vsx-extension-commands.ts index 50459aced711d..ce579f0a470e4 100644 --- a/packages/vsx-registry/src/browser/vsx-extension-commands.ts +++ b/packages/vsx-registry/src/browser/vsx-extension-commands.ts @@ -14,24 +14,28 @@ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 ********************************************************************************/ +import { nls } from '@theia/core/lib/common/nls'; import { codicon } from '@theia/core/lib/browser'; import { Command } from '@theia/core/lib/common'; export namespace VSXExtensionsCommands { + const EXTENSIONS_CATEGORY_KEY = 'vscode/settingsLayout/extensions'; const EXTENSIONS_CATEGORY = 'Extensions'; - export const CLEAR_ALL: Command = { + export const CLEAR_ALL = Command.toLocalizedCommand({ id: 'vsxExtensions.clearAll', category: EXTENSIONS_CATEGORY, label: 'Clear Search Results', iconClass: codicon('clear-all') - }; + }, 'vscode/search.contribution/ClearSearchResultsAction.label', EXTENSIONS_CATEGORY_KEY); export const INSTALL_FROM_VSIX: Command & { dialogLabel: string } = { id: 'vsxExtensions.installFromVSIX', - category: EXTENSIONS_CATEGORY, - label: 'Install from VSIX...', - dialogLabel: 'Install from VSIX' + category: nls.localize(EXTENSIONS_CATEGORY_KEY, EXTENSIONS_CATEGORY), + originalCategory: EXTENSIONS_CATEGORY, + originalLabel: 'Install from VSIX...', + label: nls.localize('theia/vsx-registry/installFromVSIX', 'Install from VSIX') + '...', + dialogLabel: nls.localize('theia/vsx-registry/installFromVSIX', 'Install from VSIX') }; export const COPY: Command = { id: 'vsxExtensions.copy' @@ -39,19 +43,19 @@ export namespace VSXExtensionsCommands { export const COPY_EXTENSION_ID: Command = { id: 'vsxExtensions.copyExtensionId' }; - export const SHOW_BUILTINS: Command = { + export const SHOW_BUILTINS = Command.toLocalizedCommand({ id: 'vsxExtension.showBuiltins', label: 'Show Built-in Extensions', category: EXTENSIONS_CATEGORY, - }; - export const SHOW_INSTALLED: Command = { + }, 'vscode/extensions.contribution/showBuiltInExtensions', EXTENSIONS_CATEGORY_KEY); + export const SHOW_INSTALLED = Command.toLocalizedCommand({ id: 'vsxExtension.showInstalled', label: 'Show Installed Extensions', category: EXTENSIONS_CATEGORY, - }; - export const SHOW_RECOMMENDATIONS: Command = { + }, 'vscode/extensions.contribution/showInstalledExtensions', EXTENSIONS_CATEGORY_KEY); + export const SHOW_RECOMMENDATIONS = Command.toLocalizedCommand({ id: 'vsxExtension.showRecommendations', label: 'Show Recommended Extensions', category: EXTENSIONS_CATEGORY, - }; + }, 'vscode/extensions.contribution/showRecommendedExtensions', EXTENSIONS_CATEGORY_KEY); } diff --git a/packages/vsx-registry/src/browser/vsx-extensions-view-container.ts b/packages/vsx-registry/src/browser/vsx-extensions-view-container.ts index 479f2936e32ed..49318b7313158 100644 --- a/packages/vsx-registry/src/browser/vsx-extensions-view-container.ts +++ b/packages/vsx-registry/src/browser/vsx-extensions-view-container.ts @@ -22,12 +22,13 @@ import { VSXSearchMode } from './vsx-extensions-search-model'; import { generateExtensionWidgetId } from './vsx-extensions-widget'; import { VSXExtensionsSourceOptions } from './vsx-extensions-source'; import { VSXExtensionsCommands } from './vsx-extension-commands'; +import { nls } from '@theia/core/lib/common/nls'; @injectable() export class VSXExtensionsViewContainer extends ViewContainer { static ID = 'vsx-extensions-view-container'; - static LABEL = 'Extensions'; + static LABEL = nls.localize('vscode/settingsLayout/extensions', 'Extensions'); disableDNDBetweenContainers = true; @@ -165,7 +166,7 @@ export class VSXExtensionsViewContainer extends ViewContainer { } protected getToggleVisibilityGroupLabel(): string { - return 'a/Views'; + return 'a/' + nls.localize('vscode/viewPaneContainer/views', 'Views'); } } export namespace VSXExtensionsViewContainer { diff --git a/packages/vsx-registry/src/browser/vsx-extensions-widget.ts b/packages/vsx-registry/src/browser/vsx-extensions-widget.ts index 46371f9d9fd40..adbdf4308838e 100644 --- a/packages/vsx-registry/src/browser/vsx-extensions-widget.ts +++ b/packages/vsx-registry/src/browser/vsx-extensions-widget.ts @@ -17,6 +17,7 @@ import { injectable, interfaces, postConstruct, inject } from '@theia/core/shared/inversify'; import { SourceTreeWidget } from '@theia/core/lib/browser/source-tree'; import { VSXExtensionsSource, VSXExtensionsSourceOptions } from './vsx-extensions-source'; +import { nls } from '@theia/core/lib/common/nls'; @injectable() export class VSXExtensionsWidgetOptions extends VSXExtensionsSourceOptions { @@ -66,13 +67,13 @@ export class VSXExtensionsWidget extends SourceTreeWidget { protected computeTitle(): string { switch (this.options.id) { case VSXExtensionsSourceOptions.INSTALLED: - return 'Installed'; + return nls.localize('vscode/extensions.contribution/installed filter', 'Installed'); case VSXExtensionsSourceOptions.BUILT_IN: - return 'Built-in'; + return nls.localize('vscode/extensions.contribution/builtin filter', 'Built-in'); case VSXExtensionsSourceOptions.RECOMMENDED: - return 'Recommended'; + return nls.localize('vscode/extensions.contribution/most popular recommended', 'Recommended'); case VSXExtensionsSourceOptions.SEARCH_RESULT: - return 'Open VSX Registry'; + return nls.localize('theia/vsx-registry/openVSX', 'Open VSX Registry'); default: return ''; } diff --git a/packages/workspace/src/browser/workspace-commands.ts b/packages/workspace/src/browser/workspace-commands.ts index 7b65e498bdec1..d8337c6aac064 100644 --- a/packages/workspace/src/browser/workspace-commands.ts +++ b/packages/workspace/src/browser/workspace-commands.ts @@ -22,8 +22,8 @@ import { Command, CommandContribution, CommandRegistry } from '@theia/core/lib/c import { MenuContribution, MenuModelRegistry } from '@theia/core/lib/common/menu'; import { CommonMenus } from '@theia/core/lib/browser/common-frontend-contribution'; import { FileDialogService } from '@theia/filesystem/lib/browser'; -import { SingleTextInputDialog, ConfirmDialog } from '@theia/core/lib/browser/dialogs'; -import { OpenerService, OpenHandler, open, FrontendApplication, LabelProvider } from '@theia/core/lib/browser'; +import { SingleTextInputDialog, ConfirmDialog, Dialog } from '@theia/core/lib/browser/dialogs'; +import { OpenerService, OpenHandler, open, FrontendApplication, LabelProvider, CommonCommands } from '@theia/core/lib/browser'; import { UriCommandHandler, UriAwareCommandHandler } from '@theia/core/lib/common/uri-command-handler'; import { WorkspaceService } from './workspace-service'; import { MessageService } from '@theia/core/lib/common/message-service'; @@ -38,108 +38,115 @@ import { WorkspaceInputDialog } from './workspace-input-dialog'; import { Emitter, Event, OS } from '@theia/core/lib/common'; import { FileService } from '@theia/filesystem/lib/browser/file-service'; import { FileStat } from '@theia/filesystem/lib/common/files'; +import { nls } from '@theia/core/lib/common/nls'; const validFilename: (arg: string) => boolean = require('valid-filename'); export namespace WorkspaceCommands { - const WORKSPACE_CATEGORY = 'Workspace'; - const FILE_CATEGORY = 'File'; + const WORKSPACE_CATEGORY_KEY = 'vscode/workspaceActions/workspaces'; + const WORKSPACE_CATEGORY = 'Workspaces'; + const FILE_CATEGORY = CommonCommands.FILE_CATEGORY; // On Linux and Windows, both files and folders cannot be opened at the same time in electron. // `OPEN_FILE` and `OPEN_FOLDER` must be available only on Linux and Windows in electron. // `OPEN` must *not* be available on Windows and Linux in electron. // VS Code does the same. See: https://github.com/eclipse-theia/theia/pull/3202#issuecomment-430585357 export const OPEN: Command & { dialogLabel: string } = { - id: 'workspace:open', - category: FILE_CATEGORY, - label: 'Open...', - dialogLabel: 'Open' + ...Command.toLocalizedCommand({ + id: 'workspace:open', + category: CommonCommands.FILE_CATEGORY, + label: 'Open...' + }, 'vscode/workspaceActions/openFileFolder', CommonCommands.FILE_CATEGORY_KEY), + dialogLabel: nls.localize('vscode/dialogMainService/open', 'Open') }; // No `label`. Otherwise, it shows up in the `Command Palette`. export const OPEN_FILE: Command & { dialogLabel: string } = { id: 'workspace:openFile', - category: FILE_CATEGORY, + originalCategory: FILE_CATEGORY, + category: nls.localize(CommonCommands.FILE_CATEGORY_KEY, CommonCommands.FILE_CATEGORY), dialogLabel: 'Open File' }; export const OPEN_FOLDER: Command & { dialogLabel: string } = { id: 'workspace:openFolder', - dialogLabel: 'Open Folder' // No `label`. Otherwise, it shows up in the `Command Palette`. + dialogLabel: nls.localize('vscode/dialogMainService/openFolder', 'Open Folder') // No `label`. Otherwise, it shows up in the `Command Palette`. }; export const OPEN_WORKSPACE: Command & { dialogLabel: string } = { - id: 'workspace:openWorkspace', - category: FILE_CATEGORY, - label: 'Open Workspace...', - dialogLabel: 'Open Workspace' + ...Command.toLocalizedCommand({ + id: 'workspace:openWorkspace', + category: CommonCommands.FILE_CATEGORY, + label: 'Open Workspace...', + }, 'vscode/workspaceActions/openWorkspaceAction', CommonCommands.FILE_CATEGORY_KEY), + dialogLabel: nls.localize('vscode/dialogMainService/openWorkspaceTitle', 'Open Workspace') }; - export const OPEN_RECENT_WORKSPACE: Command = { + export const OPEN_RECENT_WORKSPACE = Command.toLocalizedCommand({ id: 'workspace:openRecent', category: FILE_CATEGORY, label: 'Open Recent Workspace...' - }; - export const CLOSE: Command = { + }, 'theia/workspace/openRecentWorkspace', CommonCommands.FILE_CATEGORY_KEY); + export const CLOSE = Command.toLocalizedCommand({ id: 'workspace:close', category: WORKSPACE_CATEGORY, label: 'Close Workspace' - }; - export const NEW_FILE: Command = { + }, 'vscode/workspaceActions/closeWorkspace', WORKSPACE_CATEGORY_KEY); + export const NEW_FILE = Command.toLocalizedCommand({ id: 'file.newFile', category: FILE_CATEGORY, label: 'New File' - }; - export const NEW_FOLDER: Command = { + }, 'vscode/fileActions/newFile', CommonCommands.FILE_CATEGORY_KEY); + export const NEW_FOLDER = Command.toLocalizedCommand({ id: 'file.newFolder', category: FILE_CATEGORY, label: 'New Folder' - }; + }, 'vscode/fileActions/newFile', CommonCommands.FILE_CATEGORY_KEY); export const FILE_OPEN_WITH = (opener: OpenHandler): Command => ({ id: `file.openWith.${opener.id}` }); - export const FILE_RENAME: Command = { + export const FILE_RENAME = Command.toLocalizedCommand({ id: 'file.rename', category: FILE_CATEGORY, label: 'Rename' - }; - export const FILE_DELETE: Command = { + }, 'vscode/fileActions/rename', CommonCommands.FILE_CATEGORY_KEY); + export const FILE_DELETE = Command.toLocalizedCommand({ id: 'file.delete', category: FILE_CATEGORY, label: 'Delete' - }; - export const FILE_DUPLICATE: Command = { + }, 'vscode/fileActions/delete', CommonCommands.FILE_CATEGORY_KEY); + export const FILE_DUPLICATE = Command.toLocalizedCommand({ id: 'file.duplicate', category: FILE_CATEGORY, label: 'Duplicate' - }; - export const FILE_COMPARE: Command = { + }, 'theia/workspace/duplicate', CommonCommands.FILE_CATEGORY_KEY); + export const FILE_COMPARE = Command.toLocalizedCommand({ id: 'file.compare', category: FILE_CATEGORY, label: 'Compare with Each Other' - }; - export const ADD_FOLDER: Command = { + }, 'vscode/fileActions.contribution/compareSelected', CommonCommands.FILE_CATEGORY_KEY); + export const ADD_FOLDER = Command.toLocalizedCommand({ id: 'workspace:addFolder', category: WORKSPACE_CATEGORY, label: 'Add Folder to Workspace...' - }; - export const REMOVE_FOLDER: Command = { + }, 'vscode/workspaceCommands/addFolderToWorkspace', WORKSPACE_CATEGORY_KEY); + export const REMOVE_FOLDER = Command.toLocalizedCommand({ id: 'workspace:removeFolder', category: WORKSPACE_CATEGORY, label: 'Remove Folder from Workspace' - }; - export const SAVE_WORKSPACE_AS: Command = { + }, 'vscode/fileCommands/removeFolderFromWorkspace', WORKSPACE_CATEGORY_KEY); + export const SAVE_WORKSPACE_AS = Command.toLocalizedCommand({ id: 'workspace:saveAs', category: WORKSPACE_CATEGORY, label: 'Save Workspace As...' - }; - export const OPEN_WORKSPACE_FILE: Command = { + }, 'vscode/workspaceActions/saveWorkspaceAsAction', WORKSPACE_CATEGORY_KEY); + export const OPEN_WORKSPACE_FILE = Command.toLocalizedCommand({ id: 'workspace:openConfigFile', category: WORKSPACE_CATEGORY, label: 'Open Workspace Configuration File' - }; - export const SAVE_AS: Command = { + }, 'vscode/abstractWorkspaceEditingService/openWorkspaceConfigurationFile', WORKSPACE_CATEGORY_KEY); + export const SAVE_AS = Command.toLocalizedCommand({ id: 'file.saveAs', - category: 'File', + category: CommonCommands.FILE_CATEGORY, label: 'Save As...', - }; + }, 'vscode/fileCommands/saveAs', CommonCommands.FILE_CATEGORY_KEY); } @injectable() @@ -237,7 +244,7 @@ export class WorkspaceCommandContribution implements CommandContribution { const vacantChildUri = FileSystemUtils.generateUniqueResourceURI(parentUri, parent, fileName, fileExtension); const dialog = new WorkspaceInputDialog({ - title: 'New File', + title: nls.localize('vscode/fileActions/newFile', 'New File'), parentUri: parentUri, initialValue: vacantChildUri.path.base, validate: name => this.validateFileName(name, parent, true) @@ -260,7 +267,7 @@ export class WorkspaceCommandContribution implements CommandContribution { const parentUri = parent.resource; const vacantChildUri = FileSystemUtils.generateUniqueResourceURI(parentUri, parent, 'Untitled'); const dialog = new WorkspaceInputDialog({ - title: 'New Folder', + title: nls.localize('vscode/fileActions/newFolder', 'New Folder'), parentUri: parentUri, initialValue: vacantChildUri.path.base, validate: name => this.validateFileName(name, parent, true) @@ -283,11 +290,8 @@ export class WorkspaceCommandContribution implements CommandContribution { const parent = await this.getParent(uri); if (parent) { const oldName = uri.path.base; - const stat = await this.fileService.resolve(uri); - const fileType = stat.isDirectory ? 'Directory' : 'File'; - const titleStr = `Rename ${fileType}`; const dialog = new SingleTextInputDialog({ - title: titleStr, + title: nls.localize('vscode/fileActions/rename', 'Rename'), initialValue: oldName, initialSelectionRange: { start: 0, @@ -333,10 +337,11 @@ export class WorkspaceCommandContribution implements CommandContribution { if (!workspaceSavedBeforeAdding) { const saveCommand = registry.getCommand(WorkspaceCommands.SAVE_WORKSPACE_AS.id); if (saveCommand && await new ConfirmDialog({ - title: 'Folder added to Workspace', - msg: 'A workspace with multiple roots was created. Do you want to save your workspace configuration as a file?', - ok: 'Yes', - cancel: 'No' + title: nls.localize('theia/workspace/workspaceFolderAddedTitle', 'Folder added to Workspace'), + msg: nls.localize('theia/workspace/workspaceFolderAdded', + 'A workspace with multiple roots was created. Do you want to save your workspace configuration as a file?'), + ok: Dialog.YES, + cancel: Dialog.NO }).open()) { registry.executeCommand(saveCommand.id); } @@ -404,21 +409,21 @@ export class WorkspaceCommandContribution implements CommandContribution { } // do not allow recursive rename if (!allowNested && !validFilename(name)) { - return 'Invalid file or folder name'; + return nls.localize('vscode/configureSnippets/bad_name1', 'Invalid file or folder name'); } if (name.startsWith('/')) { - return 'Absolute paths or names that starts with / are not allowed'; + return nls.localize('vscode/fileActions/fileNameStartsWithSlashError', 'Absolute paths or names that starts with / are not allowed'); } else if (name.startsWith(' ') || name.endsWith(' ')) { - return 'Names with leading or trailing whitespaces are not allowed'; + return nls.localize('vscode/fileActions/fileNameWhitespaceWarning', 'Names with leading or trailing whitespaces are not allowed'); } // check and validate each sub-paths if (name.split(/[\\/]/).some(file => !file || !validFilename(file) || /^\s+$/.test(file))) { - return `The name "${this.trimFileName(name)}" is not a valid file or folder name.`; + return nls.localize('vscode/fileActions/invalidFileNameError', 'The name "{0}" is not a valid file or folder name.', this.trimFileName(name)); } const childUri = parent.resource.resolve(name); const exists = await this.fileService.exists(childUri); if (exists) { - return `A file or folder "${this.trimFileName(name)}" already exists at this location.`; + return nls.localize('vscode/fileActions/fileNameExistsError', 'A file or folder "{0}" already exists at this location.', this.trimFileName(name)); } return ''; } @@ -489,8 +494,9 @@ export class WorkspaceCommandContribution implements CommandContribution { const toRemove = uris.filter(uri => roots.has(uri.toString())); if (toRemove.length > 0) { const messageContainer = document.createElement('div'); - messageContainer.textContent = `Are you sure you want to remove the following folder${toRemove.length > 1 ? 's' : ''} from the workspace?`; - messageContainer.title = 'Note: Nothing will be erased from disk'; + messageContainer.textContent = nls.localize(`theia/workspace/removeFolder${toRemove.length > 1 ? 's' : ''}`, + `Are you sure you want to remove the following folder${toRemove.length > 1 ? 's' : ''} from the workspace?`); + messageContainer.title = nls.localize('theia/workspace/noErasure', 'Note: Nothing will be erased from disk'); const list = document.createElement('div'); list.classList.add('theia-dialog-node'); toRemove.forEach(uri => { @@ -508,7 +514,7 @@ export class WorkspaceCommandContribution implements CommandContribution { }); messageContainer.appendChild(list); const dialog = new ConfirmDialog({ - title: 'Remove Folder from Workspace', + title: nls.localize('vscode/fileCommands/removeFolderFromWorkspace', 'Remove Folder from Workspace'), msg: messageContainer }); if (await dialog.open()) { diff --git a/packages/workspace/src/browser/workspace-frontend-contribution.ts b/packages/workspace/src/browser/workspace-frontend-contribution.ts index 5df9965664cdc..043e3a620f622 100644 --- a/packages/workspace/src/browser/workspace-frontend-contribution.ts +++ b/packages/workspace/src/browser/workspace-frontend-contribution.ts @@ -34,6 +34,7 @@ import { EncodingRegistry } from '@theia/core/lib/browser/encoding-registry'; import { UTF8 } from '@theia/core/lib/common/encodings'; import { DisposableCollection } from '@theia/core/lib/common/disposable'; import { PreferenceConfigurations } from '@theia/core/lib/browser/preferences/preference-configurations'; +import { nls } from '@theia/core/lib/common/nls'; export enum WorkspaceStates { /** @@ -159,7 +160,7 @@ export class WorkspaceFrontendContribution implements CommandContribution, Keybi if (this.canBeSavedAs(currentWidget)) { this.saveAs(currentWidget); } else { - this.messageService.error(`Cannot run "${WorkspaceCommands.SAVE_AS.label}" for the current widget.`); + this.messageService.error(nls.localize('theia/workspace/failSaveAs', 'Cannot run "{0}" for the current widget.', WorkspaceCommands.SAVE_AS.label!)); } }, }); @@ -378,7 +379,7 @@ export class WorkspaceFrontendContribution implements CommandContribution, Keybi protected async closeWorkspace(): Promise { const dialog = new ConfirmDialog({ title: WorkspaceCommands.CLOSE.label!, - msg: 'Do you really want to close the workspace?' + msg: nls.localize('theia/workspace/closeWorkspace', 'Do you really want to close the workspace?') }); if (await dialog.open()) { await this.workspaceService.close(); @@ -479,7 +480,7 @@ export class WorkspaceFrontendContribution implements CommandContribution, Keybi // At this point `targetWidget` should be `applicationShell.currentWidget` for the save command to pick up: await this.commandRegistry.executeCommand(CommonCommands.SAVE.id); } else { - this.messageService.error('Could not apply changes to new file'); + this.messageService.error(nls.localize('theia/workspace/failApply', 'Could not apply changes to new file')); } } @@ -497,8 +498,8 @@ export class WorkspaceFrontendContribution implements CommandContribution, Keybi } // Prompt users for confirmation before overwriting. const confirmed = await new ConfirmDialog({ - title: 'Overwrite', - msg: `Do you really want to overwrite "${uri.toString()}"?` + title: nls.localize('vscode/textFileSaveErrorHandler/overwrite', 'Overwrite'), + msg: nls.localize('vscode/simpleFileDialog/remoteFileDialog.validateExisting', 'Do you really want to overwrite "{0}"?', uri.toString()) }).open(); return !!confirmed; } diff --git a/packages/workspace/src/browser/workspace-preferences.ts b/packages/workspace/src/browser/workspace-preferences.ts index 23f3ce0fa2973..87ad853707224 100644 --- a/packages/workspace/src/browser/workspace-preferences.ts +++ b/packages/workspace/src/browser/workspace-preferences.ts @@ -22,17 +22,18 @@ import { PreferenceSchema, PreferenceContribution } from '@theia/core/lib/browser/preferences'; +import { nls } from '@theia/core/lib/common/nls'; export const workspacePreferenceSchema: PreferenceSchema = { type: 'object', properties: { 'workspace.preserveWindow': { - description: 'Enable opening workspaces in current window.', + description: nls.localize('theia/workspace/preserveWindow', 'Enable opening workspaces in current window.'), type: 'boolean', default: false }, 'workspace.supportMultiRootWorkspace': { - description: 'Controls whether multi-root workspace support is enabled.', + description: nls.localize('theia/workspace/supportMultiRootWorkspace', 'Controls whether multi-root workspace support is enabled.'), type: 'boolean', default: true }