From d6cc205b86c7d6713b30f9c2a294d4e0e785b625 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Sun, 5 Oct 2025 09:54:08 +0400 Subject: [PATCH 1/3] Localize cell names in the Lua API (feature 8725) --- apps/openmw/mwlua/cellbindings.cpp | 10 ++++++++++ files/lua_api/openmw/core.lua | 1 + 2 files changed, 11 insertions(+) diff --git a/apps/openmw/mwlua/cellbindings.cpp b/apps/openmw/mwlua/cellbindings.cpp index 4e4542d89f..e32617ec0c 100644 --- a/apps/openmw/mwlua/cellbindings.cpp +++ b/apps/openmw/mwlua/cellbindings.cpp @@ -1,5 +1,7 @@ #include "cellbindings.hpp" +#include + #include #include #include @@ -85,6 +87,14 @@ 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["id"] = sol::readonly_property([](const CellT& c) { return c.mStore->getCell()->getId().serializeText(); }); cellT["region"] = sol::readonly_property( diff --git a/files/lua_api/openmw/core.lua b/files/lua_api/openmw/core.lua index d392fc8451..7909c1ce21 100644 --- a/files/lua_api/openmw/core.lua +++ b/files/lua_api/openmw/core.lua @@ -297,6 +297,7 @@ -- A cell of the game world. -- @type Cell -- @field #string name Name of the cell (can be empty string). +-- @field #string displayName Human-readable cell name (takes into account *.cel file localizations). Can be empty string. -- @field #string id Unique record ID of the cell, based on cell name for interiors and the worldspace for exteriors, or the formID of the cell for ESM4 cells. -- @field #string region Region of the cell. -- @field #boolean isExterior Whether the cell is an exterior cell. "Exterior" means grid of cells where the player can seamless walk from one cell to another without teleports. QuasiExterior (interior with sky) is not an exterior. From 2fe63177b74bcaba7c9b691e3f31ffaef3e0f8bc Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Sun, 5 Oct 2025 17:01:53 +0400 Subject: [PATCH 2/3] Translate cell name directly --- apps/openmw/mwlua/cellbindings.cpp | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/apps/openmw/mwlua/cellbindings.cpp b/apps/openmw/mwlua/cellbindings.cpp index e32617ec0c..2f279e0c1a 100644 --- a/apps/openmw/mwlua/cellbindings.cpp +++ b/apps/openmw/mwlua/cellbindings.cpp @@ -1,7 +1,5 @@ #include "cellbindings.hpp" -#include - #include #include #include @@ -42,7 +40,10 @@ #include #include +#include + #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(); }); From 3687f1fe559c8cadc8f1da08eee8111ae7ed7e03 Mon Sep 17 00:00:00 2001 From: Alexei Kotov Date: Sun, 2 Nov 2025 04:19:44 +0300 Subject: [PATCH 3/3] Increment Lua API revision --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fa621617f0..a8241350ff 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -82,7 +82,7 @@ message(STATUS "Configuring OpenMW...") set(OPENMW_VERSION_MAJOR 0) set(OPENMW_VERSION_MINOR 51) set(OPENMW_VERSION_RELEASE 0) -set(OPENMW_LUA_API_REVISION 97) +set(OPENMW_LUA_API_REVISION 98) set(OPENMW_POSTPROCESSING_API_REVISION 3) set(OPENMW_VERSION_COMMITHASH "")