Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit fd247d5

Browse files
minduser00SmallJoker
authored andcommittedApr 9, 2018
Fix for translating empty string
1 parent 88d091f commit fd247d5

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed
 

Diff for: ‎src/gettext.h

+11-2
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,19 @@ 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+
#if USE_GETTEXT
55+
// We must check here that is not an empty string to avoid trying to translate it
56+
return str[0] ? utf8_to_wide_c(gettext(str)) : utf8_to_wide_c("");
57+
#else
58+
return utf8_to_wide_c(str);
59+
#endif
5560
}
5661

5762
inline std::string strgettext(const std::string &text)
5863
{
59-
return gettext(text.c_str());
64+
#if USE_GETTEXT
65+
return text.empty() ? text.c_str() : gettext(text.c_str());
66+
#else
67+
return text.c_str();
68+
#endif
6069
}

0 commit comments

Comments
 (0)
Please sign in to comment.