Merge branch 'SBasalaev-master'

master
Qiaoyong Zhong 11 years ago
commit 7517dfa40b

@ -29,7 +29,7 @@ HEADERS += \
myclass.h \ myclass.h \
settings.h settings.h
TRANSLATIONS = ts/2048-qt_zh_CN.ts TRANSLATIONS = ts/2048-qt_zh_CN.ts ts/2048-qt_ru_RU.ts
VERSION = 0.1.4 VERSION = 0.1.4

@ -13,6 +13,7 @@ A clone of [2048](https://github.com/gabrielecirulli/2048), implemented in Qt.
- PRC (天朝) - PRC (天朝)
- Multi-language support, currently - Multi-language support, currently
- English - English
- Russian (by [Sergey Basalaev](https://github.com/SBasalaev))
- Simplified Chinese - Simplified Chinese
## Screenshots ## Screenshots
@ -52,4 +53,5 @@ sudo apt-get install 2048-qt
## Todo ## Todo
- Allow the user to add his own label systems
- AI support - AI support

@ -20,15 +20,18 @@ int main(int argc, char *argv[])
locale = QLocale::system().name(); locale = QLocale::system().name();
settings.setValue("language", locale); settings.setValue("language", locale);
} }
QString tsFile = "2048-qt_" + locale;
QTranslator translator; QTranslator translator;
if (translator.load(tsFile, ":/ts")) { if (! locale.startsWith("en")) {
qDebug() << "Successfully loaded " + tsFile; QString tsFile = "2048-qt_" + locale;
} else {
qDebug() << "Failed to load " + tsFile; if (translator.load(tsFile, ":/ts")) {
qDebug() << "Successfully loaded " + tsFile;
app.installTranslator(&translator);
} else {
qDebug() << "Failed to load " + tsFile;
}
} }
app.installTranslator(&translator);
QQmlApplicationEngine engine; QQmlApplicationEngine engine;

@ -101,6 +101,18 @@ ApplicationWindow {
} }
} }
} }
MenuItem {
text: qsTr("Russian")
checkable: true
exclusiveGroup: languageSettingsGroup
checked: settings.value("language") === "ru_RU" ? true : false
onTriggered: {
if (settings.value("language") !== "ru_RU") {
settings.setValue("language", "ru_RU");
changeLanguageDialog.open();
}
}
}
MenuItem { MenuItem {
text: qsTr("Simplified Chinese") text: qsTr("Simplified Chinese")
checkable: true checkable: true

@ -1,6 +1,7 @@
<RCC> <RCC>
<qresource prefix="/"> <qresource prefix="/">
<file>ts/2048-qt_zh_CN.qm</file> <file>ts/2048-qt_zh_CN.qm</file>
<file>ts/2048-qt_ru_RU.qm</file>
<file>qml/main.qml</file> <file>qml/main.qml</file>
<file>qml/2048.js</file> <file>qml/2048.js</file>
<file>qml/Tile.qml</file> <file>qml/Tile.qml</file>

Binary file not shown.

@ -0,0 +1,143 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="ru_RU">
<context>
<name>main</name>
<message>
<location filename="../qml/main.qml" line="13"/>
<source>2048 Game</source>
<translation>Игра 2048</translation>
</message>
<message>
<location filename="../qml/main.qml" line="24"/>
<source>File</source>
<translation>Файл</translation>
</message>
<message>
<location filename="../qml/main.qml" line="26"/>
<location filename="../qml/main.qml" line="276"/>
<source>New Game</source>
<translation>Новая игра</translation>
</message>
<message>
<location filename="../qml/main.qml" line="31"/>
<source>Exit</source>
<translation>Выход</translation>
</message>
<message>
<location filename="../qml/main.qml" line="38"/>
<source>Settings</source>
<translation>Настройки</translation>
</message>
<message>
<location filename="../qml/main.qml" line="40"/>
<source>Labeling</source>
<translation>Метки</translation>
</message>
<message>
<location filename="../qml/main.qml" line="42"/>
<source>2048</source>
<translation>2048</translation>
</message>
<message>
<location filename="../qml/main.qml" line="54"/>
<source>Degree</source>
<translation>Степень</translation>
</message>
<message>
<location filename="../qml/main.qml" line="66"/>
<source>Military Rank</source>
<translation>Военный ранг</translation>
</message>
<message>
<location filename="../qml/main.qml" line="78"/>
<source>PRC</source>
<translation></translation>
</message>
<message>
<location filename="../qml/main.qml" line="91"/>
<source>Language</source>
<translation>Язык</translation>
</message>
<message>
<location filename="../qml/main.qml" line="93"/>
<source>English</source>
<translation>Английский</translation>
</message>
<message>
<location filename="../qml/main.qml" line="105"/>
<source>Simplified Chinese</source>
<translation>Упрощённый китайский</translation>
</message>
<message>
<location filename="../qml/main.qml" line="117"/>
<source>Russian</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/main.qml" line="133"/>
<source>Help</source>
<translation>Справка</translation>
</message>
<message>
<location filename="../qml/main.qml" line="135"/>
<source>About</source>
<translation>О программе</translation>
</message>
<message>
<location filename="../qml/main.qml" line="139"/>
<source>About Qt</source>
<translation>О Qt</translation>
</message>
<message>
<location filename="../qml/main.qml" line="197"/>
<source>SCORE</source>
<translation>СЧЁТ</translation>
</message>
<message>
<location filename="../qml/main.qml" line="197"/>
<source>BEST</source>
<translation>ЛУЧШИЙ</translation>
</message>
<message>
<location filename="../qml/main.qml" line="257"/>
<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>
</message>
<message>
<location filename="../qml/main.qml" line="314"/>
<source>Language Setting Hint</source>
<translation>Подсказка установки языка</translation>
</message>
<message>
<location filename="../qml/main.qml" line="315"/>
<source>Please restart the program to make the language setting take effect.</source>
<translation>Пожалуйста, перезапустите программу, чтобы применить языковые настройки.</translation>
</message>
<message>
<location filename="../qml/main.qml" line="321"/>
<source>About 2048-Qt</source>
<translation>О программе 2048-Qt</translation>
</message>
<message>
<location filename="../qml/main.qml" line="328"/>
<source>Game Over</source>
<translation>Игра окончена</translation>
</message>
<message>
<location filename="../qml/main.qml" line="329"/>
<source>Game Over!</source>
<translation>Игра окончена!</translation>
</message>
<message>
<location filename="../qml/main.qml" line="339"/>
<source>You Win</source>
<translation>Вы выиграли</translation>
</message>
<message>
<location filename="../qml/main.qml" line="340"/>
<source>You win! Continue playing?</source>
<translation>Вы выиграли! Продолжить играть?</translation>
</message>
</context>
</TS>

Binary file not shown.

@ -15,7 +15,7 @@
</message> </message>
<message> <message>
<location filename="../qml/main.qml" line="26"/> <location filename="../qml/main.qml" line="26"/>
<location filename="../qml/main.qml" line="264"/> <location filename="../qml/main.qml" line="276"/>
<source>New Game</source> <source>New Game</source>
<translation></translation> <translation></translation>
</message> </message>
@ -70,67 +70,72 @@
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../qml/main.qml" line="121"/> <location filename="../qml/main.qml" line="117"/>
<source>Russian</source>
<translation></translation>
</message>
<message>
<location filename="../qml/main.qml" line="133"/>
<source>Help</source> <source>Help</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../qml/main.qml" line="123"/> <location filename="../qml/main.qml" line="135"/>
<source>About</source> <source>About</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../qml/main.qml" line="127"/> <location filename="../qml/main.qml" line="139"/>
<source>About Qt</source> <source>About Qt</source>
<translation>Qt</translation> <translation>Qt</translation>
</message> </message>
<message> <message>
<location filename="../qml/main.qml" line="185"/> <location filename="../qml/main.qml" line="197"/>
<source>SCORE</source> <source>SCORE</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../qml/main.qml" line="185"/> <location filename="../qml/main.qml" line="197"/>
<source>BEST</source> <source>BEST</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../qml/main.qml" line="245"/> <location filename="../qml/main.qml" line="257"/>
<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>
<location filename="../qml/main.qml" line="302"/> <location filename="../qml/main.qml" line="314"/>
<source>Language Setting Hint</source> <source>Language Setting Hint</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../qml/main.qml" line="303"/> <location filename="../qml/main.qml" line="315"/>
<source>Please restart the program to make the language setting take effect.</source> <source>Please restart the program to make the language setting take effect.</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../qml/main.qml" line="309"/> <location filename="../qml/main.qml" line="321"/>
<source>About 2048-Qt</source> <source>About 2048-Qt</source>
<translation>2048-Qt</translation> <translation>2048-Qt</translation>
</message> </message>
<message> <message>
<location filename="../qml/main.qml" line="316"/> <location filename="../qml/main.qml" line="328"/>
<source>Game Over</source> <source>Game Over</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../qml/main.qml" line="317"/> <location filename="../qml/main.qml" line="329"/>
<source>Game Over!</source> <source>Game Over!</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../qml/main.qml" line="327"/> <location filename="../qml/main.qml" line="339"/>
<source>You Win</source> <source>You Win</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../qml/main.qml" line="328"/> <location filename="../qml/main.qml" line="340"/>
<source>You win! Continue playing?</source> <source>You win! Continue playing?</source>
<translation></translation> <translation></translation>
</message> </message>

Loading…
Cancel
Save