Move standalone editor nls calls to standaloneStrings which will be translated via VS Code
This commit is contained in:
parent
1c21692315
commit
78d62636f0
55
build/lib/tslint/noNlsInStandaloneEditorRule.js
Normal file
55
build/lib/tslint/noNlsInStandaloneEditorRule.js
Normal file
|
@ -0,0 +1,55 @@
|
|||
"use strict";
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const ts = require("typescript");
|
||||
const Lint = require("tslint");
|
||||
const path_1 = require("path");
|
||||
class Rule extends Lint.Rules.AbstractRule {
|
||||
apply(sourceFile) {
|
||||
console.log(sourceFile.fileName);
|
||||
if (/vs(\/|\\)editor(\/|\\)standalone(\/|\\)/.test(sourceFile.fileName)
|
||||
|| /vs(\/|\\)editor(\/|\\)common(\/|\\)standalone(\/|\\)/.test(sourceFile.fileName)
|
||||
|| /vs(\/|\\)editor(\/|\\)editor.api/.test(sourceFile.fileName)
|
||||
|| /vs(\/|\\)editor(\/|\\)editor.main/.test(sourceFile.fileName)
|
||||
|| /vs(\/|\\)editor(\/|\\)editor.worker/.test(sourceFile.fileName)) {
|
||||
return this.applyWithWalker(new NoNlsInStandaloneEditorRuleWalker(sourceFile, this.getOptions()));
|
||||
}
|
||||
return [];
|
||||
}
|
||||
}
|
||||
exports.Rule = Rule;
|
||||
class NoNlsInStandaloneEditorRuleWalker extends Lint.RuleWalker {
|
||||
constructor(file, opts) {
|
||||
super(file, opts);
|
||||
}
|
||||
visitImportEqualsDeclaration(node) {
|
||||
if (node.moduleReference.kind === ts.SyntaxKind.ExternalModuleReference) {
|
||||
this._validateImport(node.moduleReference.expression.getText(), node);
|
||||
}
|
||||
}
|
||||
visitImportDeclaration(node) {
|
||||
this._validateImport(node.moduleSpecifier.getText(), node);
|
||||
}
|
||||
visitCallExpression(node) {
|
||||
super.visitCallExpression(node);
|
||||
// import('foo') statements inside the code
|
||||
if (node.expression.kind === ts.SyntaxKind.ImportKeyword) {
|
||||
const [path] = node.arguments;
|
||||
this._validateImport(path.getText(), node);
|
||||
}
|
||||
}
|
||||
_validateImport(path, node) {
|
||||
// remove quotes
|
||||
path = path.slice(1, -1);
|
||||
// resolve relative paths
|
||||
if (path[0] === '.') {
|
||||
path = path_1.join(this.getSourceFile().fileName, path);
|
||||
}
|
||||
if (/vs(\/|\\)nls/.test(path)) {
|
||||
this.addFailure(this.createFailure(node.getStart(), node.getWidth(), `Not allowed to import vs/nls in standalone editor modules. Use standaloneStrings.ts`));
|
||||
}
|
||||
}
|
||||
}
|
68
build/lib/tslint/noNlsInStandaloneEditorRule.ts
Normal file
68
build/lib/tslint/noNlsInStandaloneEditorRule.ts
Normal file
|
@ -0,0 +1,68 @@
|
|||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as ts from 'typescript';
|
||||
import * as Lint from 'tslint';
|
||||
import { join } from 'path';
|
||||
|
||||
export class Rule extends Lint.Rules.AbstractRule {
|
||||
public apply(sourceFile: ts.SourceFile): Lint.RuleFailure[] {
|
||||
console.log(sourceFile.fileName);
|
||||
if (
|
||||
/vs(\/|\\)editor(\/|\\)standalone(\/|\\)/.test(sourceFile.fileName)
|
||||
|| /vs(\/|\\)editor(\/|\\)common(\/|\\)standalone(\/|\\)/.test(sourceFile.fileName)
|
||||
|| /vs(\/|\\)editor(\/|\\)editor.api/.test(sourceFile.fileName)
|
||||
|| /vs(\/|\\)editor(\/|\\)editor.main/.test(sourceFile.fileName)
|
||||
|| /vs(\/|\\)editor(\/|\\)editor.worker/.test(sourceFile.fileName)
|
||||
) {
|
||||
return this.applyWithWalker(new NoNlsInStandaloneEditorRuleWalker(sourceFile, this.getOptions()));
|
||||
}
|
||||
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
class NoNlsInStandaloneEditorRuleWalker extends Lint.RuleWalker {
|
||||
|
||||
constructor(file: ts.SourceFile, opts: Lint.IOptions) {
|
||||
super(file, opts);
|
||||
}
|
||||
|
||||
protected visitImportEqualsDeclaration(node: ts.ImportEqualsDeclaration): void {
|
||||
if (node.moduleReference.kind === ts.SyntaxKind.ExternalModuleReference) {
|
||||
this._validateImport(node.moduleReference.expression.getText(), node);
|
||||
}
|
||||
}
|
||||
|
||||
protected visitImportDeclaration(node: ts.ImportDeclaration): void {
|
||||
this._validateImport(node.moduleSpecifier.getText(), node);
|
||||
}
|
||||
|
||||
protected visitCallExpression(node: ts.CallExpression): void {
|
||||
super.visitCallExpression(node);
|
||||
|
||||
// import('foo') statements inside the code
|
||||
if (node.expression.kind === ts.SyntaxKind.ImportKeyword) {
|
||||
const [path] = node.arguments;
|
||||
this._validateImport(path.getText(), node);
|
||||
}
|
||||
}
|
||||
|
||||
private _validateImport(path: string, node: ts.Node): void {
|
||||
// remove quotes
|
||||
path = path.slice(1, -1);
|
||||
|
||||
// resolve relative paths
|
||||
if (path[0] === '.') {
|
||||
path = join(this.getSourceFile().fileName, path);
|
||||
}
|
||||
|
||||
if (
|
||||
/vs(\/|\\)nls/.test(path)
|
||||
) {
|
||||
this.addFailure(this.createFailure(node.getStart(), node.getWidth(), `Not allowed to import vs/nls in standalone editor modules. Use standaloneStrings.ts`));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -44,8 +44,8 @@ class NoStandaloneEditorRuleWalker extends Lint.RuleWalker {
|
|||
if (path[0] === '.') {
|
||||
path = path_1.join(this.getSourceFile().fileName, path);
|
||||
}
|
||||
if (/vs(\/|\\)editor(\/|\\)standalone/.test(path)
|
||||
|| /vs(\/|\\)editor(\/|\\)common(\/|\\)standalone/.test(path)
|
||||
if (/vs(\/|\\)editor(\/|\\)standalone(\/|\\)/.test(path)
|
||||
|| /vs(\/|\\)editor(\/|\\)common(\/|\\)standalone(\/|\\)/.test(path)
|
||||
|| /vs(\/|\\)editor(\/|\\)editor.api/.test(path)
|
||||
|| /vs(\/|\\)editor(\/|\\)editor.main/.test(path)
|
||||
|| /vs(\/|\\)editor(\/|\\)editor.worker/.test(path)) {
|
||||
|
|
|
@ -53,8 +53,8 @@ class NoStandaloneEditorRuleWalker extends Lint.RuleWalker {
|
|||
}
|
||||
|
||||
if (
|
||||
/vs(\/|\\)editor(\/|\\)standalone/.test(path)
|
||||
|| /vs(\/|\\)editor(\/|\\)common(\/|\\)standalone/.test(path)
|
||||
/vs(\/|\\)editor(\/|\\)standalone(\/|\\)/.test(path)
|
||||
|| /vs(\/|\\)editor(\/|\\)common(\/|\\)standalone(\/|\\)/.test(path)
|
||||
|| /vs(\/|\\)editor(\/|\\)editor.api/.test(path)
|
||||
|| /vs(\/|\\)editor(\/|\\)editor.main/.test(path)
|
||||
|| /vs(\/|\\)editor(\/|\\)editor.worker/.test(path)
|
||||
|
|
84
src/vs/editor/common/standaloneStrings.ts
Normal file
84
src/vs/editor/common/standaloneStrings.ts
Normal file
|
@ -0,0 +1,84 @@
|
|||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as nls from 'vs/nls';
|
||||
|
||||
export namespace AccessibilityHelpNLS {
|
||||
export const noSelection = nls.localize("noSelection", "No selection");
|
||||
export const singleSelectionRange = nls.localize("singleSelectionRange", "Line {0}, Column {1} ({2} selected)");
|
||||
export const singleSelection = nls.localize("singleSelection", "Line {0}, Column {1}");
|
||||
export const multiSelectionRange = nls.localize("multiSelectionRange", "{0} selections ({1} characters selected)");
|
||||
export const multiSelection = nls.localize("multiSelection", "{0} selections");
|
||||
export const emergencyConfOn = nls.localize("emergencyConfOn", "Now changing the setting `accessibilitySupport` to 'on'.");
|
||||
export const openingDocs = nls.localize("openingDocs", "Now opening the Editor Accessibility documentation page.");
|
||||
export const readonlyDiffEditor = nls.localize("readonlyDiffEditor", " in a read-only pane of a diff editor.");
|
||||
export const editableDiffEditor = nls.localize("editableDiffEditor", " in a pane of a diff editor.");
|
||||
export const readonlyEditor = nls.localize("readonlyEditor", " in a read-only code editor");
|
||||
export const editableEditor = nls.localize("editableEditor", " in a code editor");
|
||||
export const changeConfigToOnMac = nls.localize("changeConfigToOnMac", "To configure the editor to be optimized for usage with a Screen Reader press Command+E now.");
|
||||
export const changeConfigToOnWinLinux = nls.localize("changeConfigToOnWinLinux", "To configure the editor to be optimized for usage with a Screen Reader press Control+E now.");
|
||||
export const auto_on = nls.localize("auto_on", "The editor is configured to be optimized for usage with a Screen Reader.");
|
||||
export const auto_off = nls.localize("auto_off", "The editor is configured to never be optimized for usage with a Screen Reader, which is not the case at this time.");
|
||||
export const tabFocusModeOnMsg = nls.localize("tabFocusModeOnMsg", "Pressing Tab in the current editor will move focus to the next focusable element. Toggle this behavior by pressing {0}.");
|
||||
export const tabFocusModeOnMsgNoKb = nls.localize("tabFocusModeOnMsgNoKb", "Pressing Tab in the current editor will move focus to the next focusable element. The command {0} is currently not triggerable by a keybinding.");
|
||||
export const tabFocusModeOffMsg = nls.localize("tabFocusModeOffMsg", "Pressing Tab in the current editor will insert the tab character. Toggle this behavior by pressing {0}.");
|
||||
export const tabFocusModeOffMsgNoKb = nls.localize("tabFocusModeOffMsgNoKb", "Pressing Tab in the current editor will insert the tab character. The command {0} is currently not triggerable by a keybinding.");
|
||||
export const openDocMac = nls.localize("openDocMac", "Press Command+H now to open a browser window with more information related to editor accessibility.");
|
||||
export const openDocWinLinux = nls.localize("openDocWinLinux", "Press Control+H now to open a browser window with more information related to editor accessibility.");
|
||||
export const outroMsg = nls.localize("outroMsg", "You can dismiss this tooltip and return to the editor by pressing Escape or Shift+Escape.");
|
||||
export const showAccessibilityHelpAction = nls.localize("showAccessibilityHelpAction", "Show Accessibility Help");
|
||||
}
|
||||
|
||||
export namespace InspectTokensNLS {
|
||||
export const inspectTokensAction = nls.localize('inspectTokens', "Developer: Inspect Tokens");
|
||||
}
|
||||
|
||||
export namespace GoToLineNLS {
|
||||
export const gotoLineLabelValidLineAndColumn = nls.localize('gotoLineLabelValidLineAndColumn', "Go to line {0} and character {1}");
|
||||
export const gotoLineLabelValidLine = nls.localize('gotoLineLabelValidLine', "Go to line {0}");
|
||||
export const gotoLineLabelEmptyWithLineLimit = nls.localize('gotoLineLabelEmptyWithLineLimit', "Type a line number between 1 and {0} to navigate to");
|
||||
export const gotoLineLabelEmptyWithLineAndColumnLimit = nls.localize('gotoLineLabelEmptyWithLineAndColumnLimit', "Type a character between 1 and {0} to navigate to");
|
||||
export const gotoLineAriaLabel = nls.localize('gotoLineAriaLabel', "Current Line: {0}. Go to line {1}.");
|
||||
export const gotoLineActionInput = nls.localize('gotoLineActionInput', "Type a line number, followed by an optional colon and a character number to navigate to");
|
||||
export const gotoLineActionLabel = nls.localize('gotoLineActionLabel', "Go to Line...");
|
||||
}
|
||||
|
||||
export namespace QuickCommandNLS {
|
||||
export const ariaLabelEntryWithKey = nls.localize('ariaLabelEntryWithKey', "{0}, {1}, commands");
|
||||
export const ariaLabelEntry = nls.localize('ariaLabelEntry', "{0}, commands");
|
||||
export const quickCommandActionInput = nls.localize('quickCommandActionInput', "Type the name of an action you want to execute");
|
||||
export const quickCommandActionLabel = nls.localize('quickCommandActionLabel', "Command Palette");
|
||||
}
|
||||
|
||||
export namespace QuickOutlineNLS {
|
||||
export const entryAriaLabel = nls.localize('entryAriaLabel', "{0}, symbols");
|
||||
export const quickOutlineActionInput = nls.localize('quickOutlineActionInput', "Type the name of an identifier you wish to navigate to");
|
||||
export const quickOutlineActionLabel = nls.localize('quickOutlineActionLabel', "Go to Symbol...");
|
||||
export const _symbols_ = nls.localize('symbols', "symbols ({0})");
|
||||
export const _modules_ = nls.localize('modules', "modules ({0})");
|
||||
export const _class_ = nls.localize('class', "classes ({0})");
|
||||
export const _interface_ = nls.localize('interface', "interfaces ({0})");
|
||||
export const _method_ = nls.localize('method', "methods ({0})");
|
||||
export const _function_ = nls.localize('function', "functions ({0})");
|
||||
export const _property_ = nls.localize('property', "properties ({0})");
|
||||
export const _variable_ = nls.localize('variable', "variables ({0})");
|
||||
export const _variable2_ = nls.localize('variable2', "variables ({0})");
|
||||
export const _constructor_ = nls.localize('_constructor', "constructors ({0})");
|
||||
export const _call_ = nls.localize('call', "calls ({0})");
|
||||
}
|
||||
|
||||
export namespace StandaloneCodeEditorNLS {
|
||||
export const editorViewAccessibleLabel = nls.localize('editorViewAccessibleLabel', "Editor content");
|
||||
export const accessibilityHelpMessageIE = nls.localize('accessibilityHelpMessageIE', "Press Ctrl+F1 for Accessibility Options.");
|
||||
export const accessibilityHelpMessage = nls.localize('accessibilityHelpMessage', "Press Alt+F1 for Accessibility Options.");
|
||||
}
|
||||
|
||||
export namespace ToggleHighContrastNLS {
|
||||
export const toggleHighContrast = nls.localize('toggleHighContrast', "Toggle High Contrast Theme");
|
||||
}
|
||||
|
||||
export namespace SimpleServicesNLS {
|
||||
export const bulkEditServiceSummary = nls.localize('bulkEditServiceSummary', "Made {0} edits in {1} files");
|
||||
}
|
|
@ -41,3 +41,7 @@ import 'vs/editor/contrib/toggleTabFocusMode/toggleTabFocusMode';
|
|||
import 'vs/editor/contrib/wordHighlighter/wordHighlighter';
|
||||
import 'vs/editor/contrib/wordOperations/wordOperations';
|
||||
import 'vs/editor/contrib/wordPartOperations/wordPartOperations';
|
||||
|
||||
// Load up these strings even in VSCode, even if they are not used
|
||||
// in order to get them translated
|
||||
import 'vs/editor/common/standaloneStrings';
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import 'vs/css!./accessibilityHelp';
|
||||
import * as nls from 'vs/nls';
|
||||
import * as browser from 'vs/base/browser/browser';
|
||||
import * as dom from 'vs/base/browser/dom';
|
||||
import { FastDomNode, createFastDomNode } from 'vs/base/browser/fastDomNode';
|
||||
|
@ -31,6 +30,7 @@ import { IOpenerService } from 'vs/platform/opener/common/opener';
|
|||
import { contrastBorder, editorWidgetBackground, widgetShadow } from 'vs/platform/theme/common/colorRegistry';
|
||||
import { registerThemingParticipant } from 'vs/platform/theme/common/themeService';
|
||||
import { AccessibilitySupport } from 'vs/platform/accessibility/common/accessibility';
|
||||
import { AccessibilityHelpNLS } from 'vs/editor/common/standaloneStrings';
|
||||
|
||||
const CONTEXT_ACCESSIBILITY_WIDGET_VISIBLE = new RawContextKey<boolean>('accessibilityHelpWidgetVisible', false);
|
||||
|
||||
|
@ -72,31 +72,26 @@ class AccessibilityHelpController extends Disposable
|
|||
}
|
||||
}
|
||||
|
||||
const nlsNoSelection = nls.localize("noSelection", "No selection");
|
||||
const nlsSingleSelectionRange = nls.localize("singleSelectionRange", "Line {0}, Column {1} ({2} selected)");
|
||||
const nlsSingleSelection = nls.localize("singleSelection", "Line {0}, Column {1}");
|
||||
const nlsMultiSelectionRange = nls.localize("multiSelectionRange", "{0} selections ({1} characters selected)");
|
||||
const nlsMultiSelection = nls.localize("multiSelection", "{0} selections");
|
||||
|
||||
function getSelectionLabel(selections: Selection[] | null, charactersSelected: number): string {
|
||||
if (!selections || selections.length === 0) {
|
||||
return nlsNoSelection;
|
||||
return AccessibilityHelpNLS.noSelection;
|
||||
}
|
||||
|
||||
if (selections.length === 1) {
|
||||
if (charactersSelected) {
|
||||
return strings.format(nlsSingleSelectionRange, selections[0].positionLineNumber, selections[0].positionColumn, charactersSelected);
|
||||
return strings.format(AccessibilityHelpNLS.singleSelectionRange, selections[0].positionLineNumber, selections[0].positionColumn, charactersSelected);
|
||||
}
|
||||
|
||||
return strings.format(nlsSingleSelection, selections[0].positionLineNumber, selections[0].positionColumn);
|
||||
return strings.format(AccessibilityHelpNLS.singleSelection, selections[0].positionLineNumber, selections[0].positionColumn);
|
||||
}
|
||||
|
||||
if (charactersSelected) {
|
||||
return strings.format(nlsMultiSelectionRange, selections.length, charactersSelected);
|
||||
return strings.format(AccessibilityHelpNLS.multiSelectionRange, selections.length, charactersSelected);
|
||||
}
|
||||
|
||||
if (selections.length > 0) {
|
||||
return strings.format(nlsMultiSelection, selections.length);
|
||||
return strings.format(AccessibilityHelpNLS.multiSelection, selections.length);
|
||||
}
|
||||
|
||||
return '';
|
||||
|
@ -151,7 +146,7 @@ class AccessibilityHelpWidget extends Widget implements IOverlayWidget {
|
|||
}
|
||||
|
||||
if (e.equals(KeyMod.CtrlCmd | KeyCode.KEY_E)) {
|
||||
alert(nls.localize("emergencyConfOn", "Now changing the setting `accessibilitySupport` to 'on'."));
|
||||
alert(AccessibilityHelpNLS.emergencyConfOn);
|
||||
|
||||
this._editor.updateOptions({
|
||||
accessibilitySupport: 'on'
|
||||
|
@ -166,7 +161,7 @@ class AccessibilityHelpWidget extends Widget implements IOverlayWidget {
|
|||
}
|
||||
|
||||
if (e.equals(KeyMod.CtrlCmd | KeyCode.KEY_H)) {
|
||||
alert(nls.localize("openingDocs", "Now opening the Editor Accessibility documentation page."));
|
||||
alert(AccessibilityHelpNLS.openingDocs);
|
||||
|
||||
let url = (<IEditorConstructionOptions>this._editor.getRawConfiguration()).accessibilityHelpUrl;
|
||||
if (typeof url === 'undefined') {
|
||||
|
@ -246,56 +241,52 @@ class AccessibilityHelpWidget extends Widget implements IOverlayWidget {
|
|||
|
||||
if (opts.wrappingInfo.inDiffEditor) {
|
||||
if (opts.readOnly) {
|
||||
text += nls.localize("readonlyDiffEditor", " in a read-only pane of a diff editor.");
|
||||
text += AccessibilityHelpNLS.readonlyDiffEditor;
|
||||
} else {
|
||||
text += nls.localize("editableDiffEditor", " in a pane of a diff editor.");
|
||||
text += AccessibilityHelpNLS.editableDiffEditor;
|
||||
}
|
||||
} else {
|
||||
if (opts.readOnly) {
|
||||
text += nls.localize("readonlyEditor", " in a read-only code editor");
|
||||
text += AccessibilityHelpNLS.readonlyEditor;
|
||||
} else {
|
||||
text += nls.localize("editableEditor", " in a code editor");
|
||||
text += AccessibilityHelpNLS.editableEditor;
|
||||
}
|
||||
}
|
||||
|
||||
const turnOnMessage = (
|
||||
platform.isMacintosh
|
||||
? nls.localize("changeConfigToOnMac", "To configure the editor to be optimized for usage with a Screen Reader press Command+E now.")
|
||||
: nls.localize("changeConfigToOnWinLinux", "To configure the editor to be optimized for usage with a Screen Reader press Control+E now.")
|
||||
? AccessibilityHelpNLS.changeConfigToOnMac
|
||||
: AccessibilityHelpNLS.changeConfigToOnWinLinux
|
||||
);
|
||||
switch (opts.accessibilitySupport) {
|
||||
case AccessibilitySupport.Unknown:
|
||||
text += '\n\n - ' + turnOnMessage;
|
||||
break;
|
||||
case AccessibilitySupport.Enabled:
|
||||
text += '\n\n - ' + nls.localize("auto_on", "The editor is configured to be optimized for usage with a Screen Reader.");
|
||||
text += '\n\n - ' + AccessibilityHelpNLS.auto_on;
|
||||
break;
|
||||
case AccessibilitySupport.Disabled:
|
||||
text += '\n\n - ' + nls.localize("auto_off", "The editor is configured to never be optimized for usage with a Screen Reader, which is not the case at this time.");
|
||||
text += '\n\n - ' + AccessibilityHelpNLS.auto_off;
|
||||
text += ' ' + turnOnMessage;
|
||||
break;
|
||||
}
|
||||
|
||||
const NLS_TAB_FOCUS_MODE_ON = nls.localize("tabFocusModeOnMsg", "Pressing Tab in the current editor will move focus to the next focusable element. Toggle this behavior by pressing {0}.");
|
||||
const NLS_TAB_FOCUS_MODE_ON_NO_KB = nls.localize("tabFocusModeOnMsgNoKb", "Pressing Tab in the current editor will move focus to the next focusable element. The command {0} is currently not triggerable by a keybinding.");
|
||||
const NLS_TAB_FOCUS_MODE_OFF = nls.localize("tabFocusModeOffMsg", "Pressing Tab in the current editor will insert the tab character. Toggle this behavior by pressing {0}.");
|
||||
const NLS_TAB_FOCUS_MODE_OFF_NO_KB = nls.localize("tabFocusModeOffMsgNoKb", "Pressing Tab in the current editor will insert the tab character. The command {0} is currently not triggerable by a keybinding.");
|
||||
|
||||
if (opts.tabFocusMode) {
|
||||
text += '\n\n - ' + this._descriptionForCommand(ToggleTabFocusModeAction.ID, NLS_TAB_FOCUS_MODE_ON, NLS_TAB_FOCUS_MODE_ON_NO_KB);
|
||||
text += '\n\n - ' + this._descriptionForCommand(ToggleTabFocusModeAction.ID, AccessibilityHelpNLS.tabFocusModeOnMsg, AccessibilityHelpNLS.tabFocusModeOnMsgNoKb);
|
||||
} else {
|
||||
text += '\n\n - ' + this._descriptionForCommand(ToggleTabFocusModeAction.ID, NLS_TAB_FOCUS_MODE_OFF, NLS_TAB_FOCUS_MODE_OFF_NO_KB);
|
||||
text += '\n\n - ' + this._descriptionForCommand(ToggleTabFocusModeAction.ID, AccessibilityHelpNLS.tabFocusModeOffMsg, AccessibilityHelpNLS.tabFocusModeOffMsgNoKb);
|
||||
}
|
||||
|
||||
const openDocMessage = (
|
||||
platform.isMacintosh
|
||||
? nls.localize("openDocMac", "Press Command+H now to open a browser window with more information related to editor accessibility.")
|
||||
: nls.localize("openDocWinLinux", "Press Control+H now to open a browser window with more information related to editor accessibility.")
|
||||
? AccessibilityHelpNLS.openDocMac
|
||||
: AccessibilityHelpNLS.openDocWinLinux
|
||||
);
|
||||
|
||||
text += '\n\n - ' + openDocMessage;
|
||||
|
||||
text += '\n\n' + nls.localize("outroMsg", "You can dismiss this tooltip and return to the editor by pressing Escape or Shift+Escape.");
|
||||
text += '\n\n' + AccessibilityHelpNLS.outroMsg;
|
||||
|
||||
this._contentDomNode.domNode.appendChild(renderFormattedText(text));
|
||||
// Per https://www.w3.org/TR/wai-aria/roles#document, Authors SHOULD provide a title or label for documents
|
||||
|
@ -337,7 +328,7 @@ class ShowAccessibilityHelpAction extends EditorAction {
|
|||
constructor() {
|
||||
super({
|
||||
id: 'editor.action.showAccessibilityHelp',
|
||||
label: nls.localize("ShowAccessibilityHelpAction", "Show Accessibility Help"),
|
||||
label: AccessibilityHelpNLS.showAccessibilityHelpAction,
|
||||
alias: 'Show Accessibility Help',
|
||||
precondition: null,
|
||||
kbOpts: {
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import 'vs/css!./inspectTokens';
|
||||
import * as nls from 'vs/nls';
|
||||
import { CharCode } from 'vs/base/common/charCode';
|
||||
import { Color } from 'vs/base/common/color';
|
||||
import { Disposable } from 'vs/base/common/lifecycle';
|
||||
|
@ -21,6 +20,7 @@ import { IModeService } from 'vs/editor/common/services/modeService';
|
|||
import { IStandaloneThemeService } from 'vs/editor/standalone/common/standaloneThemeService';
|
||||
import { editorHoverBackground, editorHoverBorder } from 'vs/platform/theme/common/colorRegistry';
|
||||
import { HIGH_CONTRAST, registerThemingParticipant } from 'vs/platform/theme/common/themeService';
|
||||
import { InspectTokensNLS } from 'vs/editor/common/standaloneStrings';
|
||||
|
||||
|
||||
class InspectTokensController extends Disposable implements IEditorContribution {
|
||||
|
@ -82,7 +82,7 @@ class InspectTokens extends EditorAction {
|
|||
constructor() {
|
||||
super({
|
||||
id: 'editor.action.inspectTokens',
|
||||
label: nls.localize('inspectTokens', "Developer: Inspect Tokens"),
|
||||
label: InspectTokensNLS.inspectTokensAction,
|
||||
alias: 'Developer: Inspect Tokens',
|
||||
precondition: null
|
||||
});
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import 'vs/css!./gotoLine';
|
||||
import * as nls from 'vs/nls';
|
||||
import * as strings from 'vs/base/common/strings';
|
||||
import { KeyCode, KeyMod } from 'vs/base/common/keyCodes';
|
||||
import { QuickOpenEntry, QuickOpenModel } from 'vs/base/parts/quickopen/browser/quickOpenModel';
|
||||
import { IAutoFocus, Mode, IEntryRunContext } from 'vs/base/parts/quickopen/common/quickOpen';
|
||||
|
@ -17,6 +17,7 @@ import { EditorContextKeys } from 'vs/editor/common/editorContextKeys';
|
|||
import { ITextModel } from 'vs/editor/common/model';
|
||||
import { BaseEditorQuickOpenAction, IDecorator } from 'vs/editor/standalone/browser/quickOpen/editorQuickOpen';
|
||||
import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry';
|
||||
import { GoToLineNLS } from 'vs/editor/common/standaloneStrings';
|
||||
|
||||
interface ParseResult {
|
||||
position: Position;
|
||||
|
@ -62,14 +63,14 @@ export class GotoLineEntry extends QuickOpenEntry {
|
|||
|
||||
if (isValid) {
|
||||
if (position.column && position.column > 1) {
|
||||
label = nls.localize('gotoLineLabelValidLineAndColumn', "Go to line {0} and character {1}", position.lineNumber, position.column);
|
||||
label = strings.format(GoToLineNLS.gotoLineLabelValidLineAndColumn, position.lineNumber, position.column);
|
||||
} else {
|
||||
label = nls.localize('gotoLineLabelValidLine', "Go to line {0}", position.lineNumber, position.column);
|
||||
label = strings.format(GoToLineNLS.gotoLineLabelValidLine, position.lineNumber);
|
||||
}
|
||||
} else if (position.lineNumber < 1 || position.lineNumber > (model ? model.getLineCount() : 0)) {
|
||||
label = nls.localize('gotoLineLabelEmptyWithLineLimit', "Type a line number between 1 and {0} to navigate to", model ? model.getLineCount() : 0);
|
||||
label = strings.format(GoToLineNLS.gotoLineLabelEmptyWithLineLimit, model ? model.getLineCount() : 0);
|
||||
} else {
|
||||
label = nls.localize('gotoLineLabelEmptyWithLineAndColumnLimit', "Type a character between 1 and {0} to navigate to", model ? model.getLineMaxColumn(position.lineNumber) : 0);
|
||||
label = strings.format(GoToLineNLS.gotoLineLabelEmptyWithLineAndColumnLimit, model ? model.getLineMaxColumn(position.lineNumber) : 0);
|
||||
}
|
||||
|
||||
return {
|
||||
|
@ -86,7 +87,7 @@ export class GotoLineEntry extends QuickOpenEntry {
|
|||
getAriaLabel(): string {
|
||||
const position = this.editor.getPosition();
|
||||
const currentLine = position ? position.lineNumber : 0;
|
||||
return nls.localize('gotoLineAriaLabel', "Current Line: {0}. Go to line {0}.", currentLine, this.parseResult.label);
|
||||
return strings.format(GoToLineNLS.gotoLineAriaLabel, currentLine, this.parseResult.label);
|
||||
}
|
||||
|
||||
run(mode: Mode, _context: IEntryRunContext): boolean {
|
||||
|
@ -144,9 +145,9 @@ export class GotoLineEntry extends QuickOpenEntry {
|
|||
export class GotoLineAction extends BaseEditorQuickOpenAction {
|
||||
|
||||
constructor() {
|
||||
super(nls.localize('gotoLineActionInput', "Type a line number, followed by an optional colon and a character number to navigate to"), {
|
||||
super(GoToLineNLS.gotoLineActionInput, {
|
||||
id: 'editor.action.gotoLine',
|
||||
label: nls.localize('GotoLineAction.label', "Go to Line..."),
|
||||
label: GoToLineNLS.gotoLineActionLabel,
|
||||
alias: 'Go to Line...',
|
||||
precondition: null,
|
||||
kbOpts: {
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as nls from 'vs/nls';
|
||||
import * as strings from 'vs/base/common/strings';
|
||||
import * as browser from 'vs/base/browser/browser';
|
||||
import { onUnexpectedError } from 'vs/base/common/errors';
|
||||
import { matchesFuzzy } from 'vs/base/common/filters';
|
||||
|
@ -17,6 +17,7 @@ import { EditorContextKeys } from 'vs/editor/common/editorContextKeys';
|
|||
import { BaseEditorQuickOpenAction } from 'vs/editor/standalone/browser/quickOpen/editorQuickOpen';
|
||||
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
|
||||
import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry';
|
||||
import { QuickCommandNLS } from 'vs/editor/common/standaloneStrings';
|
||||
|
||||
export class EditorActionCommandEntry extends QuickOpenEntryGroup {
|
||||
private readonly key: string;
|
||||
|
@ -40,10 +41,10 @@ export class EditorActionCommandEntry extends QuickOpenEntryGroup {
|
|||
|
||||
public getAriaLabel(): string {
|
||||
if (this.keyAriaLabel) {
|
||||
return nls.localize('ariaLabelEntryWithKey', "{0}, {1}, commands", this.getLabel(), this.keyAriaLabel);
|
||||
return strings.format(QuickCommandNLS.ariaLabelEntryWithKey, this.getLabel(), this.keyAriaLabel);
|
||||
}
|
||||
|
||||
return nls.localize('ariaLabelEntry', "{0}, commands", this.getLabel());
|
||||
return strings.format(QuickCommandNLS.ariaLabelEntry, this.getLabel());
|
||||
}
|
||||
|
||||
public getGroupLabel(): string {
|
||||
|
@ -77,9 +78,9 @@ export class EditorActionCommandEntry extends QuickOpenEntryGroup {
|
|||
export class QuickCommandAction extends BaseEditorQuickOpenAction {
|
||||
|
||||
constructor() {
|
||||
super(nls.localize('quickCommandActionInput', "Type the name of an action you want to execute"), {
|
||||
super(QuickCommandNLS.quickCommandActionInput, {
|
||||
id: 'editor.action.quickCommand',
|
||||
label: nls.localize('QuickCommandAction.label', "Command Palette"),
|
||||
label: QuickCommandNLS.quickCommandActionLabel,
|
||||
alias: 'Command Palette',
|
||||
precondition: null,
|
||||
kbOpts: {
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import 'vs/css!./quickOutline';
|
||||
import * as nls from 'vs/nls';
|
||||
import { CancellationToken } from 'vs/base/common/cancellation';
|
||||
import { matchesFuzzy } from 'vs/base/common/filters';
|
||||
import { KeyCode, KeyMod } from 'vs/base/common/keyCodes';
|
||||
|
@ -20,6 +19,7 @@ import { DocumentSymbol, DocumentSymbolProviderRegistry, symbolKindToCssClass }
|
|||
import { getDocumentSymbols } from 'vs/editor/contrib/quickOpen/quickOpen';
|
||||
import { BaseEditorQuickOpenAction, IDecorator } from 'vs/editor/standalone/browser/quickOpen/editorQuickOpen';
|
||||
import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry';
|
||||
import { QuickOutlineNLS } from 'vs/editor/common/standaloneStrings';
|
||||
|
||||
let SCOPE_PREFIX = ':';
|
||||
|
||||
|
@ -48,7 +48,7 @@ export class SymbolEntry extends QuickOpenEntryGroup {
|
|||
}
|
||||
|
||||
public getAriaLabel(): string {
|
||||
return nls.localize('entryAriaLabel', "{0}, symbols", this.name);
|
||||
return strings.format(QuickOutlineNLS.entryAriaLabel, this.name);
|
||||
}
|
||||
|
||||
public getIcon(): string {
|
||||
|
@ -111,9 +111,9 @@ export class SymbolEntry extends QuickOpenEntryGroup {
|
|||
export class QuickOutlineAction extends BaseEditorQuickOpenAction {
|
||||
|
||||
constructor() {
|
||||
super(nls.localize('quickOutlineActionInput', "Type the name of an identifier you wish to navigate to"), {
|
||||
super(QuickOutlineNLS.quickOutlineActionInput, {
|
||||
id: 'editor.action.quickOutline',
|
||||
label: nls.localize('QuickOutlineAction.label', "Go to Symbol..."),
|
||||
label: QuickOutlineNLS.quickOutlineActionLabel,
|
||||
alias: 'Go to Symbol...',
|
||||
precondition: EditorContextKeys.hasDocumentSymbolProvider,
|
||||
kbOpts: {
|
||||
|
@ -249,7 +249,7 @@ export class QuickOutlineAction extends BaseEditorQuickOpenAction {
|
|||
|
||||
// Mark first entry as outline
|
||||
else if (results.length > 0) {
|
||||
results[0].setGroupLabel(nls.localize('symbols', "symbols ({0})", results.length));
|
||||
results[0].setGroupLabel(strings.format(QuickOutlineNLS._symbols_, results.length));
|
||||
}
|
||||
|
||||
return results;
|
||||
|
@ -257,16 +257,16 @@ export class QuickOutlineAction extends BaseEditorQuickOpenAction {
|
|||
|
||||
private typeToLabel(type: string, count: number): string {
|
||||
switch (type) {
|
||||
case 'module': return nls.localize('modules', "modules ({0})", count);
|
||||
case 'class': return nls.localize('class', "classes ({0})", count);
|
||||
case 'interface': return nls.localize('interface', "interfaces ({0})", count);
|
||||
case 'method': return nls.localize('method', "methods ({0})", count);
|
||||
case 'function': return nls.localize('function', "functions ({0})", count);
|
||||
case 'property': return nls.localize('property', "properties ({0})", count);
|
||||
case 'variable': return nls.localize('variable', "variables ({0})", count);
|
||||
case 'var': return nls.localize('variable2', "variables ({0})", count);
|
||||
case 'constructor': return nls.localize('_constructor', "constructors ({0})", count);
|
||||
case 'call': return nls.localize('call', "calls ({0})", count);
|
||||
case 'module': return strings.format(QuickOutlineNLS._modules_, count);
|
||||
case 'class': return strings.format(QuickOutlineNLS._class_, count);
|
||||
case 'interface': return strings.format(QuickOutlineNLS._interface_, count);
|
||||
case 'method': return strings.format(QuickOutlineNLS._method_, count);
|
||||
case 'function': return strings.format(QuickOutlineNLS._function_, count);
|
||||
case 'property': return strings.format(QuickOutlineNLS._property_, count);
|
||||
case 'variable': return strings.format(QuickOutlineNLS._variable_, count);
|
||||
case 'var': return strings.format(QuickOutlineNLS._variable2_, count);
|
||||
case 'constructor': return strings.format(QuickOutlineNLS._constructor_, count);
|
||||
case 'call': return strings.format(QuickOutlineNLS._call_, count);
|
||||
}
|
||||
|
||||
return type;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { localize } from 'vs/nls';
|
||||
import * as strings from 'vs/base/common/strings';
|
||||
import * as dom from 'vs/base/browser/dom';
|
||||
import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent';
|
||||
import { Emitter, Event } from 'vs/base/common/event';
|
||||
|
@ -43,6 +43,7 @@ import { ITelemetryInfo, ITelemetryService } from 'vs/platform/telemetry/common/
|
|||
import { IWorkspace, IWorkspaceContextService, IWorkspaceFolder, IWorkspaceFoldersChangeEvent, WorkbenchState, WorkspaceFolder } from 'vs/platform/workspace/common/workspace';
|
||||
import { ISingleFolderWorkspaceIdentifier, IWorkspaceIdentifier } from 'vs/platform/workspaces/common/workspaces';
|
||||
import { ILayoutService, IDimension } from 'vs/platform/layout/browser/layoutService';
|
||||
import { SimpleServicesNLS } from 'vs/editor/common/standaloneStrings';
|
||||
|
||||
export class SimpleModel implements IResolvedTextEditorModel {
|
||||
|
||||
|
@ -612,7 +613,7 @@ export class SimpleBulkEditService implements IBulkEditService {
|
|||
|
||||
return Promise.resolve({
|
||||
selection: undefined,
|
||||
ariaSummary: localize('summary', 'Made {0} edits in {1} files', totalEdits, totalFiles)
|
||||
ariaSummary: strings.format(SimpleServicesNLS.bulkEditServiceSummary, totalEdits, totalFiles)
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as nls from 'vs/nls';
|
||||
import * as browser from 'vs/base/browser/browser';
|
||||
import * as aria from 'vs/base/browser/ui/aria/aria';
|
||||
import { Disposable, IDisposable, combinedDisposable, toDisposable } from 'vs/base/common/lifecycle';
|
||||
|
@ -29,6 +28,7 @@ import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
|
|||
import { INotificationService } from 'vs/platform/notification/common/notification';
|
||||
import { IThemeService } from 'vs/platform/theme/common/themeService';
|
||||
import { IAccessibilityService } from 'vs/platform/accessibility/common/accessibility';
|
||||
import { StandaloneCodeEditorNLS } from 'vs/editor/common/standaloneStrings';
|
||||
|
||||
/**
|
||||
* Description of an action contribution
|
||||
|
@ -168,11 +168,11 @@ export class StandaloneCodeEditor extends CodeEditorWidget implements IStandalon
|
|||
@IAccessibilityService accessibilityService: IAccessibilityService
|
||||
) {
|
||||
options = options || {};
|
||||
options.ariaLabel = options.ariaLabel || nls.localize('editorViewAccessibleLabel', "Editor content");
|
||||
options.ariaLabel = options.ariaLabel || StandaloneCodeEditorNLS.editorViewAccessibleLabel;
|
||||
options.ariaLabel = options.ariaLabel + ';' + (
|
||||
browser.isIE
|
||||
? nls.localize('accessibilityHelpMessageIE', "Press Ctrl+F1 for Accessibility Options.")
|
||||
: nls.localize('accessibilityHelpMessage', "Press Alt+F1 for Accessibility Options.")
|
||||
? StandaloneCodeEditorNLS.accessibilityHelpMessageIE
|
||||
: StandaloneCodeEditorNLS.accessibilityHelpMessage
|
||||
);
|
||||
super(domElement, options, {}, instantiationService, codeEditorService, commandService, contextKeyService, themeService, notificationService, accessibilityService);
|
||||
|
||||
|
|
|
@ -3,10 +3,10 @@
|
|||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as nls from 'vs/nls';
|
||||
import { ICodeEditor } from 'vs/editor/browser/editorBrowser';
|
||||
import { EditorAction, ServicesAccessor, registerEditorAction } from 'vs/editor/browser/editorExtensions';
|
||||
import { IStandaloneThemeService } from 'vs/editor/standalone/common/standaloneThemeService';
|
||||
import { ToggleHighContrastNLS } from 'vs/editor/common/standaloneStrings';
|
||||
|
||||
class ToggleHighContrast extends EditorAction {
|
||||
|
||||
|
@ -15,7 +15,7 @@ class ToggleHighContrast extends EditorAction {
|
|||
constructor() {
|
||||
super({
|
||||
id: 'editor.action.toggleHighContrast',
|
||||
label: nls.localize('toggleHighContrast', "Toggle High Contrast Theme"),
|
||||
label: ToggleHighContrastNLS.toggleHighContrast,
|
||||
alias: 'Toggle High Contrast Theme',
|
||||
precondition: null
|
||||
});
|
||||
|
|
|
@ -571,7 +571,8 @@
|
|||
"duplicate-imports": true,
|
||||
"no-new-buffer": true,
|
||||
"translation-remind": true,
|
||||
"no-standalone-editor": true
|
||||
"no-standalone-editor": true,
|
||||
"no-nls-in-standalone-editor": true
|
||||
},
|
||||
"defaultSeverity": "warning"
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue