1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Fix gettext on MSVC

This commit is contained in:
BlockMen 2015-02-12 02:55:50 +01:00
parent e102cbd840
commit d302629392
3 changed files with 31 additions and 25 deletions

View file

@ -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)