aboutsummaryrefslogtreecommitdiff
path: root/src/script/lua_api
diff options
context:
space:
mode:
authorrubenwardy <rw@rubenwardy.com>2020-09-16 14:51:11 +0100
committerGitHub <noreply@github.com>2020-09-16 14:51:11 +0100
commit9ec75d77651c333eca3c5b46a3a56c8353fed464 (patch)
treefb8d42716279514e8850e53e47973a0f6d0ef7d5 /src/script/lua_api
parentc8303f790ccb03857d031ecb73de7f9f59a6ceba (diff)
downloadminetest-9ec75d77651c333eca3c5b46a3a56c8353fed464.tar.gz
minetest-9ec75d77651c333eca3c5b46a3a56c8353fed464.tar.bz2
minetest-9ec75d77651c333eca3c5b46a3a56c8353fed464.zip
Clean up server-side translations, remove global variable (#10075)
Diffstat (limited to 'src/script/lua_api')
-rw-r--r--src/script/lua_api/l_env.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/script/lua_api/l_env.cpp b/src/script/lua_api/l_env.cpp
index b2bc8c5f6..138e88ae8 100644
--- a/src/script/lua_api/l_env.cpp
+++ b/src/script/lua_api/l_env.cpp
@@ -1340,9 +1340,9 @@ int ModApiEnvMod::l_get_translated_string(lua_State * L)
GET_ENV_PTR;
std::string lang_code = luaL_checkstring(L, 1);
std::string string = luaL_checkstring(L, 2);
- getServer(L)->loadTranslationLanguage(lang_code);
- string = wide_to_utf8(translate_string(utf8_to_wide(string),
- &(*g_server_translations)[lang_code]));
+
+ auto *translations = getServer(L)->getTranslationLanguage(lang_code);
+ string = wide_to_utf8(translate_string(utf8_to_wide(string), translations));
lua_pushstring(L, string.c_str());
return 1;
}