diff options
author | BlockMen <nmuelll@web.de> | 2015-02-12 02:55:50 +0100 |
---|---|---|
committer | Craig Robbins <kde.psych@gmail.com> | 2015-02-13 01:23:30 +1000 |
commit | e62927ed71c557cd885fce03fbc34bb6020089a3 (patch) | |
tree | 3c163576fcdc244ffec57797312238c261b03a7c /src/gettext.h | |
parent | 15c037614f6f7193cef4bfd1da45d83ef2fef393 (diff) | |
download | minetest-e62927ed71c557cd885fce03fbc34bb6020089a3.tar.gz minetest-e62927ed71c557cd885fce03fbc34bb6020089a3.tar.bz2 minetest-e62927ed71c557cd885fce03fbc34bb6020089a3.zip |
Fix gettext on MSVC
Diffstat (limited to 'src/gettext.h')
-rw-r--r-- | src/gettext.h | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/gettext.h b/src/gettext.h index 8e6282887..dce45fa3a 100644 --- a/src/gettext.h +++ b/src/gettext.h @@ -41,16 +41,19 @@ void init_gettext(const char *path, const std::string &configured_language); extern const wchar_t *narrow_to_wide_c(const char *mbs); extern std::wstring narrow_to_wide(const std::string &mbs); - // You must free the returned string! inline const wchar_t *wgettext(const char *str) { return narrow_to_wide_c(gettext(str)); } +// Gettext under MSVC needs this strange way. Just don't ask... inline std::wstring wstrgettext(const std::string &text) { - return narrow_to_wide(gettext(text.c_str())); + const wchar_t *tmp = wgettext(text.c_str()); + std::wstring retval = (std::wstring)tmp; + delete[] tmp; + return retval; } inline std::string strgettext(const std::string &text) |