mirror of
https://github.com/luanti-org/luanti.git
synced 2025-10-13 16:45:20 +02:00
[CSM] Fix and improve minetest.get_language()
Previously this method would accidentally reset the locale and break everything.
This commit is contained in:
@@ -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)
|
||||
|
Reference in New Issue
Block a user