Skip to content

Commit 9a06d6a

Browse files
minduser00sfan5
authored andcommittedApr 9, 2018
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
1 parent d58801a commit 9a06d6a

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed
 

Diff for: ‎src/gettext.h

+3-2
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,11 @@ extern wchar_t *utf8_to_wide_c(const char *str);
5151
// The returned string is allocated using new
5252
inline const wchar_t *wgettext(const char *str)
5353
{
54-
return utf8_to_wide_c(gettext(str));
54+
// We must check here that is not an empty string to avoid trying to translate it
55+
return str[0] ? utf8_to_wide_c(gettext(str)) : L"";
5556
}
5657

5758
inline std::string strgettext(const std::string &text)
5859
{
59-
return gettext(text.c_str());
60+
return text.empty() ? "" : gettext(text.c_str());
6061
}

0 commit comments

Comments
 (0)
Please sign in to comment.