by default for console version use system locale.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2015-09-28 18:34:29 +03:00
parent e236757d57
commit 77dd8f0c77
5 changed files with 16 additions and 41 deletions

View File

@ -313,7 +313,7 @@ void MApplication::InitOptions()
qDebug()<<"Command-line arguments:"<<this->arguments();
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";
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)
{

View File

@ -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:"<<this->arguments();
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";
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()
{

View File

@ -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;

View File

@ -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
{

View File

@ -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;
};