r22063 by jghali - more robustness against missing/not installed translations
scribus-commit
scribus-commit at lists.scribus.net
Sun Jun 11 22:43:56 UTC 2017
Author: jghali
Date: Sun Jun 11 22:43:56 2017
New Revision: 22063
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=22063
Log:
more robustness against missing/not installed translations
Modified:
trunk/Scribus/scribus/langmgr.cpp
trunk/Scribus/scribus/langmgr.h
trunk/Scribus/scribus/prefsmanager.cpp
Modified: trunk/Scribus/scribus/langmgr.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22063&path=/trunk/Scribus/scribus/langmgr.cpp
==============================================================================
--- trunk/Scribus/scribus/langmgr.cpp (original)
+++ trunk/Scribus/scribus/langmgr.cpp Sun Jun 11 22:43:56 2017
@@ -880,6 +880,25 @@
stringListToFill->sort();
}
+bool LanguageManager::isAvailableTranslation(QString langAbbrev)
+{
+ if (langAbbrev == "en" || langAbbrev == "en_GB")
+ return true;
+
+ int i = langTableIndex(langAbbrev);
+ if (i == -1)
+ {
+ if (langAbbrev.length() > 5)
+ {
+ langAbbrev.truncate(5);
+ i = langTableIndex(langAbbrev);
+ }
+ }
+ if (i !=-1)
+ return m_langTable[i].m_transAvailable;
+ return false;
+}
+
QStringList LanguageManager::languageList(bool getTranslated)
{
QStringList sl;
Modified: trunk/Scribus/scribus/langmgr.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22063&path=/trunk/Scribus/scribus/langmgr.h
==============================================================================
--- trunk/Scribus/scribus/langmgr.h (original)
+++ trunk/Scribus/scribus/langmgr.h Sun Jun 11 22:43:56 2017
@@ -66,6 +66,8 @@
const QString getHyphFilename(const QString& langAbbrev);
int langTableIndex(const QString& abbrev);
+ bool isAvailableTranslation(QString langAbbrev);
+
private:
static LanguageManager* m_instance;
Modified: trunk/Scribus/scribus/prefsmanager.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22063&path=/trunk/Scribus/scribus/prefsmanager.cpp
==============================================================================
--- trunk/Scribus/scribus/prefsmanager.cpp (original)
+++ trunk/Scribus/scribus/prefsmanager.cpp Sun Jun 11 22:43:56 2017
@@ -38,6 +38,7 @@
#include "commonstrings.h"
#include "filewatcher.h"
#include "latexhelpers.h"
+#include "langmgr.h"
#include "localemgr.h"
#include "pagesize.h"
#include "pagestructs.h"
@@ -955,9 +956,17 @@
if (!guiLanguage.isEmpty())
appPrefs.uiPrefs.language = guiLanguage;
if (appPrefs.uiPrefs.language.isEmpty())
+ {
appPrefs.uiPrefs.language = ScQApp->currGUILanguage();
- if (appPrefs.uiPrefs.language.isEmpty())
- appPrefs.uiPrefs.language = "en_GB";
+ if (appPrefs.uiPrefs.language.isEmpty())
+ appPrefs.uiPrefs.language = "en_GB"; // If we get here, Houston, we have a problem!
+ }
+ if (!LanguageManager::instance()->isAvailableTranslation(appPrefs.uiPrefs.language))
+ {
+ appPrefs.uiPrefs.language = ScQApp->currGUILanguage();
+ if (!LanguageManager::instance()->isAvailableTranslation(appPrefs.uiPrefs.language))
+ appPrefs.uiPrefs.language = "en_GB"; // If we get here, Houston, we have a problem!
+ }
appPrefs.uiPrefs.mainWinState = QByteArray::fromBase64(userprefsContext->get("mainwinstate","").toLatin1());
appPrefs.uiPrefs.tabbedPalettes.clear();
PrefsTable *tabsTable = userprefsContext->getTable("tabbedPalettes");
More information about the scribus-commit
mailing list