diff options
author | minduser00 <minduser00@users.noreply.github.com> | 2018-03-27 11:49:47 +0000 |
---|---|---|
committer | SmallJoker <mk939@ymail.com> | 2018-06-03 17:32:00 +0200 |
commit | 1d06a8ef6c2e5a66c4f109b7ef9cb76c31e3ce4f (patch) | |
tree | a8da94d81d9b56968db783ea98a6019e573ae2ba | |
parent | 875972ffa6cfbf4621bc71f11f4f30ee2ae47851 (diff) | |
download | minetest-1d06a8ef6c2e5a66c4f109b7ef9cb76c31e3ce4f.tar.gz minetest-1d06a8ef6c2e5a66c4f109b7ef9cb76c31e3ce4f.tar.bz2 minetest-1d06a8ef6c2e5a66c4f109b7ef9cb76c31e3ce4f.zip |
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
-rw-r--r-- | src/gettext.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/gettext.h b/src/gettext.h index 885d7ca2d..170d75dee 100644 --- a/src/gettext.h +++ b/src/gettext.h @@ -51,12 +51,13 @@ 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()); } #endif |