From 8c0fa11803587b661957da713b29c2ebb2282a46 Mon Sep 17 00:00:00 2001 From: lordmulder Date: Sun, 2 Jan 2011 01:09:05 +0100 Subject: [PATCH] make more strings translatable + try to load a default translation that suits the user's system language --- LameXP.vcproj | 40 +++++++++++++++++++++++++++++++--- etc/Deployment/_deploy.bat | 6 ++++++ res/flags/en.png | Bin 0 -> 599 bytes src/Config.h | 2 +- src/Dialog_About.cpp | 6 +++--- src/Dialog_MainWindow.cpp | 6 +++--- src/Dialog_Processing.cpp | 24 ++++++++++----------- src/Global.cpp | 28 ++++++++++++++++++------ src/Global.h | 3 ++- src/Model_Progress.cpp | 4 ++-- src/Model_Settings.cpp | 43 +++++++++++++++++++++++++++++++++++-- src/Model_Settings.h | 2 ++ src/Registry_Decoder.cpp | 4 ++-- src/Registry_Decoder.h | 6 +++++- src/Thread_Process.cpp | 24 ++++++++++----------- 15 files changed, 150 insertions(+), 48 deletions(-) create mode 100644 res/flags/en.png diff --git a/LameXP.vcproj b/LameXP.vcproj index 8a277bd2..3e612ac6 100644 --- a/LameXP.vcproj +++ b/LameXP.vcproj @@ -1211,6 +1211,36 @@ + + + + + + + + + + + @@ -1676,7 +1710,7 @@ > @@ -1686,7 +1720,7 @@ > @@ -1696,7 +1730,7 @@ > diff --git a/etc/Deployment/_deploy.bat b/etc/Deployment/_deploy.bat index d35a8147..433e38dc 100644 --- a/etc/Deployment/_deploy.bat +++ b/etc/Deployment/_deploy.bat @@ -37,6 +37,12 @@ del /Q "%OBJ_PATH%\*.idb" del /Q "%MOC_PATH%\*.cpp" del /Q "%MOC_PATH%\*.h" REM ------------------------------------------ +REM :: BUILD LANGUAGE FILES :: +REM ------------------------------------------ +for %%f in (..\Translation\*.ts) do ( + lrelease.exe %%f -qm ..\..\res\localization\%%~nf.qm +) +REM ------------------------------------------ REM :: BUILD BINARIES :: REM ------------------------------------------ call _build.bat "..\..\LameXP.sln" "%LAMEXP_CONFIG%" diff --git a/res/flags/en.png b/res/flags/en.png new file mode 100644 index 0000000000000000000000000000000000000000..ff701e19f6d2c0658fb23b1d94124cba4ce60851 GIT binary patch literal 599 zcmV-d0;v6oP)U(k2*|8J(R-+sudaynhucHbwAMTnor{mwqO^w7JHzaBsT z{O^B8RYf5+LvDs&KmRKVd78=o{`1#HTiEo_OolaGleS)G+IQ#sUI`b*pv<`1zCJ=H0jd{{2S>p`ri%{LsXJ%FbMS z$#S`6f|?OG!^Jxczkf6Q`UNF{l0Sd`ad7zm>({^EzyAS6{{CgrkluOb3l1A>ZU2~A zK+FZ=zkmP!`TOVhpFbzBzFaPmD2$N3;+$pK?>zdet`f0002ovPDHLkV1gy;I?Vt8 literal 0 HcmV?d00001 diff --git a/src/Config.h b/src/Config.h index d383be6f..a5fd15d5 100644 --- a/src/Config.h +++ b/src/Config.h @@ -25,7 +25,7 @@ #define VER_LAMEXP_MAJOR 4 #define VER_LAMEXP_MINOR_HI 0 #define VER_LAMEXP_MINOR_LO 0 -#define VER_LAMEXP_BUILD 204 +#define VER_LAMEXP_BUILD 209 #define VER_LAMEXP_SUFFIX TechPreview /* diff --git a/src/Dialog_About.cpp b/src/Dialog_About.cpp index 96f8f4e4..bff2ea3d 100644 --- a/src/Dialog_About.cpp +++ b/src/Dialog_About.cpp @@ -190,14 +190,14 @@ void AboutDialog::showAboutQt(void) void AboutDialog::showAboutContributors(void) { QString contributorsAboutText; - contributorsAboutText += QString("

%1

").arg(tr("The following people have contributed to LameXP:")); + contributorsAboutText += QString("

%1

").arg(tr("The following people have contributed to LameXP:")); contributorsAboutText += QString("%1").arg(tr("Translators:")); contributorsAboutText += ""; - contributorsAboutText += CONTRIBUTOR("Englisch", "LoRd_MuldeR <MuldeR2@GMX.de>", ":/flags/gb.png"); + contributorsAboutText += CONTRIBUTOR("Englisch", "LoRd_MuldeR <MuldeR2@GMX.de>", ":/flags/en.png"); contributorsAboutText += CONTRIBUTOR("Deutsch", "LoRd_MuldeR <MuldeR2@GMX.de>", ":/flags/de.png"); contributorsAboutText += "
"; contributorsAboutText += "

"; - contributorsAboutText += QString("%1
").arg(tr("If you are willing to contribute a LameXP translation, feel free to contact us!")); + contributorsAboutText += QString("%1
").arg(tr("If you are willing to contribute a LameXP translation, feel free to contact us!")); QMessageBox *contributorsAboutBox = new QMessageBox(this); contributorsAboutBox->setText(contributorsAboutText); diff --git a/src/Dialog_MainWindow.cpp b/src/Dialog_MainWindow.cpp index 50c3e02a..a51a54ff 100644 --- a/src/Dialog_MainWindow.cpp +++ b/src/Dialog_MainWindow.cpp @@ -599,7 +599,7 @@ void MainWindow::windowShown(void) { qWarning("Binary has expired !!!"); PlaySound(MAKEINTRESOURCE(IDR_WAVE_WHAMMY), GetModuleHandle(NULL), SND_RESOURCE | SND_SYNC); - if(QMessageBox::warning(this, tr("LameXP - Expired"), tr("This demo (pre-release) version of LameXP has expired at %1.\nLameXP is free software and release versions won't expire.").arg(expireDate.toString(Qt::ISODate)), tr("Check for Updates"), tr("Exit Program")) == 0) + if(QMessageBox::warning(this, tr("LameXP - Expired"), QString("%1
%2
").arg(tr("This demo (pre-release) version of LameXP has expired at %1.").arg(expireDate.toString(Qt::ISODate)), tr("LameXP is free software and release versions won't expire.")), tr("Check for Updates"), tr("Exit Program")) == 0) { checkUpdatesActionActivated(); } @@ -627,7 +627,7 @@ void MainWindow::windowShown(void) QDate lastUpdateCheck = QDate::fromString(m_settings->autoUpdateLastCheck(), Qt::ISODate); if(!lastUpdateCheck.isValid() || QDate::currentDate() >= lastUpdateCheck.addDays(14)) { - if(QMessageBox::information(this, tr("Update Reminer"), (lastUpdateCheck.isValid() ? tr("Your last update check was more than 14 days ago. Check for updates now?") : tr("Your did not check for LameXP updates yet. Check for updates now?")), tr("Check for Updates"), tr("Postpone")) == 0) + if(QMessageBox::information(this, tr("Update Reminder"), (lastUpdateCheck.isValid() ? tr("Your last update check was more than 14 days ago. Check for updates now?") : tr("Your did not check for LameXP updates yet. Check for updates now?")), tr("Check for Updates"), tr("Postpone")) == 0) { checkUpdatesActionActivated(); } @@ -1214,7 +1214,7 @@ void MainWindow::notifyOtherInstance(void) { if(!m_banner->isVisible()) { - QMessageBox msgBox(QMessageBox::Warning, tr("Already running"), tr("LameXP is already running, please use the running instance!"), QMessageBox::NoButton, this, Qt::Dialog | Qt::MSWindowsFixedSizeDialogHint | Qt::WindowStaysOnTopHint); + QMessageBox msgBox(QMessageBox::Warning, tr("Already Running"), tr("LameXP is already running, please use the running instance!"), QMessageBox::NoButton, this, Qt::Dialog | Qt::MSWindowsFixedSizeDialogHint | Qt::WindowStaysOnTopHint); msgBox.exec(); } } diff --git a/src/Dialog_Processing.cpp b/src/Dialog_Processing.cpp index 4be49429..7085058a 100644 --- a/src/Dialog_Processing.cpp +++ b/src/Dialog_Processing.cpp @@ -114,7 +114,7 @@ ProcessingDialog::ProcessingDialog(FileListModel *fileListModel, AudioFileModel //Create context menu m_contextMenu = new QMenu(); - QAction *contextMenuAction = m_contextMenu->addAction(QIcon(":/icons/zoom.png"), "Show details for selected job"); + QAction *contextMenuAction = m_contextMenu->addAction(QIcon(":/icons/zoom.png"), tr("Show details for selected job")); view_log->setContextMenuPolicy(Qt::CustomContextMenu); connect(view_log, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextMenuTriggered(QPoint))); connect(contextMenuAction, SIGNAL(triggered(bool)), this, SLOT(contextMenuActionTriggered())); @@ -243,7 +243,7 @@ void ProcessingDialog::initEncoding(void) m_playList.clear(); CHANGE_BACKGROUND_COLOR(frame_header, QColor(Qt::white)); - SET_PROGRESS_TEXT("Encoding files, please wait..."); + SET_PROGRESS_TEXT(tr("Encoding files, please wait...")); m_progressIndicator->start(); button_closeDialog->setEnabled(false); @@ -268,7 +268,7 @@ void ProcessingDialog::abortEncoding(void) m_userAborted = true; button_AbortProcess->setEnabled(false); - SET_PROGRESS_TEXT("Aborted! Waiting for running jobs to terminate..."); + SET_PROGRESS_TEXT(tr("Aborted! Waiting for running jobs to terminate...")); for(int i = 0; i < m_threadList.count(); i++) { @@ -283,7 +283,7 @@ void ProcessingDialog::doneEncoding(void) if(!m_userAborted) { - SET_PROGRESS_TEXT(QString("Encoding: %1 files of %2 completed so far, please wait...").arg(QString::number(progressBar->value()), QString::number(progressBar->maximum()))); + SET_PROGRESS_TEXT(tr("Encoding: %1 files of %2 completed so far, please wait...").arg(QString::number(progressBar->value()), QString::number(progressBar->maximum()))); WinSevenTaskbar::setTaskbarProgress(this, progressBar->value(), progressBar->maximum()); } @@ -311,7 +311,7 @@ void ProcessingDialog::doneEncoding(void) if(!m_userAborted && m_settings->createPlaylist() && !m_settings->outputToSourceDir()) { - SET_PROGRESS_TEXT("Creatig the playlist file, please wait..."); + SET_PROGRESS_TEXT(tr("Creatig the playlist file, please wait...")); QApplication::processEvents(); writePlayList(); } @@ -321,8 +321,8 @@ void ProcessingDialog::doneEncoding(void) CHANGE_BACKGROUND_COLOR(frame_header, QColor("#FFF3BA")); WinSevenTaskbar::setTaskbarState(this, WinSevenTaskbar::WinSevenTaskbarErrorState); WinSevenTaskbar::setOverlayIcon(this, &QIcon(":/icons/error.png")); - SET_PROGRESS_TEXT((m_succeededJobs.count() > 0) ? QString("Process was aborted by the user after %1 file(s)!").arg(QString::number(m_succeededJobs.count())) : "Process was aborted prematurely by the user!"); - m_systemTray->showMessage("LameXP - Aborted", "Process was aborted by the user.", QSystemTrayIcon::Warning); + SET_PROGRESS_TEXT((m_succeededJobs.count() > 0) ? tr("Process was aborted by the user after %1 file(s)!").arg(QString::number(m_succeededJobs.count())) : "Process was aborted prematurely by the user!"); + m_systemTray->showMessage(tr("LameXP - Aborted"), tr("Process was aborted by the user."), QSystemTrayIcon::Warning); m_systemTray->setIcon(QIcon(":/icons/cd_delete.png")); QApplication::processEvents(); if(m_settings->soundsEnabled()) PlaySound(MAKEINTRESOURCE(IDR_WAVE_ABORTED), GetModuleHandle(NULL), SND_RESOURCE | SND_SYNC); @@ -334,8 +334,8 @@ void ProcessingDialog::doneEncoding(void) CHANGE_BACKGROUND_COLOR(frame_header, QColor("#FFBABA")); WinSevenTaskbar::setTaskbarState(this, WinSevenTaskbar::WinSevenTaskbarErrorState); WinSevenTaskbar::setOverlayIcon(this, &QIcon(":/icons/exclamation.png")); - SET_PROGRESS_TEXT(QString("Error: %1 of %2 files failed. Double-click failed items for detailed information!").arg(QString::number(m_failedJobs.count()), QString::number(m_failedJobs.count() + m_succeededJobs.count()))); - m_systemTray->showMessage("LameXP - Error", "At least one file has failed!", QSystemTrayIcon::Critical); + SET_PROGRESS_TEXT(tr("Error: %1 of %2 files failed. Double-click failed items for detailed information!").arg(QString::number(m_failedJobs.count()), QString::number(m_failedJobs.count() + m_succeededJobs.count()))); + m_systemTray->showMessage(tr("LameXP - Error"), tr("At least one file has failed!"), QSystemTrayIcon::Critical); m_systemTray->setIcon(QIcon(":/icons/cd_delete.png")); QApplication::processEvents(); if(m_settings->soundsEnabled()) PlaySound(MAKEINTRESOURCE(IDR_WAVE_ERROR), GetModuleHandle(NULL), SND_RESOURCE | SND_SYNC); @@ -345,8 +345,8 @@ void ProcessingDialog::doneEncoding(void) CHANGE_BACKGROUND_COLOR(frame_header, QColor("#E0FFE2")); WinSevenTaskbar::setTaskbarState(this, WinSevenTaskbar::WinSevenTaskbarNormalState); WinSevenTaskbar::setOverlayIcon(this, &QIcon(":/icons/accept.png")); - SET_PROGRESS_TEXT("Alle files completed successfully."); - m_systemTray->showMessage("LameXP - Done", "All files completed successfully.", QSystemTrayIcon::Information); + SET_PROGRESS_TEXT(tr("Alle files completed successfully.")); + m_systemTray->showMessage(tr("LameXP - Done"), tr("All files completed successfully."), QSystemTrayIcon::Information); m_systemTray->setIcon(QIcon(":/icons/cd_add.png")); QApplication::processEvents(); if(m_settings->soundsEnabled()) PlaySound(MAKEINTRESOURCE(IDR_WAVE_SUCCESS), GetModuleHandle(NULL), SND_RESOURCE | SND_SYNC); @@ -535,7 +535,7 @@ void ProcessingDialog::writePlayList(void) } else { - QMessageBox::warning(this, "Playlist creation failed", QString("The playlist file could not be created:
%1").arg(playListFile)); + QMessageBox::warning(this, tr("Playlist creation failed"), QString("%1
%2").arg(tr("The playlist file could not be created:"), playListFile)); } } diff --git a/src/Global.cpp b/src/Global.cpp index 0d87cbc4..fdaa4c42 100644 --- a/src/Global.cpp +++ b/src/Global.cpp @@ -123,6 +123,7 @@ static QMap g_lamexp_tool_versions; //Languages static QMap g_lamexp_translation_files; static QMap g_lamexp_translation_names; +static QMap g_lamexp_translation_sysid; static QTranslator *g_lamexp_currentTranslator = NULL; //Shared memory @@ -465,24 +466,31 @@ static void lamexp_init_translations(void) while(!qmFiles.isEmpty()) { QString langId, langName; + WORD systemId = 0; QString qmFile = qmFiles.takeFirst(); - + QRegExp langIdExp("LameXP_(\\w\\w)\\.qm", Qt::CaseInsensitive); if(langIdExp.indexIn(qmFile) >= 0) { langId = langIdExp.cap(1).toLower(); } - - QResource langNameRes = (QString(":/localization/%1.txt").arg(qmFile)); - if(langNameRes.isValid() && langNameRes.size() > 0) + + QResource langRes = (QString(":/localization/%1.txt").arg(qmFile)); + if(langRes.isValid() && langRes.size() > 0) { - langName = QString::fromUtf8(reinterpret_cast(langNameRes.data()), langNameRes.size()); + QStringList langInfo = QString::fromUtf8(reinterpret_cast(langRes.data()), langRes.size()).simplified().split(",", QString::SkipEmptyParts); + if(langInfo.count() == 2) + { + systemId = langInfo.at(0).toUInt(); + langName = langInfo.at(1); + } } - if(!langId.isEmpty() && !langName.isEmpty()) + if(!langId.isEmpty() && systemId > 0 && !langName.isEmpty()) { g_lamexp_translation_files.insert(langId, qmFile); g_lamexp_translation_names.insert(langId, langName); + g_lamexp_translation_sysid.insert(langId, systemId); } } } @@ -907,6 +915,14 @@ QString lamexp_translation_name(const QString &langId) return g_lamexp_translation_names.value(langId.toLower(), QString()); } +/* + * Get translation system id + */ +WORD lamexp_translation_sysid(const QString &langId) +{ + return g_lamexp_translation_sysid.value(langId.toLower(), 0); +} + /* * Install a new translator */ diff --git a/src/Global.h b/src/Global.h index 1f94bc3a..1869b2fd 100644 --- a/src/Global.h +++ b/src/Global.h @@ -95,8 +95,9 @@ lamexp_cpu_t lamexp_detect_cpu_features(void); //Translation support QStringList lamexp_query_translations(void); QString lamexp_translation_name(const QString &language); +WORD lamexp_translation_sysid(const QString &langId); bool lamexp_install_translator(const QString &language); -static const char* LAMEXP_DEFAULT_LANGID = "gb"; +static const char* LAMEXP_DEFAULT_LANGID = "en"; //Auxiliary functions bool lamexp_clean_folder(const QString folderPath); diff --git a/src/Model_Progress.cpp b/src/Model_Progress.cpp index a9503ed1..f24a4521 100644 --- a/src/Model_Progress.cpp +++ b/src/Model_Progress.cpp @@ -100,10 +100,10 @@ QVariant ProgressModel::headerData(int section, Qt::Orientation orientation, int switch(section) { case 0: - return "Job"; + return tr("Job"); break; case 1: - return "Status"; + return tr("Status"); break; default: return QVariant(); diff --git a/src/Model_Settings.cpp b/src/Model_Settings.cpp index ad8eb99e..81dbd143 100644 --- a/src/Model_Settings.cpp +++ b/src/Model_Settings.cpp @@ -70,6 +70,8 @@ const int SettingsModel::mp3Bitrates[15] = {32, 40, 48, 56, 64, 80, 96, 112, 128 //////////////////////////////////////////////////////////// SettingsModel::SettingsModel(void) +: + m_defaultLanguage(NULL) { QString appPath = QDesktopServices::storageLocation(QDesktopServices::DataLocation); m_settings = new QSettings(appPath.append("/config.ini"), QSettings::IniFormat); @@ -85,6 +87,7 @@ SettingsModel::SettingsModel(void) SettingsModel::~SettingsModel(void) { LAMEXP_DELETE(m_settings); + LAMEXP_DELETE(m_defaultLanguage); } //////////////////////////////////////////////////////////// @@ -120,10 +123,46 @@ void SettingsModel::validate(void) if(!lamexp_query_translations().contains(this->currentLanguage(), Qt::CaseInsensitive)) { qWarning("Current language is unknown, reverting to default language!"); - this->currentLanguage(LAMEXP_DEFAULT_LANGID); + this->currentLanguage(defaultLanguage()); } } +//////////////////////////////////////////////////////////// +// Private Functions +//////////////////////////////////////////////////////////// + +QString SettingsModel::defaultLanguage(void) +{ + if(m_defaultLanguage) + { + return *m_defaultLanguage; + } + + //Check if we can use the default translation + WORD systemLangId = PRIMARYLANGID(GetUserDefaultLangID()); + if(systemLangId == LANG_ENGLISH) + { + m_defaultLanguage = new QString(LAMEXP_DEFAULT_LANGID); + return LAMEXP_DEFAULT_LANGID; + } + + //Try to find a suitable translation for the user's system language + QStringList languages = lamexp_query_translations(); + while(!languages.isEmpty()) + { + QString currentLangId = languages.takeFirst(); + if(lamexp_translation_sysid(currentLangId) == systemLangId) + { + m_defaultLanguage = new QString(currentLangId); + return currentLangId; + } + } + + //Fall back to the default translation + m_defaultLanguage = new QString(LAMEXP_DEFAULT_LANGID); + return LAMEXP_DEFAULT_LANGID; +} + //////////////////////////////////////////////////////////// // Getter and Setter //////////////////////////////////////////////////////////// @@ -144,4 +183,4 @@ MAKE_OPTION3(soundsEnabled, true) MAKE_OPTION3(neroAacNotificationsEnabled, true) MAKE_OPTION3(wmaDecoderNotificationsEnabled, true) MAKE_OPTION3(dropBoxWidgetEnabled, true) -MAKE_OPTION2(currentLanguage, LAMEXP_DEFAULT_LANGID); +MAKE_OPTION2(currentLanguage, defaultLanguage()); diff --git a/src/Model_Settings.h b/src/Model_Settings.h index 67829fdd..c874a040 100644 --- a/src/Model_Settings.h +++ b/src/Model_Settings.h @@ -85,6 +85,8 @@ public: private: QSettings *m_settings; + QString *m_defaultLanguage; + QString defaultLanguage(void); }; #undef MAKE_OPTION_DEC1 diff --git a/src/Registry_Decoder.cpp b/src/Registry_Decoder.cpp index 10d22042..db29b8c7 100644 --- a/src/Registry_Decoder.cpp +++ b/src/Registry_Decoder.cpp @@ -75,9 +75,9 @@ QStringList DecoderRegistry::getSupportedTypes(void) { extensions.removeDuplicates(); extensions.sort(); - types.prepend(QString("All supported types (%1)").arg(extensions.join(" "))); + types.prepend(QString("%1 (%2)").arg(tr("All supported types"), extensions.join(" "))); } - types << "All files (*.*)"; + types << QString("%1 (*.*)").arg(tr("All files")); return types; } diff --git a/src/Registry_Decoder.h b/src/Registry_Decoder.h index 6b918024..f2dc5925 100644 --- a/src/Registry_Decoder.h +++ b/src/Registry_Decoder.h @@ -21,12 +21,16 @@ #pragma once +#include + class QString; class QStringList; class AbstractDecoder; -class DecoderRegistry +class DecoderRegistry : public QObject { + Q_OBJECT + public: static AbstractDecoder *lookup(const QString &containerType, const QString &containerProfile, const QString &formatType, const QString &formatProfile, const QString &formatVersion); static QStringList DecoderRegistry::getSupportedTypes(void); diff --git a/src/Thread_Process.cpp b/src/Thread_Process.cpp index e27d78d9..fa0944a0 100644 --- a/src/Thread_Process.cpp +++ b/src/Thread_Process.cpp @@ -98,13 +98,13 @@ void ProcessThread::processFile() bool bSuccess = true; qDebug("Process thread %s has started.", m_jobId.toString().toLatin1().constData()); - emit processStateInitialized(m_jobId, QFileInfo(m_audioFile.filePath()).fileName(), "Starting...", ProgressModel::JobRunning); + emit processStateInitialized(m_jobId, QFileInfo(m_audioFile.filePath()).fileName(), tr("Starting..."), ProgressModel::JobRunning); //Generate output file name QString outFileName = generateOutFileName(); if(outFileName.isEmpty()) { - emit processStateChanged(m_jobId, "Not found!", ProgressModel::JobFailed); + emit processStateChanged(m_jobId, tr("Not found!"), ProgressModel::JobFailed); emit processStateFinished(m_jobId, outFileName, false); return; } @@ -142,8 +142,8 @@ void ProcessThread::processFile() } else { - handleMessage(QString("The format of this file is NOT supported:\n%1\n\nContainer Format:\t%2\nAudio Format:\t%3").arg(m_audioFile.filePath(), m_audioFile.formatContainerInfo(), m_audioFile.formatAudioCompressInfo())); - emit processStateChanged(m_jobId, "Unsupported!", ProgressModel::JobFailed); + handleMessage(QString("%1\n%2\n\n%3\t%4\n%5\t%6").arg(tr("The format of this file is NOT supported:"), m_audioFile.filePath(), tr("Container Format:"), m_audioFile.formatContainerInfo(), tr("Audio Format:"), m_audioFile.formatAudioCompressInfo())); + emit processStateChanged(m_jobId, tr("Unsupported!"), ProgressModel::JobFailed); emit processStateFinished(m_jobId, outFileName, false); return; } @@ -188,7 +188,7 @@ void ProcessThread::processFile() } //Report result - emit processStateChanged(m_jobId, (bSuccess ? "Done." : (m_aborted ? "Aborted!" : "Failed!")), (bSuccess ? ProgressModel::JobComplete : ProgressModel::JobFailed)); + emit processStateChanged(m_jobId, (bSuccess ? tr("Done.") : (m_aborted ? tr("Aborted!") : tr("Failed!"))), (bSuccess ? ProgressModel::JobComplete : ProgressModel::JobFailed)); emit processStateFinished(m_jobId, outFileName, bSuccess); qDebug("Process thread is done."); @@ -203,13 +203,13 @@ void ProcessThread::handleUpdate(int progress) switch(m_currentStep) { case EncodingStep: - emit processStateChanged(m_jobId, QString("Encoding (%1%)").arg(QString::number(progress)), ProgressModel::JobRunning); + emit processStateChanged(m_jobId, QString("%1 (%2%)").arg(tr("Encoding"), QString::number(progress)), ProgressModel::JobRunning); break; case FilteringStep: - emit processStateChanged(m_jobId, QString("Filtering (%1%)").arg(QString::number(progress)), ProgressModel::JobRunning); + emit processStateChanged(m_jobId, QString("%1 (%2%)").arg(tr("Filtering"), QString::number(progress)), ProgressModel::JobRunning); break; case DecodingStep: - emit processStateChanged(m_jobId, QString("Decoding (%1%)").arg(QString::number(progress)), ProgressModel::JobRunning); + emit processStateChanged(m_jobId, QString("%1 (%2%)").arg(tr("Decoding"), QString::number(progress)), ProgressModel::JobRunning); break; } } @@ -232,14 +232,14 @@ QString ProcessThread::generateOutFileName(void) QFileInfo sourceFile(m_audioFile.filePath()); if(!sourceFile.exists() || !sourceFile.isFile()) { - handleMessage(QString("The source audio file could not be found:\n%1").arg(sourceFile.absoluteFilePath())); + handleMessage(QString("%1\n%2").arg(tr("The source audio file could not be found:"), sourceFile.absoluteFilePath())); return QString(); } QFile readTest(sourceFile.canonicalFilePath()); if(!readTest.open(QIODevice::ReadOnly)) { - handleMessage(QString("The source audio file could not be opened for reading:\n%1").arg(readTest.fileName())); + handleMessage(QString("%1\n%2").arg(tr("The source audio file could not be opened for reading:"), readTest.fileName())); return QString(); } else @@ -265,7 +265,7 @@ QString ProcessThread::generateOutFileName(void) targetDir.mkpath("."); if(!targetDir.exists()) { - handleMessage(QString("The target output directory doesn't exist and could NOT be created:\n%1").arg(targetDir.absolutePath())); + handleMessage(QString("%1\n%2").arg(tr("The target output directory doesn't exist and could NOT be created:"), targetDir.absolutePath())); return QString(); } } @@ -273,7 +273,7 @@ QString ProcessThread::generateOutFileName(void) QFile writeTest(QString("%1/.%2").arg(targetDir.canonicalPath(), lamexp_rand_str())); if(!writeTest.open(QIODevice::ReadWrite)) { - handleMessage(QString("The target output directory is NOT writable:\n%1").arg(targetDir.absolutePath())); + handleMessage(QString("%1\n%2").arg(tr("The target output directory is NOT writable:"), targetDir.absolutePath())); return QString(); } else