by default for console version use system locale.
--HG-- branch : develop
This commit is contained in:
parent
e236757d57
commit
77dd8f0c77
|
@ -313,7 +313,7 @@ void MApplication::InitOptions()
|
||||||
qDebug()<<"Command-line arguments:"<<this->arguments();
|
qDebug()<<"Command-line arguments:"<<this->arguments();
|
||||||
qDebug()<<"Process ID:"<<this->applicationPid();
|
qDebug()<<"Process ID:"<<this->applicationPid();
|
||||||
|
|
||||||
LoadTranslation(TapeSettings()->GetLocale());
|
LoadTranslation(QLocale::system().name());// 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";
|
||||||
if (QIcon::hasThemeIcon(GENERIC_ICON_TO_CHECK) == false)
|
if (QIcon::hasThemeIcon(GENERIC_ICON_TO_CHECK) == false)
|
||||||
|
@ -589,6 +589,11 @@ void MApplication::ParseCommandLine(const QStringList &arguments)
|
||||||
|
|
||||||
testMode = parser.isSet(testOption);
|
testMode = parser.isSet(testOption);
|
||||||
|
|
||||||
|
if (not testMode)
|
||||||
|
{
|
||||||
|
LoadTranslation(TapeSettings()->GetLocale());
|
||||||
|
}
|
||||||
|
|
||||||
const QStringList args = parser.positionalArguments();
|
const QStringList args = parser.positionalArguments();
|
||||||
if (args.count() > 0)
|
if (args.count() > 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -171,11 +171,14 @@ const QString VApplication::GistFileName = QStringLiteral("gist.json");
|
||||||
*/
|
*/
|
||||||
VApplication::VApplication(int &argc, char **argv)
|
VApplication::VApplication(int &argc, char **argv)
|
||||||
: VAbstractApplication(argc, argv),
|
: VAbstractApplication(argc, argv),
|
||||||
trVars(nullptr), autoSaveTimer(nullptr),
|
trVars(nullptr),
|
||||||
|
autoSaveTimer(nullptr),
|
||||||
lockLog(),
|
lockLog(),
|
||||||
out(nullptr)
|
out(nullptr)
|
||||||
{
|
{
|
||||||
VCommandLine::Reset(); // making sure will create new instance...just in case we will ever do 2 objects of VApplication
|
// making sure will create new instance...just in case we will ever do 2 objects of VApplication
|
||||||
|
VCommandLine::Reset();
|
||||||
|
LoadTranslation(QLocale::system().name());// By default the console version uses system locale
|
||||||
VCommandLine::Get(*this);
|
VCommandLine::Get(*this);
|
||||||
undoStack = new QUndoStack(this);
|
undoStack = new QUndoStack(this);
|
||||||
}
|
}
|
||||||
|
@ -499,7 +502,10 @@ void VApplication::InitOptions()
|
||||||
qDebug()<<"Command-line arguments:"<<this->arguments();
|
qDebug()<<"Command-line arguments:"<<this->arguments();
|
||||||
qDebug()<<"Process ID:"<<this->applicationPid();
|
qDebug()<<"Process ID:"<<this->applicationPid();
|
||||||
|
|
||||||
InitTranslation();
|
if (VApplication::CheckGUI())// By default console version uses system locale
|
||||||
|
{
|
||||||
|
LoadTranslation(ValentinaSettings()->GetLocale());
|
||||||
|
}
|
||||||
|
|
||||||
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 (QIcon::hasThemeIcon(GENERIC_ICON_TO_CHECK) == false)
|
||||||
|
@ -512,19 +518,6 @@ void VApplication::InitOptions()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
void VApplication::InitTranslation()
|
|
||||||
{
|
|
||||||
if (VApplication::CheckGUI())
|
|
||||||
{
|
|
||||||
LoadTranslation(ValentinaSettings()->GetLocale());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
LoadTranslation(CommandLine()->OptLocale());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QStringList VApplication::LabelLanguages()
|
QStringList VApplication::LabelLanguages()
|
||||||
{
|
{
|
||||||
|
|
|
@ -60,7 +60,6 @@ public:
|
||||||
virtual bool notify(QObject * receiver, QEvent * event) Q_DECL_OVERRIDE;
|
virtual bool notify(QObject * receiver, QEvent * event) Q_DECL_OVERRIDE;
|
||||||
|
|
||||||
void InitOptions();
|
void InitOptions();
|
||||||
void InitTranslation();
|
|
||||||
|
|
||||||
virtual QString translationsPath() const Q_DECL_OVERRIDE;
|
virtual QString translationsPath() const Q_DECL_OVERRIDE;
|
||||||
QString TapeFilePath() const;
|
QString TapeFilePath() const;
|
||||||
|
|
|
@ -50,9 +50,6 @@ const static auto SINGLE_OPTION_GAPWIDTH = QStringLiteral("G");
|
||||||
const static auto LONG_OPTION_GROUPPING = QStringLiteral("groups");
|
const static auto LONG_OPTION_GROUPPING = QStringLiteral("groups");
|
||||||
const static auto SINGLE_OPTION_GROUPPING = QStringLiteral("g");
|
const static auto SINGLE_OPTION_GROUPPING = QStringLiteral("g");
|
||||||
|
|
||||||
const static auto SINGLE_OPTION_LOCALE = QStringLiteral("L");
|
|
||||||
const static auto LONG_OPTION_LOCALE = QStringLiteral("locale");
|
|
||||||
|
|
||||||
#define tr(A) QCoreApplication::translate("VCommandLine", (A))
|
#define tr(A) QCoreApplication::translate("VCommandLine", (A))
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -142,12 +139,7 @@ VCommandLine::VCommandLine() : parser()
|
||||||
{LONG_OPTION_GROUPPING,
|
{LONG_OPTION_GROUPPING,
|
||||||
new QCommandLineOption(QStringList() << SINGLE_OPTION_GROUPPING << LONG_OPTION_GROUPPING,
|
new QCommandLineOption(QStringList() << SINGLE_OPTION_GROUPPING << LONG_OPTION_GROUPPING,
|
||||||
tr("Sets layout groupping (export mode): ")
|
tr("Sets layout groupping (export mode): ")
|
||||||
+ DialogLayoutSettings::MakeGroupsHelp(), tr("Grouping type"), "2")},
|
+ DialogLayoutSettings::MakeGroupsHelp(), tr("Grouping type"), "2")}
|
||||||
|
|
||||||
{LONG_OPTION_LOCALE,
|
|
||||||
new QCommandLineOption(QStringList() << SINGLE_OPTION_LOCALE << LONG_OPTION_LOCALE,
|
|
||||||
tr("Sets language locale (export mode). Default is system locale. Supported "
|
|
||||||
"locales: ") + SupportedLocales().join(", "), tr("Locale"))}
|
|
||||||
}),
|
}),
|
||||||
isGuiEnabled(false)
|
isGuiEnabled(false)
|
||||||
{
|
{
|
||||||
|
@ -402,17 +394,6 @@ QStringList VCommandLine::OptInputFileNames() const
|
||||||
return parser.positionalArguments();
|
return parser.positionalArguments();
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
QString VCommandLine::OptLocale() const
|
|
||||||
{
|
|
||||||
QString locale = QLocale::system().name();
|
|
||||||
if (parser.isSet(*optionsUsed.value(LONG_OPTION_LOCALE)))
|
|
||||||
{
|
|
||||||
locale = parser.value(*optionsUsed.value(LONG_OPTION_LOCALE));
|
|
||||||
}
|
|
||||||
return locale;
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
bool VCommandLine::IsGuiEnabled() const
|
bool VCommandLine::IsGuiEnabled() const
|
||||||
{
|
{
|
||||||
|
|
|
@ -101,9 +101,6 @@ public:
|
||||||
//@brief gets filenames which should be loaded
|
//@brief gets filenames which should be loaded
|
||||||
QStringList OptInputFileNames() const;
|
QStringList OptInputFileNames() const;
|
||||||
|
|
||||||
//@brief gets locale name
|
|
||||||
QString OptLocale() const;
|
|
||||||
|
|
||||||
bool IsGuiEnabled()const;
|
bool IsGuiEnabled()const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user