Skip to content

Commit a8772bb

Browse files
committed
Translate language supported.
Language dependent variable removed.
1 parent dc4b638 commit a8772bb

File tree

7 files changed

+485
-65
lines changed

7 files changed

+485
-65
lines changed

DSTDedicatedServerGUI.pro

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,5 @@ HEADERS += mainwindow.h \
2121
dstdatastructure.h
2222

2323
FORMS += mainwindow.ui
24+
25+
TRANSLATIONS += translate/dstdsgui_zh_HK.ts

main.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,16 @@
11
#include "mainwindow.h"
22
#include <QApplication>
3+
#include <QTranslator>
4+
#include <QDebug>
35

46
int main(int argc, char *argv[])
57
{
68
QApplication a(argc, argv);
9+
QTranslator translator;
10+
QLocale locale;
11+
translator.load("translations/dstdsgui_" + locale.name() + ".ts");
12+
a.installTranslator(&translator);
13+
714
MainWindow w;
815
w.show();
916

mainwindow.cpp

Lines changed: 93 additions & 60 deletions
Large diffs are not rendered by default.

mainwindow.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#include <QScrollBar>
2727
#include <QSettings>
2828
#include <QStandardPaths>
29+
#include <QTranslator>
2930

3031
#include "ioworldgenoverridelua.h"
3132
#include "dstdatastructure.h"
@@ -87,7 +88,7 @@ private slots:
8788
bool checkServerExists(QString dstds_path, bool reload_template = true);
8889
bool firstServerSetup();
8990

90-
void changeSettings(int world_num, QString name, QString value);
91+
void changeINISettings(int world_num, QString name);
9192
bool readINI(int world_num, QString file_path, bool ui_c = false);
9293
bool writeINI(int world_num, QString file_path);
9394
void writeINIToGUI(int world_num);

mainwindow.ui

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -166,14 +166,14 @@
166166
<item row="2" column="1">
167167
<widget class="QLineEdit" name="lineEdit_serverPassword">
168168
<property name="text">
169-
<string>12345</string>
169+
<string/>
170170
</property>
171171
</widget>
172172
</item>
173173
<item row="1" column="1">
174174
<widget class="QLineEdit" name="lineEdit_serverDescription">
175175
<property name="text">
176-
<string>Yeah!</string>
176+
<string/>
177177
</property>
178178
</widget>
179179
</item>
@@ -200,7 +200,7 @@
200200
<item row="0" column="1">
201201
<widget class="QLineEdit" name="lineEdit_servername">
202202
<property name="text">
203-
<string>A DST Cave Server</string>
203+
<string/>
204204
</property>
205205
</widget>
206206
</item>
@@ -478,7 +478,7 @@
478478
<bool>false</bool>
479479
</property>
480480
<property name="text">
481-
<string>Server data location</string>
481+
<string>Server data directory</string>
482482
</property>
483483
</widget>
484484
</item>

translate/dstdsgui_zh_HK.qm

5.14 KB
Binary file not shown.

0 commit comments

Comments
 (0)