mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-02-21 18:40:01 +00:00
Avoid creating multiple i18n contexts with the same name.
This commit is contained in:
parent
b56406b0ad
commit
5eca122f04
@ -99,6 +99,9 @@ namespace LuaUtil
|
||||
{
|
||||
if (mI18nLoader == sol::nil)
|
||||
throw std::runtime_error("LuaUtil::I18nManager is not initialized");
|
||||
auto it = mContexts.find(contextName);
|
||||
if (it != mContexts.end())
|
||||
return sol::make_object(mLua->sol(), it->second);
|
||||
Context ctx{contextName, mLua->newTable(), call(mI18nLoader, "i18n.init")};
|
||||
ctx.updateLang(this);
|
||||
mContexts.emplace(contextName, ctx);
|
||||
|
Loading…
x
Reference in New Issue
Block a user