specified font family and figured out an translation file issue

master
Qiaoyong Zhong 11 years ago
parent 8f2378ada1
commit 92243ed48b

Binary file not shown.

@ -37,7 +37,7 @@
</message> </message>
<message> <message>
<source>Join the numbers and get to the &lt;b&gt;2048 tile&lt;/b&gt;!</source> <source>Join the numbers and get to the &lt;b&gt;2048 tile&lt;/b&gt;!</source>
<translation>&lt;b&gt;2048&lt;/b&gt;</translation> <translation>&lt;b&gt;2048&lt;/b&gt;</translation>
</message> </message>
<message> <message>
<source>Game Over</source> <source>Game Over</source>

@ -12,10 +12,14 @@ int main(int argc, char *argv[])
// Localization // Localization
QString locale = QLocale::system().name(); QString locale = QLocale::system().name();
qDebug() << "Locale: " + locale; QString tsFile = "2048-qt_" + locale;
QTranslator translator; QTranslator translator;
translator.load("2048-qt_" + locale); if (translator.load(tsFile, ".")) {
qDebug() << "Successfully loaded " + tsFile;
} else {
qDebug() << "Failed to load " + tsFile;
}
app.installTranslator(&translator); app.installTranslator(&translator);
QQmlApplicationEngine engine; QQmlApplicationEngine engine;

@ -11,7 +11,7 @@ ApplicationWindow {
width: 550 width: 550
height: 740 height: 740
title: qsTr("2048 Game"); title: qsTr("2048 Game");
flags: Qt.Window | Qt.MSWindowsFixedSizeDialogHint // flags: Qt.Window | Qt.WindowTitleHint | Qt.WindowMinimizeButtonHint | Qt.WindowCloseButtonHint | Qt.CustomizeWindowHint
x: (Screen.width - width) / 2 x: (Screen.width - width) / 2
y: (Screen.height - height) / 2 y: (Screen.height - height) / 2
@ -64,6 +64,7 @@ ApplicationWindow {
Text { Text {
id: gameName id: gameName
font.family: "Sans-serif"
font.pixelSize: 55 font.pixelSize: 55
font.bold: true font.bold: true
text: "2048" text: "2048"
@ -86,6 +87,7 @@ ApplicationWindow {
text: (index == 0) ? qsTr("SCORE") : qsTr("BEST") text: (index == 0) ? qsTr("SCORE") : qsTr("BEST")
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
y: 7 y: 7
font.family: "Sans-serif"
font.pixelSize: 13 font.pixelSize: 13
color: helper.myColors.fglight color: helper.myColors.fglight
} }
@ -93,6 +95,7 @@ ApplicationWindow {
text: scoreText text: scoreText
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
y: 25 y: 25
font.family: "Sans-serif"
font.pixelSize: 25 font.pixelSize: 25
font.bold: true font.bold: true
color: "white" color: "white"
@ -102,6 +105,7 @@ ApplicationWindow {
Text { Text {
id: addScoreText id: addScoreText
font.family: "Sans-serif"
font.pixelSize: 25 font.pixelSize: 25
font.bold: true font.bold: true
color: Qt.rgba(119/255, 110/255, 101/255, 0.9); color: Qt.rgba(119/255, 110/255, 101/255, 0.9);
@ -142,6 +146,7 @@ ApplicationWindow {
height: 40 height: 40
text: qsTr("Join the numbers and get to the <b>2048 tile</b>!") text: qsTr("Join the numbers and get to the <b>2048 tile</b>!")
color: helper.myColors.fgdark color: helper.myColors.fgdark
font.family: "Sans-serif"
font.pixelSize: 16 font.pixelSize: 16
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
} }
@ -160,6 +165,7 @@ ApplicationWindow {
anchors.centerIn: parent anchors.centerIn: parent
text: qsTr("New Game") text: qsTr("New Game")
color: helper.myColors.fgbutton color: helper.myColors.fgbutton
font.family: "Sans-serif"
font.pixelSize: 18 font.pixelSize: 18
font.bold: true font.bold: true
} }

Loading…
Cancel
Save