Check system locale.
This commit is contained in:
parent
7ae794e0b7
commit
36180a7c38
|
@ -397,6 +397,8 @@ void VPApplication::InitOptions()
|
||||||
qCDebug(pApp, "Command-line arguments: %s", qUtf8Printable(arguments().join(", ")));
|
qCDebug(pApp, "Command-line arguments: %s", qUtf8Printable(arguments().join(", ")));
|
||||||
qCDebug(pApp, "Process ID: %s", qUtf8Printable(QString().setNum(applicationPid())));
|
qCDebug(pApp, "Process ID: %s", qUtf8Printable(QString().setNum(applicationPid())));
|
||||||
|
|
||||||
|
CheckSystemLocale();
|
||||||
|
|
||||||
QPixmapCache::setCacheLimit(50 * 1024 /* 50 MB */);
|
QPixmapCache::setCacheLimit(50 * 1024 /* 50 MB */);
|
||||||
|
|
||||||
LoadTranslation(QString());// By default the console version uses system locale
|
LoadTranslation(QString());// By default the console version uses system locale
|
||||||
|
|
|
@ -423,6 +423,8 @@ void MApplication::InitOptions()
|
||||||
qCDebug(mApp, "Command-line arguments: %s", qUtf8Printable(arguments().join(", ")));
|
qCDebug(mApp, "Command-line arguments: %s", qUtf8Printable(arguments().join(", ")));
|
||||||
qCDebug(mApp, "Process ID: %s", qUtf8Printable(QString().setNum(applicationPid())));
|
qCDebug(mApp, "Process ID: %s", qUtf8Printable(QString().setNum(applicationPid())));
|
||||||
|
|
||||||
|
CheckSystemLocale();
|
||||||
|
|
||||||
LoadTranslation(QString());// By default the console version uses system locale
|
LoadTranslation(QString());// By default the console version uses system locale
|
||||||
|
|
||||||
static const char * GENERIC_ICON_TO_CHECK = "document-open";
|
static const char * GENERIC_ICON_TO_CHECK = "document-open";
|
||||||
|
|
|
@ -33,9 +33,7 @@
|
||||||
#include "../ifc/exception/vexceptionemptyparameter.h"
|
#include "../ifc/exception/vexceptionemptyparameter.h"
|
||||||
#include "../ifc/exception/vexceptionwrongid.h"
|
#include "../ifc/exception/vexceptionwrongid.h"
|
||||||
#include "../ifc/exception/vexceptioninvalidnotch.h"
|
#include "../ifc/exception/vexceptioninvalidnotch.h"
|
||||||
#include "../vwidgets/vmaingraphicsview.h"
|
|
||||||
#include "../version.h"
|
#include "../version.h"
|
||||||
#include "../vmisc/vmath.h"
|
|
||||||
#include "../qmuparser/qmuparsererror.h"
|
#include "../qmuparser/qmuparsererror.h"
|
||||||
#include "../mainwindow.h"
|
#include "../mainwindow.h"
|
||||||
#include "../vmisc/qt_dispatch/qt_dispatch.h"
|
#include "../vmisc/qt_dispatch/qt_dispatch.h"
|
||||||
|
@ -617,6 +615,8 @@ void VApplication::InitOptions()
|
||||||
qDebug()<<"Command-line arguments:"<<arguments();
|
qDebug()<<"Command-line arguments:"<<arguments();
|
||||||
qDebug()<<"Process ID:"<<applicationPid();
|
qDebug()<<"Process ID:"<<applicationPid();
|
||||||
|
|
||||||
|
CheckSystemLocale();
|
||||||
|
|
||||||
LoadTranslation(QString());// By default the console version uses system locale
|
LoadTranslation(QString());// By default the console version uses system locale
|
||||||
|
|
||||||
// Create command line parser after loading translations to show localized version.
|
// Create command line parser after loading translations to show localized version.
|
||||||
|
@ -628,7 +628,7 @@ void VApplication::InitOptions()
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char * GENERIC_ICON_TO_CHECK = "document-open";
|
static const char * GENERIC_ICON_TO_CHECK = "document-open";
|
||||||
if (QIcon::hasThemeIcon(GENERIC_ICON_TO_CHECK) == false)
|
if (not QIcon::hasThemeIcon(GENERIC_ICON_TO_CHECK))
|
||||||
{
|
{
|
||||||
//If there is no default working icon theme then we should
|
//If there is no default working icon theme then we should
|
||||||
//use an icon theme that we provide via a .qrc file
|
//use an icon theme that we provide via a .qrc file
|
||||||
|
|
|
@ -277,8 +277,6 @@ void VAbstractApplication::LoadTranslation(const QString &locale)
|
||||||
LoadQM(appTranslator, QStringLiteral("valentina_"), locale, appQmDir);
|
LoadQM(appTranslator, QStringLiteral("valentina_"), locale, appQmDir);
|
||||||
installTranslator(appTranslator);
|
installTranslator(appTranslator);
|
||||||
|
|
||||||
const QString system = Settings()->GetPMSystemCode();
|
|
||||||
|
|
||||||
pmsTranslator = new QTranslator(this);
|
pmsTranslator = new QTranslator(this);
|
||||||
LoadQM(pmsTranslator, QStringLiteral("measurements_") + Settings()->GetPMSystemCode() + '_', locale, appQmDir);
|
LoadQM(pmsTranslator, QStringLiteral("measurements_") + Settings()->GetPMSystemCode() + '_', locale, appQmDir);
|
||||||
installTranslator(pmsTranslator);
|
installTranslator(pmsTranslator);
|
||||||
|
@ -355,3 +353,13 @@ QFileDialog::Options VAbstractApplication::NativeFileDialog(QFileDialog::Options
|
||||||
|
|
||||||
return options;
|
return options;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VAbstractApplication::CheckSystemLocale()
|
||||||
|
{
|
||||||
|
const QString defLocale = QLocale::system().name();
|
||||||
|
if (defLocale.startsWith(QLatin1String("ru")))
|
||||||
|
{
|
||||||
|
qFatal("Incompatible locale \"%s\"", qPrintable(defLocale));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -106,6 +106,8 @@ protected:
|
||||||
|
|
||||||
virtual void InitTrVars()=0;
|
virtual void InitTrVars()=0;
|
||||||
|
|
||||||
|
static void CheckSystemLocale();
|
||||||
|
|
||||||
protected slots:
|
protected slots:
|
||||||
virtual void AboutToQuit()=0;
|
virtual void AboutToQuit()=0;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user