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);
|
||||
return;
|
||||
}
|
||||
QString operation = Tr::tr("Install");
|
||||
QString operant;
|
||||
QStringList arguments = {"-m", "pip", "install"};
|
||||
if (!m_requirementsFile.isEmpty()) {
|
||||
operant = Tr::tr("Requirements");
|
||||
arguments << "-r" << m_requirementsFile.toString();
|
||||
} else {
|
||||
|
||||
for (const PipPackage &package : m_packages) {
|
||||
QString pipPackage = package.packageName;
|
||||
if (!package.version.isEmpty())
|
||||
pipPackage += "==" + package.version;
|
||||
arguments << pipPackage;
|
||||
}
|
||||
operant = m_packages.count() == 1 ? m_packages.first().displayName : Tr::tr("Packages");
|
||||
}
|
||||
|
||||
if (!m_targetPath.isEmpty()) {
|
||||
@@ -90,17 +85,27 @@ void PipInstallTask::run()
|
||||
arguments << "--user"; // add --user to global pythons, but skip it for venv pythons
|
||||
}
|
||||
|
||||
if (m_upgrade) {
|
||||
if (m_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.setTerminalMode(m_silent ? TerminalMode::Off : TerminalMode::Run);
|
||||
m_process.start();
|
||||
|
||||
const QString taskTitle = Tr::tr("%1 %2").arg(operation).arg(operant);
|
||||
Core::ProgressManager::addTask(m_future.future(), taskTitle, pipInstallTaskId);
|
||||
Core::ProgressManager::addTask(m_future.future(), operation, pipInstallTaskId);
|
||||
Core::MessageManager::writeSilently(
|
||||
Tr::tr("Running \"%1\" to install %2.")
|
||||
.arg(m_process.commandLine().toUserOutput(), packagesDisplayName()));
|
||||
|
Reference in New Issue
Block a user