浏览代码

simplified translation

Laserlicht 1 月之前
父节点
当前提交
4e8556ef64

+ 12 - 12
client/mainmenu/CStatisticScreen.cpp

@@ -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};
 			std::vector<std::string> resourceText;
 			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)
 			{
@@ -170,7 +170,7 @@ std::shared_ptr<CIntObject> CStatisticScreen::getContent(Content c, EGameResID r
 	
 	case CHART_RESOURCES:
 		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:
 		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:
 		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:
 		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:
 		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:
 		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:
 		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();
 				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();
 				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();
 				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();
 				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();
 				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();
 				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();
 				return std::to_string(val.tradeVolume[EGameResID::GEMS]);
 			}

+ 1 - 1
client/widgets/markets/TradePanels.cpp

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

+ 1 - 1
client/windows/CCastleInterface.cpp

@@ -1127,7 +1127,7 @@ void CCastleBuildings::enterFountain(const BuildingID & building, BuildingSubID:
 		else //Mystic Pond produced something;
 		{
 			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));
 		}
 	}

+ 1 - 1
lib/mapObjects/CGResource.cpp

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

+ 1 - 1
lib/mapObjects/MiscObjects.cpp

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

+ 1 - 1
mapeditor/templateeditor/mineselector.cpp

@@ -35,7 +35,7 @@ MineSelector::MineSelector(std::map<TResource, ui16> & mines) :
 	ui->tableWidgetMines->setHorizontalHeaderLabels({tr("Resource"), tr("Mines")});
 	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));
 		label->setAlignment(Qt::AlignCenter);
 		ui->tableWidgetMines->setCellWidget(row, 0, label);