]> git.lizzy.rs Git - dragonfireclient.git/blobdiff - src/script/lua_api/l_client.cpp
Improve core.sound_play with ephemeral sounds and player exclusion
[dragonfireclient.git] / src / script / lua_api / l_client.cpp
index fa369a360b53a445c65e9081df2deed1ba2f32d8..fba18249293566ed6abb414d2b97eae1b5495e09 100644 (file)
@@ -230,9 +230,18 @@ int ModApiClient::l_get_node_or_nil(lua_State *L)
 
 int ModApiClient::l_get_language(lua_State *L)
 {
-       char *locale = setlocale(LC_ALL, "");
+#ifdef _WIN32
+       char *locale = setlocale(LC_ALL, NULL);
+#else
+       char *locale = setlocale(LC_MESSAGES, NULL);
+#endif
+       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)