forked from qt-creator/qt-creator
Python: Fix translatable string
Word arithmetic does not work across languages. Provide explicit strings for the combinations. Change-Id: I95399f5d528405971d630a464e67a89766351162 Reviewed-by: David Schulz <david.schulz@qt.io> Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
This commit is contained in:
@@ -66,21 +66,16 @@ void PipInstallTask::run()
|
|||||||
emit finished(false);
|
emit finished(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
QString operation = Tr::tr("Install");
|
|
||||||
QString operant;
|
|
||||||
QStringList arguments = {"-m", "pip", "install"};
|
QStringList arguments = {"-m", "pip", "install"};
|
||||||
if (!m_requirementsFile.isEmpty()) {
|
if (!m_requirementsFile.isEmpty()) {
|
||||||
operant = Tr::tr("Requirements");
|
|
||||||
arguments << "-r" << m_requirementsFile.toString();
|
arguments << "-r" << m_requirementsFile.toString();
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
for (const PipPackage &package : m_packages) {
|
for (const PipPackage &package : m_packages) {
|
||||||
QString pipPackage = package.packageName;
|
QString pipPackage = package.packageName;
|
||||||
if (!package.version.isEmpty())
|
if (!package.version.isEmpty())
|
||||||
pipPackage += "==" + package.version;
|
pipPackage += "==" + package.version;
|
||||||
arguments << pipPackage;
|
arguments << pipPackage;
|
||||||
}
|
}
|
||||||
operant = m_packages.count() == 1 ? m_packages.first().displayName : Tr::tr("Packages");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!m_targetPath.isEmpty()) {
|
if (!m_targetPath.isEmpty()) {
|
||||||
@@ -90,17 +85,27 @@ void PipInstallTask::run()
|
|||||||
arguments << "--user"; // add --user to global pythons, but skip it for venv pythons
|
arguments << "--user"; // add --user to global pythons, but skip it for venv pythons
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_upgrade) {
|
if (m_upgrade)
|
||||||
arguments << "--upgrade";
|
arguments << "--upgrade";
|
||||||
operation = Tr::tr("Update");
|
|
||||||
|
QString operation;
|
||||||
|
if (!m_requirementsFile.isEmpty()) {
|
||||||
|
operation = m_upgrade ? Tr::tr("Update Requirements") : Tr::tr("Install Requirements");
|
||||||
|
} else if (m_packages.count() == 1) {
|
||||||
|
//: %1 = package name
|
||||||
|
operation = m_upgrade ? Tr::tr("Update %1")
|
||||||
|
//: %1 = package name
|
||||||
|
: Tr::tr("Install %1");
|
||||||
|
operation = operation.arg(m_packages.first().displayName);
|
||||||
|
} else {
|
||||||
|
operation = m_upgrade ? Tr::tr("Update Packages") : Tr::tr("Install Packages");
|
||||||
}
|
}
|
||||||
|
|
||||||
m_process.setCommand({m_python, arguments});
|
m_process.setCommand({m_python, arguments});
|
||||||
m_process.setTerminalMode(m_silent ? TerminalMode::Off : TerminalMode::Run);
|
m_process.setTerminalMode(m_silent ? TerminalMode::Off : TerminalMode::Run);
|
||||||
m_process.start();
|
m_process.start();
|
||||||
|
|
||||||
const QString taskTitle = Tr::tr("%1 %2").arg(operation).arg(operant);
|
Core::ProgressManager::addTask(m_future.future(), operation, pipInstallTaskId);
|
||||||
Core::ProgressManager::addTask(m_future.future(), taskTitle, pipInstallTaskId);
|
|
||||||
Core::MessageManager::writeSilently(
|
Core::MessageManager::writeSilently(
|
||||||
Tr::tr("Running \"%1\" to install %2.")
|
Tr::tr("Running \"%1\" to install %2.")
|
||||||
.arg(m_process.commandLine().toUserOutput(), packagesDisplayName()));
|
.arg(m_process.commandLine().toUserOutput(), packagesDisplayName()));
|
||||||
|
Reference in New Issue
Block a user