From d2b7f3b7424eec5808bff0de52ab82e1bb33d584 Mon Sep 17 00:00:00 2001 From: FernandoAscencio <48699277+FernandoAscencio@users.noreply.github.com> Date: Mon, 25 Sep 2023 06:55:27 -0400 Subject: [PATCH] Keybinding: Error Message Localization (#12889) Closes #12878 Signed-off-by: FernandoAscencio Co-authored-by: Vincent Fugnitto --- packages/core/src/common/keys.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/core/src/common/keys.ts b/packages/core/src/common/keys.ts index 780304a37d1f7..c95b5ae470d43 100644 --- a/packages/core/src/common/keys.ts +++ b/packages/core/src/common/keys.ts @@ -14,6 +14,7 @@ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 // ***************************************************************************** +import { nls } from './nls'; import { isOSX } from './os'; import { isObject } from './types'; @@ -252,7 +253,7 @@ export class KeyCode { } /* If duplicates i.e ctrl+ctrl+a or alt+alt+b or b+alt+b it is invalid */ if (keys.length !== new Set(keys).size) { - throw new Error(`Can't parse keybinding ${keybinding} Duplicate modifiers`); + throw new Error(nls.localize('theia/core/keybinding/duplicateModifierError', "Can't parse keybinding {0} Duplicate modifiers", keybinding)); } for (let keyString of keys) { @@ -266,7 +267,7 @@ export class KeyCode { if (isOSX) { schema.meta = true; } else { - throw new Error(`Can't parse keybinding ${keybinding} meta is for OSX only`); + throw new Error(nls.localize('theia/core/keybinding/metaError', "Can't parse keybinding {0} meta is for OSX only", keybinding)); } /* ctrlcmd for M1 keybindings that work on both macOS and other platforms */ } else if (keyString === SpecialCases.CTRLCMD) { @@ -288,7 +289,7 @@ export class KeyCode { schema.key = key; } } else { - throw new Error(`Unrecognized key '${keyString}' in '${keybinding}'`); + throw new Error(nls.localize('theia/core/keybinding/unrecognizedKeyError', 'Unrecognized key {0} in {1}', keyString, keybinding)); } }