From 238b558c5940878343ee93f42d9c92bc51905970 Mon Sep 17 00:00:00 2001 From: Eberhard Beilharz Date: Thu, 29 Oct 2026 17:10:45 +0100 Subject: [PATCH] fix: improve error message if keyboard can't be loaded If the user requests a keyboard that is not loaded by default (e.g. if he mistypes the keyboard name, or he requests a deprecated keyboard) we used to show a message that was very technical and confusing for most users. This change now checks if the keyboard is available and outputs a clearer message if not. Fixes: [keyman#16914](https://github.com/keymanapp/keyman/issues/16914) Test-bot: skip --- .gitignore | 1 + inc/head.php | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index be43cc8..a70bb4c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ .idea/** +.vscode/ cdn/deploy /vendor diff --git a/inc/head.php b/inc/head.php index dbc492e..9b1502f 100644 --- a/inc/head.php +++ b/inc/head.php @@ -179,7 +179,13 @@ function loadKeyboardFromHash() { }'; } ?> if(localKeyboard && localLanguage) { - keyman.setActiveKeyboard(localKeyboard, localLanguage); + var kbd = getKeymanWeb().getKeyboard(localKeyboard, localLanguage); + if(kbd) { + keyman.setActiveKeyboard(localKeyboard, localLanguage); + } else { + showBox('Keyboard not available', `The keyboard "${localKeyboard}" for language "${localLanguage}" is not available. Please choose a different keyboard.`); + console.warn(`Keyboard for "${localKeyboard}" for language "${localLanguage}" is not available in the list of loaded keyboards. It could be mistyped or be a deprecated keyboard.`); + } } document.getElementById('message').focus(); });