mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Clean up server-side translations, remove global variable (#10075)
This commit is contained in:
parent
c8303f790c
commit
9ec75d7765
9 changed files with 50 additions and 65 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue