From c215fbe721e877a884c963e0ae81a7936696a7ba Mon Sep 17 00:00:00 2001 From: FernandoAscencio Date: Fri, 1 Sep 2023 13:18:44 -0400 Subject: [PATCH 1/4] Keybinding: Error Message Localization Closes #12878 Signed-Off-By: FernandoAscencio --- 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..ccd8cd3569485 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/error.duplicateModifier', "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/error.OsxOnly', "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/error.unrecognizedKey', 'Unrecognized key {0} in {1}', keyString, keybinding)); } } From 949429cdb39ef24fb46e11365f09cae1138d1b15 Mon Sep 17 00:00:00 2001 From: FernandoAscencio <48699277+FernandoAscencio@users.noreply.github.com> Date: Fri, 1 Sep 2023 14:32:48 -0400 Subject: [PATCH 2/4] Update packages/core/src/common/keys.ts Co-authored-by: Vincent Fugnitto --- packages/core/src/common/keys.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/core/src/common/keys.ts b/packages/core/src/common/keys.ts index ccd8cd3569485..79a7a05b23c47 100644 --- a/packages/core/src/common/keys.ts +++ b/packages/core/src/common/keys.ts @@ -253,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(nls.localize('theia/core/keybinding/error.duplicateModifier', "Can't parse keybinding {0} Duplicate modifiers", keybinding)); + throw new Error(nls.localize('theia/core/keybinding/duplicateModifierError', "Can't parse keybinding {0} Duplicate modifiers", keybinding)); } for (let keyString of keys) { From a1a667f28c1947cc061514c402b8dc6cec9e340d Mon Sep 17 00:00:00 2001 From: FernandoAscencio <48699277+FernandoAscencio@users.noreply.github.com> Date: Fri, 1 Sep 2023 14:32:56 -0400 Subject: [PATCH 3/4] Update packages/core/src/common/keys.ts Co-authored-by: Vincent Fugnitto --- packages/core/src/common/keys.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/core/src/common/keys.ts b/packages/core/src/common/keys.ts index 79a7a05b23c47..b9a12d8c807d8 100644 --- a/packages/core/src/common/keys.ts +++ b/packages/core/src/common/keys.ts @@ -289,7 +289,7 @@ export class KeyCode { schema.key = key; } } else { - throw new Error(nls.localize('theia/core/keybinding/error.unrecognizedKey', 'Unrecognized key {0} in {1}', keyString, keybinding)); + throw new Error(nls.localize('theia/core/keybinding/unrecognizedKeyError', 'Unrecognized key {0} in {1}', keyString, keybinding)); } } From 23c81aef7e3fef8a47167164b1c7716e786b452e Mon Sep 17 00:00:00 2001 From: FernandoAscencio <48699277+FernandoAscencio@users.noreply.github.com> Date: Fri, 1 Sep 2023 14:33:05 -0400 Subject: [PATCH 4/4] Update packages/core/src/common/keys.ts Co-authored-by: Vincent Fugnitto --- packages/core/src/common/keys.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/core/src/common/keys.ts b/packages/core/src/common/keys.ts index b9a12d8c807d8..c95b5ae470d43 100644 --- a/packages/core/src/common/keys.ts +++ b/packages/core/src/common/keys.ts @@ -267,7 +267,7 @@ export class KeyCode { if (isOSX) { schema.meta = true; } else { - throw new Error(nls.localize('theia/core/keybinding/error.OsxOnly', "Can't parse keybinding {0} meta is for OSX only", keybinding)); + 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) {