diff --git a/src/app/tape/mapplication.cpp b/src/app/tape/mapplication.cpp index 7e714acf2..e12175a75 100644 --- a/src/app/tape/mapplication.cpp +++ b/src/app/tape/mapplication.cpp @@ -313,7 +313,7 @@ void MApplication::InitOptions() qDebug()<<"Command-line arguments:"<arguments(); qDebug()<<"Process ID:"<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"; if (QIcon::hasThemeIcon(GENERIC_ICON_TO_CHECK) == false) @@ -589,6 +589,11 @@ void MApplication::ParseCommandLine(const QStringList &arguments) testMode = parser.isSet(testOption); + if (not testMode) + { + LoadTranslation(TapeSettings()->GetLocale()); + } + const QStringList args = parser.positionalArguments(); if (args.count() > 0) { diff --git a/src/app/valentina/core/vapplication.cpp b/src/app/valentina/core/vapplication.cpp index 880f94f8e..32aa47158 100644 --- a/src/app/valentina/core/vapplication.cpp +++ b/src/app/valentina/core/vapplication.cpp @@ -171,11 +171,14 @@ const QString VApplication::GistFileName = QStringLiteral("gist.json"); */ VApplication::VApplication(int &argc, char **argv) : VAbstractApplication(argc, argv), - trVars(nullptr), autoSaveTimer(nullptr), + trVars(nullptr), + autoSaveTimer(nullptr), lockLog(), 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); undoStack = new QUndoStack(this); } @@ -499,7 +502,10 @@ void VApplication::InitOptions() qDebug()<<"Command-line arguments:"<arguments(); qDebug()<<"Process ID:"<applicationPid(); - InitTranslation(); + if (VApplication::CheckGUI())// By default console version uses system locale + { + LoadTranslation(ValentinaSettings()->GetLocale()); + } static const char * GENERIC_ICON_TO_CHECK = "document-open"; 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() { diff --git a/src/app/valentina/core/vapplication.h b/src/app/valentina/core/vapplication.h index 3d4ab5dfb..a2f658b0f 100644 --- a/src/app/valentina/core/vapplication.h +++ b/src/app/valentina/core/vapplication.h @@ -60,7 +60,6 @@ public: virtual bool notify(QObject * receiver, QEvent * event) Q_DECL_OVERRIDE; void InitOptions(); - void InitTranslation(); virtual QString translationsPath() const Q_DECL_OVERRIDE; QString TapeFilePath() const; diff --git a/src/app/valentina/core/vcmdexport.cpp b/src/app/valentina/core/vcmdexport.cpp index 0edcae108..8543deff6 100644 --- a/src/app/valentina/core/vcmdexport.cpp +++ b/src/app/valentina/core/vcmdexport.cpp @@ -50,9 +50,6 @@ const static auto SINGLE_OPTION_GAPWIDTH = QStringLiteral("G"); const static auto LONG_OPTION_GROUPPING = QStringLiteral("groups"); 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)) //--------------------------------------------------------------------------------------------------------------------- @@ -142,12 +139,7 @@ VCommandLine::VCommandLine() : parser() {LONG_OPTION_GROUPPING, new QCommandLineOption(QStringList() << SINGLE_OPTION_GROUPPING << LONG_OPTION_GROUPPING, tr("Sets layout groupping (export mode): ") - + 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"))} + + DialogLayoutSettings::MakeGroupsHelp(), tr("Grouping type"), "2")} }), isGuiEnabled(false) { @@ -402,17 +394,6 @@ QStringList VCommandLine::OptInputFileNames() const 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 { diff --git a/src/app/valentina/core/vcmdexport.h b/src/app/valentina/core/vcmdexport.h index 11709316c..bc268d5ed 100644 --- a/src/app/valentina/core/vcmdexport.h +++ b/src/app/valentina/core/vcmdexport.h @@ -101,9 +101,6 @@ public: //@brief gets filenames which should be loaded QStringList OptInputFileNames() const; - //@brief gets locale name - QString OptLocale() const; - bool IsGuiEnabled()const; };