From d537aef9f7c38a69f9c83840dbd06144ea117b97 Mon Sep 17 00:00:00 2001 From: Joachim Schmitz Date: Thu, 28 Aug 2014 14:50:17 +0200 Subject: [PATCH 1/2] delete older translations on start --- mscore/musescore.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/mscore/musescore.cpp b/mscore/musescore.cpp index 7d5da021ddae..7ea9ccdf7482 100644 --- a/mscore/musescore.cpp +++ b/mscore/musescore.cpp @@ -2083,8 +2083,12 @@ void loadTranslation(QString filename, QString localeName) // qDebug() << userFi.exists(); // qDebug() << userFi.lastModified() << defaultFi.lastModified(); - if (userFi.exists() && userFi.lastModified() > defaultFi.lastModified()) - lp = userlp; + if (userFi.exists()) { + if (userFi.lastModified() > defaultFi.lastModified()) + lp = userlp; + else + QFile::remove(userlp + ".qm"); + } if (MScore::debugMode) qDebug("load translator <%s>", qPrintable(lp)); bool success = translator->load(lp); From f62236688a8a2dd02aa95cd4681dc03d351ecf3e Mon Sep 17 00:00:00 2001 From: Joachim Schmitz Date: Thu, 28 Aug 2014 14:51:03 +0200 Subject: [PATCH 2/2] ignore older translations when checking for updates --- mscore/resourceManager.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/mscore/resourceManager.cpp b/mscore/resourceManager.cpp index c8283b2e1241..bcfd7f504261 100644 --- a/mscore/resourceManager.cpp +++ b/mscore/resourceManager.cpp @@ -120,11 +120,13 @@ void ResourceManager::displayLanguages() bool ResourceManager::verifyLanguageFile(QString filename, QString hash) { QString local = dataPath + "/locale/" + filename; + QString global = mscoreGlobalShare + "locale/" + filename; QFileInfo fileLocal(local); - if(!fileLocal.exists()) - local = mscoreGlobalShare + "locale/" + filename;; + QFileInfo fileGlobal(global); + if(!fileLocal.exists() || (fileLocal.lastModified() <= fileGlobal.lastModified()) ) + local = mscoreGlobalShare + "locale/" + filename; - return verifyFile(local, hash); + return verifyFile(local, hash); } void ResourceManager::download() @@ -146,7 +148,7 @@ void ResourceManager::download() button->setEnabled(1); } else { - // unzip and delete + // unzip and delete MQZipReader zipFile(localPath); QFileInfo zfi(localPath); QString destinationDir(zfi.absolutePath());