-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
46 lines (35 loc) · 1.12 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
/**************************************************************************
** Author: Dariusz Stefanski
** Date: 14 Jun 2012
**************************************************************************/
#include "MainWindow.h"
#include <QApplication>
#include <QDebug>
#include <QLocale>
#include <QTranslator>
void installTranslator(QApplication& app);
void setAppName();
int main(int argc, char *argv[]) {
QApplication app(argc, argv);
installTranslator(app);
setAppName();
MainWindow mainWin;
mainWin.show();
return app.exec();
}
void setAppName() {
// QSettings uses it
QCoreApplication::setOrganizationName("DarekCorporation");
QCoreApplication::setApplicationName("dontforget");
}
void installTranslator(QApplication& app) {
QString localeName = QLocale::system().name();
qDebug() << "Detected locale: " << localeName;
QTranslator translator;
// : - take file from resources
QString filename = ":/i18n/dontforget_" + localeName;
if (!translator.load(filename)) {
Q_ASSERT(!"Translation file not found!");
}
app.installTranslator(&translator);
}