mirror of
https://github.com/parchlinux/calamares.git
synced 2025-06-26 17:05:36 -04:00
i18n: avoid translation tricks, use QCoreApplication::translate
Instead of using tr and some macro hacks to get lupdate to recognize the translation, instead use QCoreApplication::translate() which takes its own context for translation.
This commit is contained in:
parent
d3b5189d06
commit
f954496acf
2 changed files with 66 additions and 81 deletions
|
@ -23,6 +23,7 @@
|
|||
#include "JobQueue.h"
|
||||
#include "GlobalStorage.h"
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <QDir>
|
||||
#include <QProcess>
|
||||
#include <QRegularExpression>
|
||||
|
@ -253,44 +254,44 @@ System::doChroot() const
|
|||
Calamares::JobResult
|
||||
ProcessResult::explainProcess( const QObject* parent, int ec, const QString& command, const QString& output, int timeout )
|
||||
{
|
||||
#define tr parent->tr
|
||||
using Calamares::JobResult;
|
||||
|
||||
if ( ec == 0 )
|
||||
return JobResult::ok();
|
||||
|
||||
QString outputMessage = output.isEmpty() ? QStringLiteral("\nThere was no output from the command.")
|
||||
: (tr("\nOutput:\n") + output);
|
||||
QString outputMessage = output.isEmpty()
|
||||
? QCoreApplication::translate( "ProcessResult", "\nThere was no output from the command.")
|
||||
: (QCoreApplication::translate( "ProcessResult", "\nOutput:\n") + output);
|
||||
|
||||
if ( ec == -1 ) //Crash!
|
||||
return JobResult::error( tr( "External command crashed." ),
|
||||
tr( "Command <i>%1</i> crashed." )
|
||||
return JobResult::error( QCoreApplication::translate( "ProcessResult", "External command crashed." ),
|
||||
QCoreApplication::translate( "ProcessResult", "Command <i>%1</i> crashed." )
|
||||
.arg( command )
|
||||
+ outputMessage );
|
||||
|
||||
if ( ec == -2 )
|
||||
return JobResult::error( tr( "External command failed to start." ),
|
||||
tr( "Command <i>%1</i> failed to start." )
|
||||
return JobResult::error( QCoreApplication::translate( "ProcessResult", "External command failed to start." ),
|
||||
QCoreApplication::translate( "ProcessResult", "Command <i>%1</i> failed to start." )
|
||||
.arg( command ) );
|
||||
|
||||
if ( ec == -3 )
|
||||
return JobResult::error( tr( "Internal error when starting command." ),
|
||||
tr( "Bad parameters for process job call." ) );
|
||||
return JobResult::error( QCoreApplication::translate( "ProcessResult", "Internal error when starting command." ),
|
||||
QCoreApplication::translate( "ProcessResult", "Bad parameters for process job call." ) );
|
||||
|
||||
if ( ec == -4 )
|
||||
return JobResult::error( tr( "External command failed to finish." ),
|
||||
tr( "Command <i>%1</i> failed to finish in %2 seconds." )
|
||||
return JobResult::error( QCoreApplication::translate( "ProcessResult", "External command failed to finish." ),
|
||||
QCoreApplication::translate( "ProcessResult", "Command <i>%1</i> failed to finish in %2 seconds." )
|
||||
.arg( command )
|
||||
.arg( timeout )
|
||||
+ outputMessage );
|
||||
|
||||
//Any other exit code
|
||||
return JobResult::error( tr( "External command finished with errors." ),
|
||||
tr( "Command <i>%1</i> finished with exit code %2." )
|
||||
return JobResult::error( QCoreApplication::translate( "ProcessResult", "External command finished with errors." ),
|
||||
QCoreApplication::translate( "ProcessResult", "Command <i>%1</i> finished with exit code %2." )
|
||||
.arg( command )
|
||||
.arg( ec )
|
||||
+ outputMessage );
|
||||
#undef tr
|
||||
#undef trIndirect
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue