From bfbf9dcf9d955dd6df982a4818459352974614eb Mon Sep 17 00:00:00 2001 From: Sergey Basalaev Date: Sat, 17 May 2014 13:30:44 +0700 Subject: [PATCH 1/3] Russian translation --- 2048-qt.pro | 2 +- ts/2048-qt_ru.ts | 138 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 139 insertions(+), 1 deletion(-) create mode 100644 ts/2048-qt_ru.ts diff --git a/2048-qt.pro b/2048-qt.pro index b840e38..e612ef6 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.ts VERSION = 0.1.4 diff --git a/ts/2048-qt_ru.ts b/ts/2048-qt_ru.ts new file mode 100644 index 0000000..8c8e573 --- /dev/null +++ b/ts/2048-qt_ru.ts @@ -0,0 +1,138 @@ + + + + + main + + + 2048 Game + Игра 2048 + + + + File + Файл + + + + + New Game + Новая игра + + + + Exit + Выход + + + + Settings + Настройки + + + + Labeling + Метки + + + + 2048 + 2048 + + + + Degree + Степень + + + + Military Rank + Военный ранг + + + + PRC + + + + + Language + Язык + + + + English + Английский + + + + Simplified Chinese + Упрощённый китайский + + + + 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? + Вы выиграли! Продолжить играть? + + + From c2e15100a41cf78137b2edd152eaae0c606d0425 Mon Sep 17 00:00:00 2001 From: Qiaoyong Zhong Date: Tue, 20 May 2014 16:18:27 +0800 Subject: [PATCH 2/3] added Russian translation --- 2048-qt.pro | 2 +- README.md | 2 ++ qml/main.qml | 12 +++++++++ resources.qrc | 1 + ts/2048-qt_ru_RU.qm | Bin 0 -> 1969 bytes ts/{2048-qt_ru.ts => 2048-qt_ru_RU.ts} | 35 ++++++++++++++----------- ts/2048-qt_zh_CN.qm | Bin 1465 -> 1509 bytes ts/2048-qt_zh_CN.ts | 33 +++++++++++++---------- 8 files changed, 55 insertions(+), 30 deletions(-) create mode 100644 ts/2048-qt_ru_RU.qm rename ts/{2048-qt_ru.ts => 2048-qt_ru_RU.ts} (81%) diff --git a/2048-qt.pro b/2048-qt.pro index e612ef6..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 ts/2048-qt_ru.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/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 0000000000000000000000000000000000000000..0c0a71c800045a6ec6aa2574b0062bea233f2d9e GIT binary patch literal 1969 zcmZ`)O>7%g5FXp(coUKef~i6Y?HW>A)U?^SPMaUwN$i-ECd5q)DmheQ-Ml#4uGhg{ z(^g0zqzd&=5C`B=gj9(e5(iKbQdM!`goLQXr9E(}gpfc&NN}vm_twsHb`xx^)^GRw zzM1)E-gEl9wSgc1`s|aR5`*8rar4fvIU>4C^xAnMUZqIsGS>Kc;VMxmO#CzBex3O4 zLEOI~{?i}|muUXeAAnk=vsVRCv`m$ApA&WM3Ey=8!SfHo_lN!l?wv?80sYXu$a{DG z1@1O~`TH%bk3=85Jx3IIKeiHo6S#Qn`jHCO$=DYUqTnCY!fRh4iKe#nHF%M8-L@%p z?|1(({4V0m^)4Crp!0g~$G&2HfOku{K5tfqpRqH76={5hy>-j{|g^r+Azvc$O#ST~T5Mr(#=;4S#?h?&k$Az_64;a^bSI zqp~43AUf3ny=2*e`1?97gWe>r49|Os8;aH~yQUZ45_Nwbga6N^gktw7cEV4WKFPit zoJ8PGI6fupO+WMk@8?lIjl5FuC&NXQ1&c8_^H|TqJ%fh5RSp%5@`5)~Sv=2sh#W7X z$!RK679pkAIfTq_8<;eW$hX__9z9*N9Npazy3?$dMZKY$&YE5kuI|>n$LVs`n`sxO zrbo)zKzThphm=Syw+)a@l_L>6OY*yn#thQKDTC4^3&WudlNK&`IvHroi1K8b@N7M%a-BP4 z3$r2gx@f=*j0DDHvtFyz&8i%as(Dd(&+K*^^+wxsSH2PJ>*Bn7%wMdA?Qn=g{G19B zE#-?V1wX1E9tYA=c&**ohM#g6$5zXemw6c#Z?#q)HF9ir9y|RdtGa1h>y}v4^Ba~U z8i6_7D^DPpCar4sS?(&8No=*&)X!RuKauS2EJ{G>fM;_GR!{K>)s!u5*`jHszE7%O pvYdpTuQ{0HCcL-JD;VkNPQYvUKk9oT^zg;U9>v4_aJc8m{{Wl=J%s=O literal 0 HcmV?d00001 diff --git a/ts/2048-qt_ru.ts b/ts/2048-qt_ru_RU.ts similarity index 81% rename from ts/2048-qt_ru.ts rename to ts/2048-qt_ru_RU.ts index 8c8e573..d4b6fa1 100644 --- a/ts/2048-qt_ru.ts +++ b/ts/2048-qt_ru_RU.ts @@ -1,6 +1,6 @@ - + main @@ -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? Вы выиграли! Продолжить играть? diff --git a/ts/2048-qt_zh_CN.qm b/ts/2048-qt_zh_CN.qm index 308189d82977ad3ba68cc5f4721b9fedfa0c9060..d00e217926e8260fb720c3ea81c684ddff50c2d1 100644 GIT binary patch delta 113 zcmdnV{giux2;+^3qIO&?JPhfv^B5Rd+9t-zGX_trbu>9OUyp%-`32`|oqC}78XiA` z8w?DLGCWf*mjcCAcy==u1I6`txAo0tU|{-{3FLg<`06dQsQ;1fw;T*Wzy`$ZL8ZmT MnTdImPq2Ih07L~Li2wiq delta 64 zcmaFLy_0)_2;+r`qIO)&FBsBe=P@v_Bu$K!XVjlq>&X6Eryj`fn0Qv4kBfI(-)sg3 TreB#rk@Firy=9)v%=!obmT(n8 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? 你赢了!要继续玩吗? From ca2e3cd5c4407ab8f2036d7107525e3ee3ff1f88 Mon Sep 17 00:00:00 2001 From: Qiaoyong Zhong Date: Tue, 20 May 2014 16:36:07 +0800 Subject: [PATCH 3/3] avoided trying to load English translation file --- main.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) 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;