From 0350bee2e644ccc0f3eb6d8033fc8c8b758c81ca Mon Sep 17 00:00:00 2001 From: elexis Date: Sat, 6 Jan 2018 16:20:59 +0000 Subject: [PATCH] Remove workaround from 4055c564e9 / D1184 and display hotkey strings too if the hotkey is unassigned. Differential Revision: https://code.wildfiregames.com/D1200 Reviewed By: mimo This was SVN commit r20777. --- binaries/data/mods/public/gui/common/color.js | 4 +++- .../data/mods/public/gui/session/messages.js | 16 ---------------- 2 files changed, 3 insertions(+), 17 deletions(-) diff --git a/binaries/data/mods/public/gui/common/color.js b/binaries/data/mods/public/gui/common/color.js index 289912ed5c..9ee7c7f116 100644 --- a/binaries/data/mods/public/gui/common/color.js +++ b/binaries/data/mods/public/gui/common/color.js @@ -146,7 +146,9 @@ function colorizeHotkey(text, hotkey) let key = Engine.ConfigDB_GetValue("user", "hotkey." + hotkey); if (!key || key.toLowerCase() == "unused") - return ""; + key = sprintf(translate("Unassigned hotkey: %(hotkeyName)s"), { + "hotkeyName": hotkey + }); return sprintf(text, { "hotkey": coloredText("\\[" + key + "]", g_HotkeyColor) diff --git a/binaries/data/mods/public/gui/session/messages.js b/binaries/data/mods/public/gui/session/messages.js index 4d36a0edc0..05b89cf3da 100644 --- a/binaries/data/mods/public/gui/session/messages.js +++ b/binaries/data/mods/public/gui/session/messages.js @@ -568,22 +568,6 @@ function updateTutorial(notification) return; } - // TODO temporary should be removed once D1180 is done - for (let i = 0; i < notification.instructions.length; ++i) - { - let item = notification.instructions[i]; - if (typeof item == "string") - continue; - if (item.hotkey.length == 1) - { - let key = Engine.ConfigDB_GetValue("user", "hotkey." + item.hotkey[0]); - if (!key || key.toLowerCase() == "unused") - notification.instructions[i]= item.text.replace("%(hotkey)s", "{hotkey " + item.hotkey[0] + " undefined}"); - } - else - error("Several hotkeys per instruction item is not yet supported, needs D1180."); - } - // end of temporary let notificationText = notification.instructions.reduce((instructions, item) => instructions + (typeof item == "string" ? translate(item) : colorizeHotkey(translate(item.text), item.hotkey)),