Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keybinding: Error Message Localization #12889

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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/error.duplicateModifier', "Can't parse keybinding {0} Duplicate modifiers", keybinding));
FernandoAscencio marked this conversation as resolved.
Show resolved Hide resolved
}

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/error.OsxOnly', "Can't parse keybinding {0} meta is for OSX only", keybinding));
FernandoAscencio marked this conversation as resolved.
Show resolved Hide resolved
}
/* 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/error.unrecognizedKey', 'Unrecognized key {0} in {1}', keyString, keybinding));
FernandoAscencio marked this conversation as resolved.
Show resolved Hide resolved
}
}

Expand Down