summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSandro S. Andrade <sandroandrade@kde.org>2016-11-18 12:35:38 (GMT)
committerSandro S. Andrade <sandroandrade@kde.org>2016-11-18 12:35:38 (GMT)
commitb8e67e89d236016c8cbb5da3c57380eb9f9a4970 (patch)
tree9dd0983ea40db7006f37f92b5ce74bfe5d93637c
parent03ca0ac1112d1ed4e35070f57194e1d4424d8579 (diff)
Fix translation issues in Android
-rw-r--r--CMakeLists.txt4
-rw-r--r--src/app/qml/AboutDialog.qml2
-rw-r--r--src/app/qml/ExerciseView.qml23
-rw-r--r--src/app/qml/MinuetMenu.qml7
-rw-r--r--src/app/qml/PianoView/PianoView.qml2
-rw-r--r--src/app/uicontroller.cpp9
-rw-r--r--src/app/uicontroller.h22
7 files changed, 48 insertions, 21 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 88b422c..9367074 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -55,7 +55,9 @@ include_directories(${minuet_SOURCE_DIR}/src/ ${minuet_BINARY_DIR}/src/)
add_subdirectory(src)
add_subdirectory(data)
-add_subdirectory(doc)
+IF(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Android")
+ add_subdirectory(doc)
+ENDIF(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Android")
IF(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Android")
install(FILES org.kde.minuet.appdata.xml DESTINATION ${KDE_INSTALL_METAINFODIR})
diff --git a/src/app/qml/AboutDialog.qml b/src/app/qml/AboutDialog.qml
index 9e7792a..6b8a122 100644
--- a/src/app/qml/AboutDialog.qml
+++ b/src/app/qml/AboutDialog.qml
@@ -73,7 +73,7 @@ Popup {
Loader {
sourceComponent: aboutLabel
- onLoaded: item.text = "Minuet is a <a href='http://kde.org'>KDE</a> " + "application for music education."
+ onLoaded: item.text = "Minuet is a <a href='http://kde.org'>KDE</a> application for music education."
}
Loader {
diff --git a/src/app/qml/ExerciseView.qml b/src/app/qml/ExerciseView.qml
index 40f595e..5b3620a 100644
--- a/src/app/qml/ExerciseView.qml
+++ b/src/app/qml/ExerciseView.qml
@@ -53,7 +53,7 @@ Item {
for (var i = 0; i < length; ++i)
answerOption.createObject(answerGrid, {model: currentExerciseOptions[i], index: i, color: internal.colors[i%24]})
}
- messageText.text = "Click 'new question' to start!"
+ messageText.text = i18n("Click 'new question' to start!")
exerciseView.state = "waitingForNewQuestion"
}
}
@@ -75,7 +75,7 @@ Item {
break
}
}
- messageText.text = (internal.answersAreRight) ? "Congratulations, you answered correctly!":"Oops, not this time! Try again!"
+ messageText.text = (internal.answersAreRight) ? i18n("Congratulations, you answered correctly!"):i18n("Oops, not this time! Try again!")
if (currentExercise.numberOfSelectedOptions == 1)
highlightRightAnswer()
else
@@ -112,8 +112,7 @@ Item {
font.pointSize: Screen.width >= 1024 ? 18:14
anchors.horizontalCenter: parent.horizontalCenter
wrapMode: Text.WordWrap
- //text: (currentExercise != undefined) ? i18nc("technical term, do you have a musician friend?", currentExercise["userMessage"]):""
- text: (currentExercise != undefined) ? currentExercise["userMessage"]:""
+ text: (currentExercise != undefined) ? i18nc("technical term, do you have a musician friend?", currentExercise["userMessage"]):""
}
Text {
id: messageText
@@ -131,7 +130,7 @@ Item {
id: newPlayQuestionButton
width: 120; height: 40
- text: (exerciseView.state == "waitingForNewQuestion") ? "new question":"play question"
+ text: (exerciseView.state == "waitingForNewQuestion") ? i18n("new question"):i18n("play question")
enabled: !animation.running
onClicked: {
@@ -152,8 +151,7 @@ Item {
id: giveUpButton
width: 120; height: 40
- //text: i18n("give up")
- text: "give up"
+ text: i18n("give up")
enabled: exerciseView.state == "waitingForAnswer" && !animation.running
onClicked: {
@@ -164,8 +162,7 @@ Item {
GroupBox {
id: availableAnswers
- //title: qsTr("Available Answers")
- title: "Available Answers"
+ title: i18n("Available Answers")
anchors.horizontalCenter: parent.horizontalCenter
Layout.preferredWidth: parent.width
Layout.fillHeight: true
@@ -201,8 +198,7 @@ Item {
property string originalText: model.name
visible: currentExercise != undefined && currentExercise["playMode"] != "rhythm"
- //text: i18nc("technical term, do you have a musician friend?", model.name)
- text: model.name
+ text: i18nc("technical term, do you have a musician friend?", model.name)
width: parent.width - 4
anchors.centerIn: parent
horizontalAlignment: Qt.AlignHCenter
@@ -259,8 +255,7 @@ Item {
GroupBox {
id: yourAnswers
- //title: qsTr("Your Answer(s)")
- title: "Your Answer(s)"
+ title: i18n("Your Answer(s)")
Layout.preferredWidth: parent.width
anchors.horizontalCenter: parent.horizontalCenter
@@ -275,7 +270,7 @@ Item {
Button {
id: backspaceButton
- text: "backspace"
+ text: i18n("backspace")
anchors.horizontalCenter: parent.horizontalCenter
visible: currentExercise != undefined && currentExercise["playMode"] == "rhythm"
enabled: internal.currentAnswer > 0 && internal.currentAnswer < 4
diff --git a/src/app/qml/MinuetMenu.qml b/src/app/qml/MinuetMenu.qml
index 6ed5d33..42af6d1 100644
--- a/src/app/qml/MinuetMenu.qml
+++ b/src/app/qml/MinuetMenu.qml
@@ -83,7 +83,7 @@ Item {
currentExercise = undefined
stackView.pop()
internal.exercisePath.pop()
- currentExerciseParent.text = internal.exercisePath.toString()
+ currentExerciseParent.text = i18nc("technical term, do you have a musician friend?", internal.exercisePath.toString())
backPressed()
/*
titleText = "Minuet"
@@ -107,8 +107,7 @@ Item {
delegate: ImageItemDelegate {
id: control
width: parent.width; height: 50
-// text: i18nc("technical term, do you have a musician friend?", modelData.name)
- text: modelData.name
+ text: i18nc("technical term, do you have a musician friend?", modelData.name)
onClicked: {
var children = modelData.children
if (!children) {
@@ -117,7 +116,7 @@ Item {
else {
internal.exercisePath.push(modelData.name)
stackView.push(categoryMenu.createObject(stackView, {model: children}))
- currentExerciseParent.text = modelData.name
+ currentExerciseParent.text = i18nc("technical term, do you have a musician friend?", modelData.name)
}
}
}
diff --git a/src/app/qml/PianoView/PianoView.qml b/src/app/qml/PianoView/PianoView.qml
index 9b72c6a..c843a85 100644
--- a/src/app/qml/PianoView/PianoView.qml
+++ b/src/app/qml/PianoView/PianoView.qml
@@ -97,7 +97,7 @@ Flickable {
model: 7
Label {
- text: "Octave " + (1 + modelData)
+ text: i18nc("technical term, do you have a musician friend?", "Octave") + " " + (1 + modelData)
width: 7 * keyWidth
color: "white"
height: parent.height
diff --git a/src/app/uicontroller.cpp b/src/app/uicontroller.cpp
index 9408e1c..d5d36f8 100644
--- a/src/app/uicontroller.cpp
+++ b/src/app/uicontroller.cpp
@@ -29,6 +29,10 @@
#include <QQmlContext>
#include <QQmlApplicationEngine>
+#ifndef Q_OS_ANDROID
+#include <KLocalizedContext>
+#endif
+
namespace Minuet
{
@@ -46,6 +50,11 @@ bool UiController::initialize(Core *core)
QQmlApplicationEngine *engine = new QQmlApplicationEngine(this);
QQmlContext *rootContext = engine->rootContext();
rootContext->setContextProperty(QStringLiteral("core"), core);
+#ifndef Q_OS_ANDROID
+ rootContext->setContextObject(new KLocalizedContext(engine));
+#else
+ rootContext->setContextObject(new DummyAndroidLocalizer(engine));
+#endif
engine->load(QUrl("qrc:/Main.qml"));
return true;
diff --git a/src/app/uicontroller.h b/src/app/uicontroller.h
index 936eb59..fec8342 100644
--- a/src/app/uicontroller.h
+++ b/src/app/uicontroller.h
@@ -25,6 +25,28 @@
#include <interfaces/iuicontroller.h>
+#ifdef Q_OS_ANDROID
+#include <QVariant>
+
+class DummyAndroidLocalizer : public QObject
+{
+ Q_OBJECT
+
+public:
+ explicit DummyAndroidLocalizer(QObject *parent = 0) : QObject(parent) { }
+
+ Q_INVOKABLE QString i18n (const QString &message, const QVariant &p1=QVariant(), const QVariant &p2=QVariant(), const QVariant &p3=QVariant(), const QVariant &p4=QVariant(), const QVariant &p5=QVariant(), const QVariant &p6=QVariant(), const QVariant &p7=QVariant(), const QVariant &p8=QVariant(), const QVariant &p9=QVariant(), const QVariant &p10=QVariant()) const
+ {
+ return message;
+ }
+
+ Q_INVOKABLE QString i18nc (const QString &context, const QString &message, const QVariant &p1=QVariant(), const QVariant &p2=QVariant(), const QVariant &p3=QVariant(), const QVariant &p4=QVariant(), const QVariant &p5=QVariant(), const QVariant &p6=QVariant(), const QVariant &p7=QVariant(), const QVariant &p8=QVariant(), const QVariant &p9=QVariant(), const QVariant &p10=QVariant()) const
+ {
+ return message;
+ }
+};
+#endif
+
namespace Minuet
{