mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
[CSM] Fix and improve minetest.get_language()
Previously this method would accidentally reset the locale and break everything.
This commit is contained in:
parent
2c4cf508a9
commit
c44318a253
3 changed files with 21 additions and 9 deletions
|
@ -230,9 +230,14 @@ int ModApiClient::l_get_node_or_nil(lua_State *L)
|
|||
|
||||
int ModApiClient::l_get_language(lua_State *L)
|
||||
{
|
||||
char *locale = setlocale(LC_ALL, "");
|
||||
char *locale = setlocale(LC_MESSAGES, NULL);
|
||||
std::string lang = gettext("LANG_CODE");
|
||||
if (lang == "LANG_CODE")
|
||||
lang = "";
|
||||
|
||||
lua_pushstring(L, locale);
|
||||
return 1;
|
||||
lua_pushstring(L, lang.c_str());
|
||||
return 2;
|
||||
}
|
||||
|
||||
int ModApiClient::l_get_wielded_item(lua_State *L)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue