From 08d28798c67b37775a11755b9153f4ad7303c908 Mon Sep 17 00:00:00 2001 From: Ajay Ramachandran Date: Thu, 26 Mar 2020 12:30:06 -0400 Subject: [PATCH] Localised key errors --- public/_locales/en/messages.json | 9 +++++++++ src/options.ts | 8 ++------ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/public/_locales/en/messages.json b/public/_locales/en/messages.json index e26d1419..e39a7e74 100644 --- a/public/_locales/en/messages.json +++ b/public/_locales/en/messages.json @@ -452,5 +452,14 @@ }, "copyDebugInformationComplete": { "message": "The debug information has been copied to the clip board. Feel free to remove any information you would rather not share. Save this in a text file or paste into the bug report." + }, + "theKey": { + "message": "The key" + }, + "keyAlreadyUsedByYouTube": { + "message": "is already used by youtube. Please select another key." + }, + "keyAlreadyUsed": { + "message": "is bound to another action. Please select another key." } } diff --git a/src/options.ts b/src/options.ts index 4c55bae7..27d2a1f6 100644 --- a/src/options.ts +++ b/src/options.ts @@ -344,9 +344,7 @@ function keybindKeyPressed(element: HTMLElement, e: KeyboardEvent) { if (restrictedKeys.indexOf(key) !== -1 ) { closeKeybindOption(element, button); - // TODO: This should be localised - alert("The key " + key + " is already used by youtube. Please select another key."); - + alert(chrome.i18n.getMessage("theKey") + " " + key + " " + chrome.i18n.getMessage("keyAlreadyUsedByYouTube")); return; } @@ -356,9 +354,7 @@ function keybindKeyPressed(element: HTMLElement, e: KeyboardEvent) { if (key === otherKeybind) { closeKeybindOption(element, button); - // TODO: This should be localised - alert("The key " + key + " is bound to another action. Please select another key."); - + alert(chrome.i18n.getMessage("theKey") + " " + key + " " + chrome.i18n.getMessage("keyAlreadyUsed")); return; }