4
0
mirror of https://github.com/QuasarApp/Hanoi-Towers.git synced 2025-05-14 18:39:33 +00:00

Merge pull request from QuasarApp/lang

Lang
This commit is contained in:
Andrei Yankovich 2018-05-12 17:26:18 +03:00 committed by GitHub
commit 02af3046dc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 247 additions and 11 deletions

@ -31,7 +31,7 @@ Item {
width: parent.width * 0.8
height: parent.height * 0.6
color: theme.buttonsTextColor
font.pixelSize: (ab.width < ab.height) ? ab.width / 16 : ab.height / 16
font.pixelSize: (ab.width < ab.height) ? ab.width / 25 : ab.height / 25
font.italic: true
wrapMode: Text.Wrap
text: qsTr("Product of QuasarApp

@ -49,6 +49,8 @@ HEADERS += \
TRANSLATIONS += \
languages/ru.ts \
languages/ja.ts \
languages/tr.ts \
languages/en.ts

@ -68,19 +68,19 @@
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../game.qml" line="191"/>
<location filename="../game.qml" line="192"/>
<source>You have passed the level in %0 steps and unlocked level %1
Minimum steps for this lvl: %2</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../game.qml" line="198"/>
<location filename="../game.qml" line="199"/>
<source>You have passed the level in %0 steps.
Minimum steps for this lvl: %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../game.qml" line="300"/>
<location filename="../game.qml" line="301"/>
<source>Ok</source>
<translation type="unfinished"></translation>
</message>

BIN
source/languages/ja.qm Normal file

Binary file not shown.

107
source/languages/ja.ts Normal file

@ -0,0 +1,107 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="ja_JP" sourcelanguage="en_US">
<context>
<name>BaseButton</name>
<message>
<location filename="../base/BaseButton.qml" line="8"/>
<source>ok</source>
<translation></translation>
</message>
</context>
<context>
<name>Help</name>
<message>
<location filename="../Help.qml" line="49"/>
<source>Your task is to transfer discs of different sizesfrom the left tower to any other free space.You can only transfer the top drive of the tower.You can not transfer several disks at once and put larger disks on small disks.</source>
<translation variants="yes">
<lengthvariant></lengthvariant>
<lengthvariant></lengthvariant>
<lengthvariant></lengthvariant>
</translation>
</message>
<message>
<location filename="../Help.qml" line="62"/>
<source>Do not show again:</source>
<translation></translation>
</message>
<message>
<location filename="../Help.qml" line="90"/>
<source>Ok</source>
<translation></translation>
</message>
</context>
<context>
<name>about</name>
<message>
<location filename="../about.qml" line="14"/>
<source>about</source>
<translation></translation>
</message>
<message>
<location filename="../about.qml" line="37"/>
<source>Product of QuasarApp
* Developers:
* Programmer: Yankovich N. Andrei.
* This game is distributed under the LGPLv3 license.
* Contact: https://github.com/EndrII
* Copyright (C) 2018 Yankovich N. Andrei.</source>
<translation>QuasarAppの製品
*
*Yankovich N. Andrei
*LGPLv3ライセンスの下で配布されています
*https://github.com/EndrII
* CopyrightC2018 Yankovich N. Andrei</translation>
</message>
</context>
<context>
<name>game</name>
<message>
<location filename="../game.qml" line="26"/>
<source>Start</source>
<translation></translation>
</message>
<message>
<location filename="../game.qml" line="37"/>
<source>Exit</source>
<translation></translation>
</message>
<message>
<location filename="../game.qml" line="48"/>
<source>About</source>
<translation></translation>
</message>
<message>
<location filename="../game.qml" line="67"/>
<source>Tower height:</source>
<translation></translation>
</message>
<message>
<location filename="../game.qml" line="192"/>
<source>You have passed the level in %0 steps and unlocked level %1
Minimum steps for this lvl: %2</source>
<translation> %0 %1
lvlの最小手順%2</translation>
</message>
<message>
<location filename="../game.qml" line="199"/>
<source>You have passed the level in %0 steps.
Minimum steps for this lvl: %1</source>
<translation>%0
lvlの最小手順%1</translation>
</message>
<message>
<location filename="../game.qml" line="301"/>
<source>Ok</source>
<translation></translation>
</message>
</context>
<context>
<name>main</name>
<message>
<location filename="../main.qml" line="9"/>
<source>Hanoi Towers</source>
<translation></translation>
</message>
</context>
</TS>

@ -73,21 +73,21 @@
<translation>Высота башни:</translation>
</message>
<message>
<location filename="../game.qml" line="191"/>
<location filename="../game.qml" line="192"/>
<source>You have passed the level in %0 steps and unlocked level %1
Minimum steps for this lvl: %2</source>
<translation>Вы прошли этот уровень за %0 шагов и разблокировали уровень %1
Минимум шагов на этом уровне: %2</translation>
</message>
<message>
<location filename="../game.qml" line="198"/>
<location filename="../game.qml" line="199"/>
<source>You have passed the level in %0 steps.
Minimum steps for this lvl: %1</source>
<translation>Вы прошли этот уровень за %0 шагов
Минимум шагов на этом уровне: %1</translation>
</message>
<message>
<location filename="../game.qml" line="300"/>
<location filename="../game.qml" line="301"/>
<source>Ok</source>
<translation>Ok</translation>
</message>

BIN
source/languages/tr.qm Normal file

Binary file not shown.

103
source/languages/tr.ts Normal file

@ -0,0 +1,103 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="tr_TR">
<context>
<name>BaseButton</name>
<message>
<location filename="../base/BaseButton.qml" line="8"/>
<source>ok</source>
<translation>ok</translation>
</message>
</context>
<context>
<name>Help</name>
<message>
<location filename="../Help.qml" line="49"/>
<source>Your task is to transfer discs of different sizesfrom the left tower to any other free space.You can only transfer the top drive of the tower.You can not transfer several disks at once and put larger disks on small disks.</source>
<translation>Göreviniz, sol kuleden farklı boyuttaki diskleri başka bir boş alana aktarmaktır. Kulenin sadece üst sürücüsünü aktarabilirsiniz. Birkaç diski aynı anda transfer edemez ve daha küçük disklere daha büyük diskler yerleştiremezsiniz.</translation>
</message>
<message>
<location filename="../Help.qml" line="62"/>
<source>Do not show again:</source>
<translation>Tekrar gösterme:</translation>
</message>
<message>
<location filename="../Help.qml" line="90"/>
<source>Ok</source>
<translation>ok</translation>
</message>
</context>
<context>
<name>about</name>
<message>
<location filename="../about.qml" line="14"/>
<source>about</source>
<translation>hakkında</translation>
</message>
<message>
<location filename="../about.qml" line="37"/>
<source>Product of QuasarApp
* Developers:
* Programmer: Yankovich N. Andrei.
* This game is distributed under the LGPLv3 license.
* Contact: https://github.com/EndrII
* Copyright (C) 2018 Yankovich N. Andrei.</source>
<translation>QuasarApp ürünü
* Geliştiriciler:
* Programcı: Yankovich N. Andrei.
* Bu oyun LGPLv3 lisansı altında dağıtılmaktadır.
* İletişim: https://github.com/EndrII
* Telif Hakkı (C) 2018 Yankovich N. Andrei.</translation>
</message>
</context>
<context>
<name>game</name>
<message>
<location filename="../game.qml" line="26"/>
<source>Start</source>
<translation>başla</translation>
</message>
<message>
<location filename="../game.qml" line="37"/>
<source>Exit</source>
<translation>çıkış</translation>
</message>
<message>
<location filename="../game.qml" line="48"/>
<source>About</source>
<translation>hakkında</translation>
</message>
<message>
<location filename="../game.qml" line="67"/>
<source>Tower height:</source>
<translation>Kule yüksekliği:</translation>
</message>
<message>
<location filename="../game.qml" line="192"/>
<source>You have passed the level in %0 steps and unlocked level %1
Minimum steps for this lvl: %2</source>
<translation>Seviyeyi %0 adımından geçirdiniz ve %1 kilidini açtınız
Bu lvl için minimum adımlar: %2</translation>
</message>
<message>
<location filename="../game.qml" line="199"/>
<source>You have passed the level in %0 steps.
Minimum steps for this lvl: %1</source>
<translation>Seviyeyi %0 adımından geçtiniz.
Bu lvl için minimum adımlar:%1</translation>
</message>
<message>
<location filename="../game.qml" line="301"/>
<source>Ok</source>
<translation>ok</translation>
</message>
</context>
<context>
<name>main</name>
<message>
<location filename="../main.qml" line="9"/>
<source>Hanoi Towers</source>
<translation>Hanoi Kuleleri</translation>
</message>
</context>
</TS>

@ -1,19 +1,41 @@
#include <QApplication>
#include <iostream>
//#include <QScreen>
#include <QQmlApplicationEngine>
#include <QQmlComponent>
#include "backEnd.h"
#include <QTranslator>
bool initLocale(const QString &locale, QApplication& app, QTranslator &translator){
QString defaultLocale = QLocale::system().name();
defaultLocale.truncate(defaultLocale.lastIndexOf('_'));
if(!locale.isEmpty() && translator.load(QString(":/languages/%0").arg(locale))){
return app.installTranslator(&translator);
}
if(!translator.load(QString(":/languages/%0").arg(defaultLocale))){
return false;
}
return app.installTranslator(&translator);
}
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QTranslator translator;
QString defaultLocale = QLocale::system().name();
defaultLocale.truncate(defaultLocale.lastIndexOf('_'));
QString locale = "";
translator.load(QString(":/languages/%0").arg(defaultLocale));
app.installTranslator(&translator);
if(argc > 1) {
locale = QString::fromLatin1(argv[1]);
}
if(!initLocale(locale, app, translator)){
std::cout << "error load language : " << locale.toStdString() <<std::endl;
}
QQmlApplicationEngine engine;
qmlRegisterType<BackEnd>("BackEnd",1,0,"BackEnd");

@ -24,5 +24,7 @@
<qresource prefix="/languages">
<file alias="ru">languages/ru.qm</file>
<file alias="en">languages/en.qm</file>
<file alias="ja">languages/ja.qm</file>
<file alias="tr">languages/tr.qm</file>
</qresource>
</RCC>