diff --git a/2048-qt.pro b/2048-qt.pro index b840e38..b10d888 100644 --- a/2048-qt.pro +++ b/2048-qt.pro @@ -29,7 +29,7 @@ HEADERS += \ myclass.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 diff --git a/README.md b/README.md index 403158a..dd86b79 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,7 @@ A clone of [2048](https://github.com/gabrielecirulli/2048), implemented in Qt. - PRC (天朝) - Multi-language support, currently - English + - Russian (by [Sergey Basalaev](https://github.com/SBasalaev)) - Simplified Chinese ## Screenshots @@ -52,4 +53,5 @@ sudo apt-get install 2048-qt ## Todo +- Allow the user to add his own label systems - AI support diff --git a/main.cpp b/main.cpp index ba58fe2..f44cf9d 100644 --- a/main.cpp +++ b/main.cpp @@ -20,15 +20,18 @@ int main(int argc, char *argv[]) locale = QLocale::system().name(); settings.setValue("language", locale); } - QString tsFile = "2048-qt_" + locale; QTranslator translator; - if (translator.load(tsFile, ":/ts")) { - qDebug() << "Successfully loaded " + tsFile; - } else { - qDebug() << "Failed to load " + tsFile; + if (! locale.startsWith("en")) { + QString tsFile = "2048-qt_" + locale; + + if (translator.load(tsFile, ":/ts")) { + qDebug() << "Successfully loaded " + tsFile; + app.installTranslator(&translator); + } else { + qDebug() << "Failed to load " + tsFile; + } } - app.installTranslator(&translator); QQmlApplicationEngine engine; diff --git a/qml/main.qml b/qml/main.qml index b258090..1bc8631 100644 --- a/qml/main.qml +++ b/qml/main.qml @@ -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 { text: qsTr("Simplified Chinese") checkable: true diff --git a/resources.qrc b/resources.qrc index d064a1c..8e26ef5 100644 --- a/resources.qrc +++ b/resources.qrc @@ -1,6 +1,7 @@ ts/2048-qt_zh_CN.qm + ts/2048-qt_ru_RU.qm qml/main.qml qml/2048.js qml/Tile.qml diff --git a/ts/2048-qt_ru_RU.qm b/ts/2048-qt_ru_RU.qm new file mode 100644 index 0000000..0c0a71c Binary files /dev/null and b/ts/2048-qt_ru_RU.qm differ diff --git a/ts/2048-qt_ru_RU.ts b/ts/2048-qt_ru_RU.ts new file mode 100644 index 0000000..d4b6fa1 --- /dev/null +++ b/ts/2048-qt_ru_RU.ts @@ -0,0 +1,143 @@ + + + + + main + + + 2048 Game + Игра 2048 + + + + File + Файл + + + + + New Game + Новая игра + + + + Exit + Выход + + + + Settings + Настройки + + + + Labeling + Метки + + + + 2048 + 2048 + + + + Degree + Степень + + + + Military Rank + Военный ранг + + + + PRC + + + + + Language + Язык + + + + English + Английский + + + + Simplified Chinese + Упрощённый китайский + + + + Russian + + + + + Help + Справка + + + + About + О программе + + + + About Qt + О Qt + + + + SCORE + СЧЁТ + + + + BEST + ЛУЧШИЙ + + + + Join the numbers and get to the <b>2048 tile</b>! + Объединяйте числа, чтобы получить <b>плитку 2048</b>! + + + + Language Setting Hint + Подсказка установки языка + + + + Please restart the program to make the language setting take effect. + Пожалуйста, перезапустите программу, чтобы применить языковые настройки. + + + + About 2048-Qt + О программе 2048-Qt + + + + Game Over + Игра окончена + + + + Game Over! + Игра окончена! + + + + You Win + Вы выиграли + + + + You win! Continue playing? + Вы выиграли! Продолжить играть? + + + diff --git a/ts/2048-qt_zh_CN.qm b/ts/2048-qt_zh_CN.qm index 308189d..d00e217 100644 Binary files a/ts/2048-qt_zh_CN.qm and b/ts/2048-qt_zh_CN.qm differ diff --git a/ts/2048-qt_zh_CN.ts b/ts/2048-qt_zh_CN.ts index 3695eea..d305805 100644 --- a/ts/2048-qt_zh_CN.ts +++ b/ts/2048-qt_zh_CN.ts @@ -15,7 +15,7 @@ - + New Game 新游戏 @@ -70,67 +70,72 @@ 简体中文 - + + Russian + 俄语 + + + Help 帮助 - + About 关于 - + About Qt 关于Qt - + SCORE 得分 - + BEST 最高分 - + Join the numbers and get to the <b>2048 tile</b>! 把相同的数字相加,得到<b>2048</b>! - + Language Setting Hint 语言设置提示 - + Please restart the program to make the language setting take effect. 为了让语言设置生效,请重启程序。 - + About 2048-Qt 关于2048-Qt - + Game Over 游戏结束 - + Game Over! 游戏结束! - + You Win 你赢了 - + You win! Continue playing? 你赢了!要继续玩吗?