Skip to content

Commit

Permalink
Keybinding: Error Message Localization (#12889)
Browse files Browse the repository at this point in the history
Closes #12878

Signed-off-by: FernandoAscencio <fernando.ascencio.cama@ericsson.com>
Co-authored-by: Vincent Fugnitto <vincent.fugnitto@ericsson.com>
  • Loading branch information
FernandoAscencio and vince-fugnitto committed Sep 25, 2023
1 parent 03d0cb8 commit d2b7f3b
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions packages/core/src/common/keys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -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) {
Expand All @@ -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) {
Expand All @@ -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));
}
}

Expand Down

0 comments on commit d2b7f3b

Please sign in to comment.