1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-25 22:42:04 +02:00

simplified translation

This commit is contained in:
Laserlicht
2025-09-16 23:11:35 +02:00
parent 5a8f75f11d
commit 4e8556ef64
6 changed files with 17 additions and 17 deletions

View File

@@ -80,7 +80,7 @@ void CStatisticScreen::onSelectButton()
auto possibleRes = std::vector<EGameResID>{EGameResID::GOLD, EGameResID::WOOD, EGameResID::MERCURY, EGameResID::ORE, EGameResID::SULFUR, EGameResID::CRYSTAL, EGameResID::GEMS}; auto possibleRes = std::vector<EGameResID>{EGameResID::GOLD, EGameResID::WOOD, EGameResID::MERCURY, EGameResID::ORE, EGameResID::SULFUR, EGameResID::CRYSTAL, EGameResID::GEMS};
std::vector<std::string> resourceText; std::vector<std::string> resourceText;
for(const auto & res : possibleRes) for(const auto & res : possibleRes)
resourceText.emplace_back(MetaString::createFromTextID(res.toResource()->getNameTextID()).toString()); resourceText.emplace_back(res.toResource()->getNameTranslated());
ENGINE->windows().createAndPushWindow<StatisticSelector>(resourceText, [this, content, possibleRes](int index) ENGINE->windows().createAndPushWindow<StatisticSelector>(resourceText, [this, content, possibleRes](int index)
{ {
@@ -170,7 +170,7 @@ std::shared_ptr<CIntObject> CStatisticScreen::getContent(Content c, EGameResID r
case CHART_RESOURCES: case CHART_RESOURCES:
plotData = extractData(statistic, [res](const StatisticDataSetEntry & val) -> float { return val.resources[res]; }); plotData = extractData(statistic, [res](const StatisticDataSetEntry & val) -> float { return val.resources[res]; });
return std::make_shared<LineChart>(contentArea.resize(-5), LIBRARY->generaltexth->translate(std::get<0>(contentInfo[c])) + " - " + MetaString::createFromTextID(res.toResource()->getNameTextID()).toString(), plotData, icons, 0); return std::make_shared<LineChart>(contentArea.resize(-5), LIBRARY->generaltexth->translate(std::get<0>(contentInfo[c])) + " - " + res.toResource()->getNameTranslated(), plotData, icons, 0);
case CHART_INCOME: case CHART_INCOME:
plotData = extractData(statistic, [](const StatisticDataSetEntry & val) -> float { return val.income; }); plotData = extractData(statistic, [](const StatisticDataSetEntry & val) -> float { return val.income; });
@@ -194,7 +194,7 @@ std::shared_ptr<CIntObject> CStatisticScreen::getContent(Content c, EGameResID r
case CHART_NUMBER_OF_MINES: case CHART_NUMBER_OF_MINES:
plotData = extractData(statistic, [res](StatisticDataSetEntry val) -> float { return val.numMines[res]; }); plotData = extractData(statistic, [res](StatisticDataSetEntry val) -> float { return val.numMines[res]; });
return std::make_shared<LineChart>(contentArea.resize(-5), LIBRARY->generaltexth->translate(std::get<0>(contentInfo[c])) + " - " + MetaString::createFromTextID(res.toResource()->getNameTextID()).toString(), plotData, icons, 0); return std::make_shared<LineChart>(contentArea.resize(-5), LIBRARY->generaltexth->translate(std::get<0>(contentInfo[c])) + " - " + res.toResource()->getNameTranslated(), plotData, icons, 0);
case CHART_ARMY_STRENGTH: case CHART_ARMY_STRENGTH:
plotData = extractData(statistic, [](const StatisticDataSetEntry & val) -> float { return val.armyStrength; }); plotData = extractData(statistic, [](const StatisticDataSetEntry & val) -> float { return val.armyStrength; });
@@ -206,11 +206,11 @@ std::shared_ptr<CIntObject> CStatisticScreen::getContent(Content c, EGameResID r
case CHART_RESOURCES_SPENT_ARMY: case CHART_RESOURCES_SPENT_ARMY:
plotData = extractData(statistic, [res](const StatisticDataSetEntry & val) -> float { return val.spentResourcesForArmy[res]; }); plotData = extractData(statistic, [res](const StatisticDataSetEntry & val) -> float { return val.spentResourcesForArmy[res]; });
return std::make_shared<LineChart>(contentArea.resize(-5), LIBRARY->generaltexth->translate(std::get<0>(contentInfo[c])) + " - " + MetaString::createFromTextID(res.toResource()->getNameTextID()).toString(), plotData, icons, 0); return std::make_shared<LineChart>(contentArea.resize(-5), LIBRARY->generaltexth->translate(std::get<0>(contentInfo[c])) + " - " + res.toResource()->getNameTranslated(), plotData, icons, 0);
case CHART_RESOURCES_SPENT_BUILDINGS: case CHART_RESOURCES_SPENT_BUILDINGS:
plotData = extractData(statistic, [res](const StatisticDataSetEntry & val) -> float { return val.spentResourcesForBuildings[res]; }); plotData = extractData(statistic, [res](const StatisticDataSetEntry & val) -> float { return val.spentResourcesForBuildings[res]; });
return std::make_shared<LineChart>(contentArea.resize(-5), LIBRARY->generaltexth->translate(std::get<0>(contentInfo[c])) + " - " + MetaString::createFromTextID(res.toResource()->getNameTextID()).toString(), plotData, icons, 0); return std::make_shared<LineChart>(contentArea.resize(-5), LIBRARY->generaltexth->translate(std::get<0>(contentInfo[c])) + " - " + res.toResource()->getNameTranslated(), plotData, icons, 0);
case CHART_MAP_EXPLORED: case CHART_MAP_EXPLORED:
plotData = extractData(statistic, [](const StatisticDataSetEntry & val) -> float { return val.mapExploredRatio; }); plotData = extractData(statistic, [](const StatisticDataSetEntry & val) -> float { return val.mapExploredRatio; });
@@ -331,43 +331,43 @@ OverviewPanel::OverviewPanel(Rect position, std::string title, const StatisticDa
} }
}, },
{ {
LIBRARY->generaltexth->translate("vcmi.statisticWindow.param.tradeVolume") + " - " + MetaString::createFromTextID(GameResID(EGameResID::GOLD).toResource()->getNameTextID()).toString(), [this](PlayerColor color){ LIBRARY->generaltexth->translate("vcmi.statisticWindow.param.tradeVolume") + " - " + GameResID(EGameResID::GOLD).toResource()->getNameTranslated(), [this](PlayerColor color){
auto val = playerDataFilter(color).back(); auto val = playerDataFilter(color).back();
return std::to_string(val.tradeVolume[EGameResID::GOLD]); return std::to_string(val.tradeVolume[EGameResID::GOLD]);
} }
}, },
{ {
LIBRARY->generaltexth->translate("vcmi.statisticWindow.param.tradeVolume") + " - " + MetaString::createFromTextID(GameResID(EGameResID::WOOD).toResource()->getNameTextID()).toString(), [this](PlayerColor color){ LIBRARY->generaltexth->translate("vcmi.statisticWindow.param.tradeVolume") + " - " + GameResID(EGameResID::WOOD).toResource()->getNameTranslated(), [this](PlayerColor color){
auto val = playerDataFilter(color).back(); auto val = playerDataFilter(color).back();
return std::to_string(val.tradeVolume[EGameResID::WOOD]); return std::to_string(val.tradeVolume[EGameResID::WOOD]);
} }
}, },
{ {
LIBRARY->generaltexth->translate("vcmi.statisticWindow.param.tradeVolume") + " - " + MetaString::createFromTextID(GameResID(EGameResID::MERCURY).toResource()->getNameTextID()).toString(), [this](PlayerColor color){ LIBRARY->generaltexth->translate("vcmi.statisticWindow.param.tradeVolume") + " - " + GameResID(EGameResID::MERCURY).toResource()->getNameTranslated(), [this](PlayerColor color){
auto val = playerDataFilter(color).back(); auto val = playerDataFilter(color).back();
return std::to_string(val.tradeVolume[EGameResID::MERCURY]); return std::to_string(val.tradeVolume[EGameResID::MERCURY]);
} }
}, },
{ {
LIBRARY->generaltexth->translate("vcmi.statisticWindow.param.tradeVolume") + " - " + MetaString::createFromTextID(GameResID(EGameResID::ORE).toResource()->getNameTextID()).toString(), [this](PlayerColor color){ LIBRARY->generaltexth->translate("vcmi.statisticWindow.param.tradeVolume") + " - " + GameResID(EGameResID::ORE).toResource()->getNameTranslated(), [this](PlayerColor color){
auto val = playerDataFilter(color).back(); auto val = playerDataFilter(color).back();
return std::to_string(val.tradeVolume[EGameResID::ORE]); return std::to_string(val.tradeVolume[EGameResID::ORE]);
} }
}, },
{ {
LIBRARY->generaltexth->translate("vcmi.statisticWindow.param.tradeVolume") + " - " + MetaString::createFromTextID(GameResID(EGameResID::SULFUR).toResource()->getNameTextID()).toString(), [this](PlayerColor color){ LIBRARY->generaltexth->translate("vcmi.statisticWindow.param.tradeVolume") + " - " + GameResID(EGameResID::SULFUR).toResource()->getNameTranslated(), [this](PlayerColor color){
auto val = playerDataFilter(color).back(); auto val = playerDataFilter(color).back();
return std::to_string(val.tradeVolume[EGameResID::SULFUR]); return std::to_string(val.tradeVolume[EGameResID::SULFUR]);
} }
}, },
{ {
LIBRARY->generaltexth->translate("vcmi.statisticWindow.param.tradeVolume") + " - " + MetaString::createFromTextID(GameResID(EGameResID::CRYSTAL).toResource()->getNameTextID()).toString(), [this](PlayerColor color){ LIBRARY->generaltexth->translate("vcmi.statisticWindow.param.tradeVolume") + " - " + GameResID(EGameResID::CRYSTAL).toResource()->getNameTranslated(), [this](PlayerColor color){
auto val = playerDataFilter(color).back(); auto val = playerDataFilter(color).back();
return std::to_string(val.tradeVolume[EGameResID::CRYSTAL]); return std::to_string(val.tradeVolume[EGameResID::CRYSTAL]);
} }
}, },
{ {
LIBRARY->generaltexth->translate("vcmi.statisticWindow.param.tradeVolume") + " - " + MetaString::createFromTextID(GameResID(EGameResID::GEMS).toResource()->getNameTextID()).toString(), [this](PlayerColor color){ LIBRARY->generaltexth->translate("vcmi.statisticWindow.param.tradeVolume") + " - " + GameResID(EGameResID::GEMS).toResource()->getNameTranslated(), [this](PlayerColor color){
auto val = playerDataFilter(color).back(); auto val = playerDataFilter(color).back();
return std::to_string(val.tradeVolume[EGameResID::GEMS]); return std::to_string(val.tradeVolume[EGameResID::GEMS]);
} }

View File

@@ -176,7 +176,7 @@ void CTradeableItem::hover(bool on)
ENGINE->statusbar()->write(LIBRARY->artifacts()->getByIndex(id)->getNameTranslated()); ENGINE->statusbar()->write(LIBRARY->artifacts()->getByIndex(id)->getNameTranslated());
break; break;
case EType::RESOURCE: case EType::RESOURCE:
ENGINE->statusbar()->write(MetaString::createFromTextID(GameResID(id).toResource()->getNameTextID()).toString()); ENGINE->statusbar()->write(GameResID(id).toResource()->getNameTranslated());
break; break;
case EType::PLAYER: case EType::PLAYER:
ENGINE->statusbar()->write(LIBRARY->generaltexth->capColors[id]); ENGINE->statusbar()->write(LIBRARY->generaltexth->capColors[id]);

View File

@@ -1127,7 +1127,7 @@ void CCastleBuildings::enterFountain(const BuildingID & building, BuildingSubID:
else //Mystic Pond produced something; else //Mystic Pond produced something;
{ {
descr += "\n\n" + hasProduced; descr += "\n\n" + hasProduced;
boost::algorithm::replace_first(descr,"%s",MetaString::createFromTextID(GameResID(town->bonusValue.first).toResource()->getNameTextID()).toString()); boost::algorithm::replace_first(descr,"%s",GameResID(town->bonusValue.first).toResource()->getNameTranslated());
boost::algorithm::replace_first(descr,"%d",std::to_string(town->bonusValue.second)); boost::algorithm::replace_first(descr,"%d",std::to_string(town->bonusValue.second));
} }
} }

View File

@@ -51,7 +51,7 @@ GameResID CGResource::resourceID() const
std::string CGResource::getHoverText(PlayerColor player) const std::string CGResource::getHoverText(PlayerColor player) const
{ {
return MetaString::createFromTextID(resourceID().toResource()->getNameTextID()).toString(); return resourceID().toResource()->getNameTranslated();
} }
void CGResource::pickRandomObject(IGameRandomizer & gameRandomizer) void CGResource::pickRandomObject(IGameRandomizer & gameRandomizer)

View File

@@ -165,7 +165,7 @@ std::string CGMine::getHoverText(PlayerColor player) const
std::string hoverName = CArmedInstance::getHoverText(player); std::string hoverName = CArmedInstance::getHoverText(player);
if (tempOwner != PlayerColor::NEUTRAL) if (tempOwner != PlayerColor::NEUTRAL)
hoverName += "\n(" + MetaString::createFromTextID(producedResource.toResource()->getNameTextID()).toString() + ")"; hoverName += "\n(" + producedResource.toResource()->getNameTranslated() + ")";
if(stacksCount()) if(stacksCount())
{ {

View File

@@ -35,7 +35,7 @@ MineSelector::MineSelector(std::map<TResource, ui16> & mines) :
ui->tableWidgetMines->setHorizontalHeaderLabels({tr("Resource"), tr("Mines")}); ui->tableWidgetMines->setHorizontalHeaderLabels({tr("Resource"), tr("Mines")});
for (int row = 0; row < resourcesToShow.size(); ++row) for (int row = 0; row < resourcesToShow.size(); ++row)
{ {
auto name = MetaString::createFromTextID(resourcesToShow[row].toResource()->getNameTextID()).toString(); auto name = resourcesToShow[row].toResource()->getNameTranslated();
auto label = new QLabel(QString::fromStdString(name)); auto label = new QLabel(QString::fromStdString(name));
label->setAlignment(Qt::AlignCenter); label->setAlignment(Qt::AlignCenter);
ui->tableWidgetMines->setCellWidget(row, 0, label); ui->tableWidgetMines->setCellWidget(row, 0, label);