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:
parent
e102cbd840
commit
d302629392
3 changed files with 31 additions and 25 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue