updated original string format, for adapting multi-language

This commit is contained in:
ronoaer 2023-10-05 13:26:11 +08:00
parent 79d371fb76
commit 08defbbbd8
8 changed files with 140 additions and 145 deletions

View file

@ -64,7 +64,7 @@ void SitesController::addSite(QString hostname)
QHostInfo::lookupHost(hostname, this, resolveCallback);
}
emit finished(tr("New site added: ") + hostname);
emit finished(tr("New site added: %1").arg(hostname));
}
void SitesController::removeSite(int index)
@ -77,7 +77,7 @@ void SitesController::removeSite(int index)
Q_ARG(QStringList, QStringList() << hostname));
QMetaObject::invokeMethod(m_vpnConnection.get(), "flushDns", Qt::QueuedConnection);
emit finished(tr("Site removed: ") + hostname);
emit finished(tr("Site removed: %1").arg(hostname));
}
void SitesController::importSites(const QString &fileName, bool replaceExisting)
@ -85,19 +85,19 @@ void SitesController::importSites(const QString &fileName, bool replaceExisting)
QFile file(fileName);
if (!file.open(QIODevice::ReadOnly)) {
emit errorOccurred(tr("Can't open file: ") + fileName);
emit errorOccurred(tr("Can't open file: %1").arg(fileName));
return;
}
QByteArray jsonData = file.readAll();
QJsonDocument jsonDocument = QJsonDocument::fromJson(jsonData);
if (jsonDocument.isNull()) {
emit errorOccurred(tr("Failed to parse JSON data from file: ") + fileName);
emit errorOccurred(tr("Failed to parse JSON data from file: %1").arg(fileName));
return;
}
if (!jsonDocument.isArray()) {
emit errorOccurred(tr("The JSON data is not an array in file: ") + fileName);
emit errorOccurred(tr("The JSON data is not an array in file: ").arg(fileName));
return;
}