refactor(localization): switch block translations to item naming

Remove the `name_key` field from block definitions and use item-based
localization keys (`item.*.name`) for inventory display. Item data now
stores the localized name at load time.
This commit is contained in:
2026-08-05 15:42:53 +08:00
parent 277aab1b81
commit 322fb2fea0
19 changed files with 44 additions and 58 deletions

View File

@@ -1,6 +1,7 @@
#include "Cubed/gameplay/item_manager.hpp"
#include "Cubed/gameplay/block_manager.hpp"
#include "Cubed/localization.hpp"
#include "Cubed/tools/cubed_assert.hpp"
#include "Cubed/tools/log.hpp"
@@ -76,6 +77,7 @@ void ItemManager::add(const std::filesystem::path& path) {
data.property = "cubed:pig";
}
}
data.local_name = tr(std::format("item.{}.name", data.name));
acc a;
if (m_map.emplace(a, data.id, std::move(data))) {
if (!m_id_map.emplace(a->second.name, a->first)) {