Skip to content

Commit

Permalink
Merge pull request #1237 from Jojo-Schmitz/translation
Browse files Browse the repository at this point in the history
ignore/delete older translations on update/startup
  • Loading branch information
lasconic committed Aug 29, 2014
2 parents abc70ae + f622366 commit f5debcd
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
8 changes: 6 additions & 2 deletions mscore/musescore.cpp
Expand Up @@ -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);
Expand Down
10 changes: 6 additions & 4 deletions mscore/resourceManager.cpp
Expand Up @@ -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()
Expand All @@ -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());
Expand Down

0 comments on commit f5debcd

Please sign in to comment.