mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
Added missing strings to Qt translations
This commit is contained in:
parent
45e35f357d
commit
09a233acba
@ -301,7 +301,7 @@ void FirstLaunchView::extractGogData()
|
||||
QString titleSel = tr("Select %1 file...", "param is file extension").arg(filter);
|
||||
QString titleErr = tr("You have to select %1 file!", "param is file extension").arg(filter);
|
||||
#if defined(VCMI_MOBILE)
|
||||
filter = "GOG file (*.*)";
|
||||
filter = tr("GOG file (*.*)");
|
||||
QMessageBox::information(this, tr("File selection"), titleSel);
|
||||
#endif
|
||||
QString file = QFileDialog::getOpenFileName(this, titleSel, startPath.isEmpty() ? QDir::homePath() : startPath, filter);
|
||||
|
@ -17,14 +17,20 @@
|
||||
|
||||
QString CModEntry::sizeToString(double size)
|
||||
{
|
||||
static const std::array<QString, 5> sizes { "%1 B", "%1 KiB", "%1 MiB", "%1 GiB", "%1 TiB" };
|
||||
static const std::array sizes {
|
||||
QT_TRANSLATE_NOOP("File size", "%1 B"),
|
||||
QT_TRANSLATE_NOOP("File size", "%1 KiB"),
|
||||
QT_TRANSLATE_NOOP("File size", "%1 MiB"),
|
||||
QT_TRANSLATE_NOOP("File size", "%1 GiB"),
|
||||
QT_TRANSLATE_NOOP("File size", "%1 TiB")
|
||||
};
|
||||
size_t index = 0;
|
||||
while(size > 1024 && index < sizes.size())
|
||||
{
|
||||
size /= 1024;
|
||||
index++;
|
||||
}
|
||||
return sizes[index].arg(QString::number(size, 'f', 1));
|
||||
return QCoreApplication::translate("File size", sizes[index]).arg(QString::number(size, 'f', 1));
|
||||
}
|
||||
|
||||
CModEntry::CModEntry(QVariantMap repository, QVariantMap localData, QVariantMap modSettings, QString modname)
|
||||
|
@ -169,15 +169,15 @@ QVariant CModListModel::headerData(int section, Qt::Orientation orientation, int
|
||||
{
|
||||
static const QString header[ModFields::COUNT] =
|
||||
{
|
||||
QT_TR_NOOP("Name"),
|
||||
QT_TR_NOOP(""), // status icon
|
||||
QT_TR_NOOP(""), // status icon
|
||||
QT_TR_NOOP("Type"),
|
||||
QT_TR_NOOP("Version"),
|
||||
QT_TRANSLATE_NOOP("ModFields", "Name"),
|
||||
QT_TRANSLATE_NOOP("ModFields", ""), // status icon
|
||||
QT_TRANSLATE_NOOP("ModFields", ""), // status icon
|
||||
QT_TRANSLATE_NOOP("ModFields", "Type"),
|
||||
QT_TRANSLATE_NOOP("ModFields", "Version"),
|
||||
};
|
||||
|
||||
if(role == Qt::DisplayRole && orientation == Qt::Horizontal)
|
||||
return QCoreApplication::translate("ModFields", header[section].toStdString().c_str());
|
||||
return QCoreApplication::translate("ModFields", header[section].toStdString().c_str()); // !!!
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
|
@ -307,9 +307,9 @@ QString CModListView::genModInfoText(CModEntry & mod)
|
||||
if(minStr.isEmpty() || maxStr.isEmpty())
|
||||
{
|
||||
if(minStr.isEmpty())
|
||||
result += supportedVersions.arg(tr("Supported VCMI version"), maxStr, ", ", "please upgrade mod");
|
||||
result += supportedVersions.arg(tr("Supported VCMI version"), maxStr, ", ", tr("please upgrade mod"));
|
||||
else
|
||||
result += supportedVersions.arg(tr("Required VCMI version"), minStr, " ", "or above");
|
||||
result += supportedVersions.arg(tr("Required VCMI version"), minStr, " ", tr("or above"));
|
||||
}
|
||||
else
|
||||
result += supportedVersions.arg(tr("Supported VCMI versions"), minStr, " - ", maxStr);
|
||||
@ -574,7 +574,7 @@ void CModListView::on_updateButton_clicked()
|
||||
auto mod = modModel->getMod(name);
|
||||
// update required mod, install missing (can be new dependency)
|
||||
if(mod.isUpdateable() || !mod.isInstalled())
|
||||
downloadFile(name + ".zip", mod.getValue("download").toString(), "mods", mbToBytes(mod.getValue("downloadSize").toDouble()));
|
||||
downloadFile(name + ".zip", mod.getValue("download").toString(), name, mbToBytes(mod.getValue("downloadSize").toDouble()));
|
||||
}
|
||||
}
|
||||
|
||||
@ -604,7 +604,7 @@ void CModListView::on_installButton_clicked()
|
||||
{
|
||||
auto mod = modModel->getMod(name);
|
||||
if(!mod.isInstalled())
|
||||
downloadFile(name + ".zip", mod.getValue("download").toString(), "mods", mbToBytes(mod.getValue("downloadSize").toDouble()));
|
||||
downloadFile(name + ".zip", mod.getValue("download").toString(), name, mbToBytes(mod.getValue("downloadSize").toDouble()));
|
||||
else if(!mod.isEnabled())
|
||||
enableModByName(name);
|
||||
}
|
||||
@ -669,7 +669,7 @@ void CModListView::manualInstallFile(QUrl url)
|
||||
}
|
||||
}
|
||||
else
|
||||
downloadFile(fileName, urlStr, "mods", 0);
|
||||
downloadFile(fileName, urlStr, fileName, 0);
|
||||
}
|
||||
|
||||
void CModListView::downloadFile(QString file, QString url, QString description, qint64 size)
|
||||
@ -793,7 +793,7 @@ void CModListView::installFiles(QStringList files)
|
||||
auto modjson = repoData[key].toMap().value("mod");
|
||||
if(!modjson.isNull())
|
||||
{
|
||||
downloadFile(key + ".json", modjson.toString(), "repository index");
|
||||
downloadFile(key + ".json", modjson.toString(), tr("repository index"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -957,7 +957,7 @@ void CModListView::loadScreenshots()
|
||||
if(pixmap.isNull())
|
||||
{
|
||||
// image file not exists or corrupted - try to redownload
|
||||
downloadFile(fileName, url, "screenshots");
|
||||
downloadFile(fileName, url, tr("screenshots"));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -994,7 +994,7 @@ void CModListView::doInstallMod(const QString & modName)
|
||||
{
|
||||
auto mod = modModel->getMod(name);
|
||||
if(!mod.isInstalled())
|
||||
downloadFile(name + ".zip", mod.getValue("download").toString(), "mods", mbToBytes(mod.getValue("downloadSize").toDouble()));
|
||||
downloadFile(name + ".zip", mod.getValue("download").toString(), name, mbToBytes(mod.getValue("downloadSize").toDouble()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -157,10 +157,10 @@ bool CModManager::canInstallMod(QString modname)
|
||||
auto mod = modList->getMod(modname);
|
||||
|
||||
if(mod.isSubmod())
|
||||
return addError(modname, "Can not install submod");
|
||||
return addError(modname, tr("Can not install submod"));
|
||||
|
||||
if(mod.isInstalled())
|
||||
return addError(modname, "Mod is already installed");
|
||||
return addError(modname, tr("Mod is already installed"));
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -169,10 +169,10 @@ bool CModManager::canUninstallMod(QString modname)
|
||||
auto mod = modList->getMod(modname);
|
||||
|
||||
if(mod.isSubmod())
|
||||
return addError(modname, "Can not uninstall submod");
|
||||
return addError(modname, tr("Can not uninstall submod"));
|
||||
|
||||
if(!mod.isInstalled())
|
||||
return addError(modname, "Mod is not installed");
|
||||
return addError(modname, tr("Mod is not installed"));
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -182,24 +182,24 @@ bool CModManager::canEnableMod(QString modname)
|
||||
auto mod = modList->getMod(modname);
|
||||
|
||||
if(mod.isEnabled())
|
||||
return addError(modname, "Mod is already enabled");
|
||||
return addError(modname, tr("Mod is already enabled"));
|
||||
|
||||
if(!mod.isInstalled())
|
||||
return addError(modname, "Mod must be installed first");
|
||||
return addError(modname, tr("Mod must be installed first"));
|
||||
|
||||
//check for compatibility
|
||||
if(!mod.isCompatible())
|
||||
return addError(modname, "Mod is not compatible, please update VCMI and checkout latest mod revisions");
|
||||
return addError(modname, tr("Mod is not compatible, please update VCMI and checkout latest mod revisions"));
|
||||
|
||||
for(auto modEntry : mod.getDependencies())
|
||||
{
|
||||
if(!modList->hasMod(modEntry)) // required mod is not available
|
||||
return addError(modname, QString("Required mod %1 is missing").arg(modEntry));
|
||||
return addError(modname, tr("Required mod %1 is missing").arg(modEntry));
|
||||
|
||||
CModEntry modData = modList->getMod(modEntry);
|
||||
|
||||
if(!modData.isCompatibilityPatch() && !modData.isEnabled())
|
||||
return addError(modname, QString("Required mod %1 is not enabled").arg(modEntry));
|
||||
return addError(modname, tr("Required mod %1 is not enabled").arg(modEntry));
|
||||
}
|
||||
|
||||
for(QString modEntry : modList->getModList())
|
||||
@ -208,14 +208,14 @@ bool CModManager::canEnableMod(QString modname)
|
||||
|
||||
// "reverse conflict" - enabled mod has this one as conflict
|
||||
if(mod.isEnabled() && mod.getConflicts().contains(modname))
|
||||
return addError(modname, QString("This mod conflicts with %1").arg(modEntry));
|
||||
return addError(modname, tr("This mod conflicts with %1").arg(modEntry));
|
||||
}
|
||||
|
||||
for(auto modEntry : mod.getConflicts())
|
||||
{
|
||||
// check if conflicting mod installed and enabled
|
||||
if(modList->hasMod(modEntry) && modList->getMod(modEntry).isEnabled())
|
||||
return addError(modname, QString("This mod conflicts with %1").arg(modEntry));
|
||||
return addError(modname, tr("This mod conflicts with %1").arg(modEntry));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -225,17 +225,17 @@ bool CModManager::canDisableMod(QString modname)
|
||||
auto mod = modList->getMod(modname);
|
||||
|
||||
if(mod.isDisabled())
|
||||
return addError(modname, "Mod is already disabled");
|
||||
return addError(modname, tr("Mod is already disabled"));
|
||||
|
||||
if(!mod.isInstalled())
|
||||
return addError(modname, "Mod must be installed first");
|
||||
return addError(modname, tr("Mod must be installed first"));
|
||||
|
||||
for(QString modEntry : modList->getModList())
|
||||
{
|
||||
auto current = modList->getMod(modEntry);
|
||||
|
||||
if(current.getDependencies().contains(modname) && current.isEnabled())
|
||||
return addError(modname, QString("This mod is needed to run %1").arg(modEntry));
|
||||
return addError(modname, tr("This mod is needed to run %1").arg(modEntry));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -311,7 +311,7 @@ bool CModManager::doInstallMod(QString modname, QString archivePath)
|
||||
if(!futureExtract.get())
|
||||
{
|
||||
removeModDir(destDir + modDirName);
|
||||
return addError(modname, "Failed to extract mod data");
|
||||
return addError(modname, tr("Failed to extract mod data"));
|
||||
}
|
||||
|
||||
//rename folder and fix the path
|
||||
@ -339,11 +339,11 @@ bool CModManager::doUninstallMod(QString modname)
|
||||
QString modDir = pathToQString(*CResourceHandler::get()->getResourceName(resID));
|
||||
|
||||
if(!QDir(modDir).exists())
|
||||
return addError(modname, "Data with this mod was not found");
|
||||
return addError(modname, tr("Data with this mod was not found"));
|
||||
|
||||
QDir modFullDir(modDir);
|
||||
if(!removeModDir(modDir))
|
||||
return addError(modname, "Mod is located in protected directory, please remove it manually:\n" + modFullDir.absolutePath());
|
||||
return addError(modname, tr("Mod is located in protected directory, please remove it manually:\n") + modFullDir.absolutePath());
|
||||
|
||||
CResourceHandler::get("initial")->updateFilteredFiles([](const std::string &){ return true; });
|
||||
loadMods();
|
||||
|
@ -61,7 +61,7 @@ UpdateDialog::UpdateDialog(bool calledManually, QWidget *parent):
|
||||
if(response->error() != QNetworkReply::NoError)
|
||||
{
|
||||
ui->versionLabel->setStyleSheet("QLabel { background-color : red; color : black; }");
|
||||
ui->versionLabel->setText("Network error");
|
||||
ui->versionLabel->setText(tr("Network error"));
|
||||
ui->plainTextEdit->setPlainText(response->errorString());
|
||||
return;
|
||||
}
|
||||
@ -98,7 +98,7 @@ void UpdateDialog::loadFromJson(const JsonNode & node)
|
||||
node["changeLog"].getType() != JsonNode::JsonType::DATA_STRING ||
|
||||
node["downloadLinks"].getType() != JsonNode::JsonType::DATA_STRUCT) //we need at least one link - other are optional
|
||||
{
|
||||
ui->plainTextEdit->setPlainText("Cannot read JSON from url or incorrect JSON data");
|
||||
ui->plainTextEdit->setPlainText(tr("Cannot read JSON from url or incorrect JSON data"));
|
||||
return;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user