mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-16 17:29:55 +00:00
Avoid creating multiple i18n contexts with the same name.
This commit is contained in:
parent
b56406b0ad
commit
5eca122f04
1 changed files with 3 additions and 0 deletions
|
@ -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…
Reference in a new issue