diff --git a/src/client/keycode.cpp b/src/client/keycode.cpp index 0ec4023b1f..1692c82dae 100644 --- a/src/client/keycode.cpp +++ b/src/client/keycode.cpp @@ -3,6 +3,7 @@ // Copyright (C) 2010-2013 celeron55, Perttu Ahola #include "keycode.h" +#include "gettext.h" #include "settings.h" #include "log.h" #include "renderingengine.h" @@ -28,8 +29,6 @@ struct table_key { #define DEFINEKEY5(ch) /* key without Irrlicht keycode */ \ { ch, KEY_KEY_CODES_COUNT, static_cast(*ch), ch }, -#define N_(text) text - static std::vector table = { // Keys that can be reliably mapped between Char and Key DEFINEKEY3(0) @@ -224,9 +223,6 @@ static std::vector table = { static const table_key invalid_key = {"", KEY_UNKNOWN, L'\0', ""}; -#undef N_ - - static const table_key &lookup_keychar(wchar_t Char) { if (Char == L'\0') @@ -327,8 +323,10 @@ std::string KeyPress::name() const { const auto &name = lookup_scancode(scancode).LangName; if (!name.empty()) - return name; - return formatScancode(); + return strgettext(name); + if (auto scancode = getScancode()) + return fmtgettext("Scancode: %d", scancode); + return ""; } EKEY_CODE KeyPress::getKeycode() const diff --git a/src/gui/guiButtonKey.cpp b/src/gui/guiButtonKey.cpp index 6a7c0817f1..d8025be67a 100644 --- a/src/gui/guiButtonKey.cpp +++ b/src/gui/guiButtonKey.cpp @@ -25,7 +25,7 @@ void GUIButtonKey::setKey(KeyPress kp) { key_value = kp; keysym = utf8_to_wide(kp.sym()); - super::setText(wstrgettext(kp.name()).c_str()); + super::setText(utf8_to_wide(kp.name()).c_str()); } void GUIButtonKey::sendKey() diff --git a/src/gui/guiButtonKey.h b/src/gui/guiButtonKey.h index 86414c00d0..90e64ae1fa 100644 --- a/src/gui/guiButtonKey.h +++ b/src/gui/guiButtonKey.h @@ -61,7 +61,7 @@ private: { capturing = false; nostart |= inhibit_restart; - super::setText(wstrgettext(key_value.name()).c_str()); + super::setText(utf8_to_wide(key_value.name()).c_str()); } //! Sets the captured key and stop capturing