-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.cpp
51 lines (42 loc) · 1.35 KB
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/*! ***********************************************************************************************
*
* \file main.cpp
* \brief 类头/源文件。
*
* \version 0.1
* \date 2017/9/22
*
* \author Roy QIU <karoyqiu@gmail.com>
* \copyright © 2017 Roy QIU。
*
**************************************************************************************************/
#include "stable.h"
#include "mainwindow.h"
static void loadTranslation(const QLocale &locale, const QString &baseName)
{
QTranslator *ts = new QTranslator;
if (ts->load(locale, baseName, QS("_"), QLibraryInfo::location(QLibraryInfo::TranslationsPath)))
{
QCoreApplication::installTranslator(ts);
}
else
{
qWarning() << "Failed to load translation" << baseName;
delete ts;
}
}
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QLocale loc;
qDebug() << "Current locale:" << loc << loc.uiLanguages();
loadTranslation(loc, QS("qt"));
loadTranslation(loc, QS("jsonviewer"));
QApplication::setApplicationName(QS("jsonviewer"));
QApplication::setApplicationDisplayName(QApplication::translate("main", "JSON Viewer"));
QApplication::setOrganizationName(QS("Zhongfu"));
QApplication::setOrganizationDomain(QS("zhongfu.net"));
MainWindow w;
w.show();
return a.exec();
}