r19779 by craig - #12742: Also import the Qt translation files.. duh
scribus-commit
scribus-commit at lists.scribus.net
Sun Feb 1 12:49:12 UTC 2015
Author: craig
Date: Sun Feb 1 12:49:12 2015
New Revision: 19779
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=19779
Log:
#12742: Also import the Qt translation files.. duh
Modified:
trunk/Scribus/scribus/scribusapp.cpp
Modified: trunk/Scribus/scribus/scribusapp.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19779&path=/trunk/Scribus/scribus/scribusapp.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusapp.cpp (original)
+++ trunk/Scribus/scribus/scribusapp.cpp Sun Feb 1 12:49:12 2015
@@ -24,15 +24,16 @@
#include <iostream>
#include <cstdlib>
+#include <QDir>
+#include <QFile>
+#include <QFileInfo>
+#include <QFont>
+#include <QLibraryInfo>
+#include <QLocale>
#include <QString>
-#include <QFont>
+#include <QTextCodec>
+#include <QTextStream>
#include <QTranslator>
-#include <QFileInfo>
-#include <QFile>
-#include <QDir>
-#include <QTextCodec>
-#include <QLocale>
-#include <QTextStream>
#include "scribusapp.h"
@@ -389,22 +390,30 @@
void ScribusQApp::installTranslators(const QStringList & langs)
{
+ static QTranslator *transQt = 0;
static QTranslator *trans = 0;
- if ( trans )
+ if (transQt)
+ {
+ removeTranslator( transQt );
+ delete transQt;
+ transQt=0;
+ }
+ if (trans)
{
removeTranslator( trans );
delete trans;
trans=0;
}
+ transQt = new QTranslator(0);
trans = new QTranslator(0);
QString path(ScPaths::instance().translationDir());
- path += "scribus";
-
- bool loaded = false;
+
+ bool loadedQt = false;
+ bool loadedScribus = false;
QString lang;
- for (QStringList::const_iterator it = langs.constBegin(); it != langs.constEnd() && !loaded; ++it)
+ for (QStringList::const_iterator it = langs.constBegin(); it != langs.constEnd() && !loadedScribus; ++it)
{
lang=(*it);
if (lang == "en")
@@ -412,10 +421,18 @@
GUILang=lang;
break;
}
- else if (trans->load(QString(path + '.' + lang), "."))
- loaded = true;
- }
- if (loaded)
+ else
+ {
+ //CB: This might need adjusting for qm files distribution locations
+ if (transQt->load("qt_" + lang, QLibraryInfo::location(QLibraryInfo::TranslationsPath)))
+ loadedQt = true;
+ if (trans->load(QString(path + "scribus." + lang), "."))
+ loadedScribus = true;
+ }
+ }
+ if (loadedQt)
+ installTranslator(transQt);
+ if (loadedScribus)
{
installTranslator(trans);
GUILang=lang;
More information about the scribus-commit
mailing list