mirror of
https://github.com/OpenMW/openmw.git
synced 2026-01-25 22:40:56 +00:00
Translate cell name directly
This commit is contained in:
parent
d6cc205b86
commit
2fe63177b7
1 changed files with 6 additions and 9 deletions
|
|
@ -1,7 +1,5 @@
|
|||
#include "cellbindings.hpp"
|
||||
|
||||
#include <MyGUI_LanguageManager.h>
|
||||
|
||||
#include <components/esm3/loadacti.hpp>
|
||||
#include <components/esm3/loadalch.hpp>
|
||||
#include <components/esm3/loadappa.hpp>
|
||||
|
|
@ -42,7 +40,10 @@
|
|||
#include <components/esm4/loadtree.hpp>
|
||||
#include <components/esm4/loadweap.hpp>
|
||||
|
||||
#include <components/translation/translation.hpp>
|
||||
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
#include "../mwworld/cellstore.hpp"
|
||||
#include "../mwworld/worldmodel.hpp"
|
||||
|
|
@ -87,13 +88,9 @@ namespace MWLua
|
|||
};
|
||||
|
||||
cellT["name"] = sol::readonly_property([](const CellT& c) { return c.mStore->getCell()->getNameId(); });
|
||||
cellT["displayName"] = sol::readonly_property([](const CellT& c) {
|
||||
std::string str(c.mStore->getCell()->getNameId());
|
||||
if (!str.empty())
|
||||
{
|
||||
str = MyGUI::LanguageManager::getInstance().replaceTags(MyGUI::UString("#{sCell=" + str + "}"));
|
||||
}
|
||||
return str;
|
||||
cellT["displayName"] = sol::readonly_property([](const CellT& c) -> std::string_view {
|
||||
const auto& storage = MWBase::Environment::get().getWindowManager()->getTranslationDataStorage();
|
||||
return storage.translateCellName(c.mStore->getCell()->getNameId());
|
||||
});
|
||||
cellT["id"]
|
||||
= sol::readonly_property([](const CellT& c) { return c.mStore->getCell()->getId().serializeText(); });
|
||||
|
|
|
|||
Loading…
Reference in a new issue