-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
30 lines (28 loc) · 751 Bytes
/
Copy pathmain.cpp
File metadata and controls
30 lines (28 loc) · 751 Bytes
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
#include "mainwindow.h"
#include <QApplication>
#include <QLocale>
#include <QTranslator>
#include "readwritefile.h"
int main(int argc, char *argv[])
{
if(!ReadWriteFile::isexist("./language.txt")){
ReadWriteFile::WriteCach("en","./language.txt");
}
//检查语言设置
if(ReadWriteFile::ReadCach(1,"./language.txt").at(0).toStdString()=="zh"){
QApplication a(argc, argv);
QTranslator translator;
if(translator.load("zh.qm")){
a.installTranslator(&translator);
MainWindow w;
w.show();
return a.exec();
}
//默认English
}else{
QApplication a(argc, argv);
MainWindow w;
w.show();
return a.exec();
}
}