From 9a06d6aa9fa2676a3fb4fa494f9318d0c5d7becb Mon Sep 17 00:00:00 2001 From: minduser00 Date: Tue, 27 Mar 2018 11:49:47 +0000 Subject: Fix for translating empty strings Fix for incorrect translation of empty strings In the key change menu, when a button key not have name an empty string is passed to gettext. The empty string is reserved for gettext to return de header of the .po file an this is shoved in the button --- src/gettext.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gettext.h b/src/gettext.h index d7fc586c0..4038e3fa8 100644 --- a/src/gettext.h +++ b/src/gettext.h @@ -51,10 +51,11 @@ extern wchar_t *utf8_to_wide_c(const char *str); // The returned string is allocated using new inline const wchar_t *wgettext(const char *str) { - return utf8_to_wide_c(gettext(str)); + // We must check here that is not an empty string to avoid trying to translate it + return str[0] ? utf8_to_wide_c(gettext(str)) : L""; } inline std::string strgettext(const std::string &text) { - return gettext(text.c_str()); + return text.empty() ? "" : gettext(text.c_str()); } -- cgit v1.2.3