diff --git a/mapeditor/mainwindow.cpp b/mapeditor/mainwindow.cpp index f1c4f9f5b..156bcdeb4 100644 --- a/mapeditor/mainwindow.cpp +++ b/mapeditor/mainwindow.cpp @@ -249,7 +249,7 @@ bool MainWindow::getAnswerAboutUnsavedChanges() { if(unsaved) { - auto sure = QMessageBox::question(this, "Confirmation", "Unsaved changes will be lost, are you sure?"); + auto sure = QMessageBox::question(this, tr("Confirmation"), tr("Unsaved changes will be lost, are you sure?")); if(sure == QMessageBox::No) { return false; @@ -326,7 +326,7 @@ bool MainWindow::openMap(const QString & filenameSelect) if(!CResourceHandler::get("mapEditor")->existsResource(resId)) { - QMessageBox::warning(this, "Failed to open map", "Cannot open map from this folder"); + QMessageBox::warning(this, tr("Failed to open map"), tr("Cannot open map from this folder")); return false; } @@ -1125,11 +1125,11 @@ void MainWindow::on_actionUpdate_appearance_triggered() if(controller.scene(mapLevel)->selectionObjectsView.getSelection().empty()) { - QMessageBox::information(this, "Update appearance", "No objects selected"); + QMessageBox::information(this, tr("Update appearance"), tr("No objects selected")); return; } - if(QMessageBox::Yes != QMessageBox::question(this, "Update appearance", "This operation is irreversible. Do you want to continue?")) + if(QMessageBox::Yes != QMessageBox::question(this, tr("Update appearance"), tr("This operation is irreversible. Do you want to continue?"))) return; controller.scene(mapLevel)->selectionTerrainView.clear(); @@ -1188,7 +1188,7 @@ void MainWindow::on_actionUpdate_appearance_triggered() if(errors) - QMessageBox::warning(this, "Update appearance", QString("Errors occured. %1 objects were not updated").arg(errors)); + QMessageBox::warning(this, tr("Update appearance"), QString(tr("Errors occured. %1 objects were not updated")).arg(errors)); } @@ -1228,7 +1228,7 @@ void MainWindow::on_actionPaste_triggered() void MainWindow::on_actionExport_triggered() { - QString fileName = QFileDialog::getSaveFileName(this, "Save to image", QCoreApplication::applicationDirPath(), "BMP (*.bmp);;JPEG (*.jpeg);;PNG (*.png)"); + QString fileName = QFileDialog::getSaveFileName(this, tr("Save to image"), QCoreApplication::applicationDirPath(), "BMP (*.bmp);;JPEG (*.jpeg);;PNG (*.png)"); if(!fileName.isNull()) { QImage image(ui->mapView->scene()->sceneRect().size().toSize(), QImage::Format_RGB888); diff --git a/mapeditor/mapview.cpp b/mapeditor/mapview.cpp index af7bffe35..87775258a 100644 --- a/mapeditor/mapview.cpp +++ b/mapeditor/mapview.cpp @@ -468,7 +468,7 @@ void MapView::dropEvent(QDropEvent * event) else { controller->discardObject(sc->level); - QMessageBox::information(this, "Can't place object", errorMsg); + QMessageBox::information(this, tr("Can't place object"), errorMsg); } } diff --git a/mapeditor/validator.cpp b/mapeditor/validator.cpp index 9091da7ef..d1ded12b0 100644 --- a/mapeditor/validator.cpp +++ b/mapeditor/validator.cpp @@ -47,7 +47,7 @@ std::list Validator::validate(const CMap * map) if(!map) { - issues.emplace_back("Map is not loaded", true); + issues.emplace_back(tr("Map is not loaded"), true); return issues; } @@ -67,14 +67,14 @@ std::list Validator::validate(const CMap * map) if(p.canHumanPlay) ++hplayers; if(p.allowedFactions.empty()) - issues.emplace_back(QString("No factions allowed for player %1").arg(i), true); + issues.emplace_back(QString(tr("No factions allowed for player %1")).arg(i), true); } if(hplayers + cplayers == 0) - issues.emplace_back("No players allowed to play this map", true); + issues.emplace_back(tr("No players allowed to play this map"), true); if(hplayers + cplayers == 1) - issues.emplace_back("Map is allowed for one player and cannot be started", true); + issues.emplace_back(tr("Map is allowed for one player and cannot be started"), true); if(!hplayers) - issues.emplace_back("No human players allowed to play this map", true); + issues.emplace_back(tr("No human players allowed to play this map"), true); std::set allHeroesOnMap; //used to find hero duplicated @@ -90,13 +90,13 @@ std::list Validator::validate(const CMap * map) dynamic_cast(o.get()) || dynamic_cast(o.get())) { - issues.emplace_back(QString("Armored instance %1 is UNFLAGGABLE but must have NEUTRAL or player owner").arg(o->instanceName.c_str()), true); + issues.emplace_back(QString(tr("Armored instance %1 is UNFLAGGABLE but must have NEUTRAL or player owner")).arg(o->instanceName.c_str()), true); } } if(o->getOwner() != PlayerColor::NEUTRAL && o->getOwner().getNum() < map->players.size()) { if(!map->players[o->getOwner().getNum()].canAnyonePlay()) - issues.emplace_back(QString("Object %1 is assigned to non-playable player %2").arg(o->instanceName.c_str(), o->getOwner().getStr().c_str()), true); + issues.emplace_back(QString(tr("Object %1 is assigned to non-playable player %2")).arg(o->instanceName.c_str(), o->getOwner().getStr().c_str()), true); } //checking towns if(auto * ins = dynamic_cast(o.get())) @@ -113,24 +113,24 @@ std::list Validator::validate(const CMap * map) if(ins->ID == Obj::PRISON) { if(ins->getOwner() != PlayerColor::NEUTRAL) - issues.emplace_back(QString("Prison %1 must be a NEUTRAL").arg(ins->instanceName.c_str()), true); + issues.emplace_back(QString(tr("Prison %1 must be a NEUTRAL")).arg(ins->instanceName.c_str()), true); } else { bool has = amountOfCastles.count(ins->getOwner().getNum()); if(!has) - issues.emplace_back(QString("Hero %1 must have an owner").arg(ins->instanceName.c_str()), true); + issues.emplace_back(QString(tr("Hero %1 must have an owner")).arg(ins->instanceName.c_str()), true); } if(ins->type) { if(!map->allowedHeroes[ins->type->getId().getNum()]) - issues.emplace_back(QString("Hero %1 is prohibited by map settings").arg(ins->type->getNameTranslated().c_str()), false); + issues.emplace_back(QString(tr("Hero %1 is prohibited by map settings")).arg(ins->type->getNameTranslated().c_str()), false); if(!allHeroesOnMap.insert(ins->type).second) - issues.emplace_back(QString("Hero %1 has duplicate on map").arg(ins->type->getNameTranslated().c_str()), false); + issues.emplace_back(QString(tr("Hero %1 has duplicate on map")).arg(ins->type->getNameTranslated().c_str()), false); } else - issues.emplace_back(QString("Hero %1 has an empty type and must be removed").arg(ins->instanceName.c_str()), true); + issues.emplace_back(QString(tr("Hero %1 has an empty type and must be removed")).arg(ins->instanceName.c_str()), true); } //checking for arts @@ -141,16 +141,16 @@ std::list Validator::validate(const CMap * map) if(ins->storedArtifact) { if(!map->allowedSpells[ins->storedArtifact->getId().getNum()]) - issues.emplace_back(QString("Spell scroll %1 is prohibited by map settings").arg(ins->getObjectName().c_str()), false); + issues.emplace_back(QString(tr("Spell scroll %1 is prohibited by map settings")).arg(ins->getObjectName().c_str()), false); } else - issues.emplace_back(QString("Spell scroll %1 doesn't have instance assigned and must be removed").arg(ins->instanceName.c_str()), true); + issues.emplace_back(QString(tr("Spell scroll %1 doesn't have instance assigned and must be removed")).arg(ins->instanceName.c_str()), true); } else { if(ins->ID == Obj::ARTIFACT && !map->allowedArtifact[ins->subID]) { - issues.emplace_back(QString("Artifact %1 is prohibited by map settings").arg(ins->getObjectName().c_str()), false); + issues.emplace_back(QString(tr("Artifact %1 is prohibited by map settings")).arg(ins->getObjectName().c_str()), false); } } } @@ -159,30 +159,30 @@ std::list Validator::validate(const CMap * map) //verification of starting towns for(auto & mp : amountOfCastles) if(mp.second == 0) - issues.emplace_back(QString("Player %1 doesn't have any starting town").arg(mp.first), false); + issues.emplace_back(QString(tr("Player %1 doesn't have any starting town")).arg(mp.first), false); //verification of map name and description if(map->name.empty()) - issues.emplace_back("Map name is not specified", false); + issues.emplace_back(tr("Map name is not specified"), false); if(map->description.empty()) - issues.emplace_back("Map description is not specified", false); + issues.emplace_back(tr("Map description is not specified"), false); //verificationfor mods for(auto & mod : MapController::modAssessmentMap(*map)) { if(!map->mods.count(mod.first)) { - issues.emplace_back(QString("Map contains object from mod \"%1\", but doesn't require it").arg(QString::fromStdString(VLC->modh->getModInfo(mod.first).name)), true); + issues.emplace_back(QString(tr("Map contains object from mod \"%1\", but doesn't require it")).arg(QString::fromStdString(VLC->modh->getModInfo(mod.first).name)), true); } } } catch(const std::exception & e) { - issues.emplace_back(QString("Exception occurs during validation: %1").arg(e.what()), true); + issues.emplace_back(QString(tr("Exception occurs during validation: %1")).arg(e.what()), true); } catch(...) { - issues.emplace_back("Unknown exception occurs during validation", true); + issues.emplace_back(tr("Unknown exception occurs during validation"), true); } return issues; diff --git a/mapeditor/windownewmap.cpp b/mapeditor/windownewmap.cpp index 0ebe8d806..6fdd404b8 100644 --- a/mapeditor/windownewmap.cpp +++ b/mapeditor/windownewmap.cpp @@ -268,7 +268,7 @@ void WindowNewMap::on_okButton_clicked() //verify map template if(mapGenOptions.getPossibleTemplates().empty()) { - QMessageBox::warning(this, "No template", "No template for parameters scecified. Random map cannot be generated."); + QMessageBox::warning(this, tr("No template"), tr("No template for parameters scecified. Random map cannot be generated.")); return; } @@ -288,7 +288,7 @@ void WindowNewMap::on_okButton_clicked() } catch(const std::exception & e) { - QMessageBox::critical(this, "RMG failure", e.what()); + QMessageBox::critical(this, tr("RMG failure"), e.what()); } } else