Commit 14c969e1 authored by Sandro Andrade's avatar Sandro Andrade

Fix wrong translation of exercise instructions

parent 9a1c249e
#! /usr/bin/env bash
$EXTRACTRC `find . -name \*.ui -o -name \*.rc -o -name \*.kcfg` >> rc.cpp
find exercises/ -name *.json | while read FILE; do cat $FILE | sed -n 's/"name"\s*:\s*"\(.*\)",/\1/p' | sed -n 's/\s*//p' >> strings.txt; done
cat strings.txt | while read STR; do printf "i18nc(\"technical term, do you have a musician friend?\", \"$STR\")\n" >> rc.cpp; done
find exercises/ -name *.json | while read FILE; do cat $FILE | sed -n 's/"userMessage"\s*:\s*"\(.*\)",/\1/p' | sed -n 's/\s*//p' >> strings.txt; done
sort -u strings.txt | while read STR; do printf "i18nc(\"technical term, do you have a musician friend?\", \"$STR\")\n" >> rc.cpp; done
$XGETTEXT `find . -name \*.cpp -o -name \*.qml` -o $podir/minuet.pot
rm -f rc.cpp
rm -f strings.txt
......@@ -4,7 +4,7 @@
"name": "Chords",
"root": "21..104",
"playMode": "chord",
"type": "chord",
"userMessage": "the chord",
"children": [
{
"name": "Root Position",
......
......@@ -4,7 +4,7 @@
"name": "Intervals",
"root": "21..104",
"playMode": "scale",
"type": "interval",
"userMessage": "the interval",
"children": [
{
"name": "Ascending Melodic Intervals",
......
......@@ -4,7 +4,7 @@
"name": "Intervals",
"root": "21..104",
"playMode": "scale",
"type": "interval",
"userMessage": "the interval",
"children": [
{
"name": "Descending Melodic Intervals",
......
......@@ -3,7 +3,7 @@
{
"name": "Rhythm",
"playMode": "rhythm",
"type": "rhythm",
"userMessage": "the rhythm",
"template": "lilypond-templates/rhythm.ly.tmpl",
"children": [
{
......
......@@ -3,7 +3,7 @@
{
"name": "Rhythm",
"playMode": "rhythm",
"type": "rhythm",
"userMessage": "the rhythm",
"template": "lilypond-templates/rhythm.ly.tmpl",
"children": [
{
......
......@@ -4,11 +4,10 @@
"name": "Scales",
"root": "21..104",
"playMode": "scale",
"type": "scale",
"userMessage": "the scale",
"children": [
{
"name": "Major Scale and its Modes",
"playMode": "scale",
"options": [
{
"name": "Ionian",
......
......@@ -49,7 +49,8 @@ int main(int argc, char **argv)
KAboutLicense::GPL,
i18n("(c) 2016, Sandro S. Andrade (sandroandrade@kde.org)"));
aboutData.addAuthor(i18n("Sandro S. Andrade"),i18n("Author"), QStringLiteral("sandroandrade@kde.org"));
aboutData.addAuthor(i18n("Sandro S. Andrade"),i18n("Developer"), QStringLiteral("alessandro.longo@kdemail.net"));
aboutData.addAuthor(i18n("Alessandro Longo"),i18n("Minuet Icon Designer"), QStringLiteral("sandroandrade@kde.org"));
application.setWindowIcon(QIcon::fromTheme(QStringLiteral("minuet")));
QCommandLineParser parser;
parser.addHelpOption();
......
......@@ -28,7 +28,7 @@ Item {
property var chosenExercises
property var chosenColors: [4]
property string exerciseType
property string userMessage
property Item answerRectangle
property var colors: ["#8dd3c7", "#ffffb3", "#bebada", "#fb8072", "#80b1d3", "#fdb462", "#b3de69", "#fccde5", "#d9d9d9", "#bc80bd", "#ccebc5", "#ffed6f", "#a6cee3", "#1f78b4", "#b2df8a", "#33a02c", "#fb9a99", "#e31a1c", "#fdbf6f", "#ff7f00", "#cab2d6", "#6a3d9a", "#ffff99", "#b15928"]
......@@ -66,8 +66,8 @@ Item {
exerciseView.visible = true
exerciseView.state = "initial"
}
function changeExerciseType(type) {
exerciseType = type
function changeUserMessage(message) {
userMessage = message
}
function checkAnswers(answers) {
var answersOk = true
......@@ -94,7 +94,8 @@ Item {
horizontalAlignment: Text.AlignHCenter
font.pointSize: 18
textFormat: Text.RichText
text: i18n("Hear the %1 and then choose an answer from options below!<br/>Click 'play question' if you want to hear again!", exerciseType)
text: i18n("Hear %1 and then choose an answer from options below!<br/>Click 'play question' if you want to hear again!",
i18nc("technical term, do you have a musician friend?", userMessage))
}
Row {
anchors { horizontalCenter: parent.horizontalCenter }
......@@ -113,11 +114,13 @@ Item {
chosenColors[i] = answerGrid.children[j].color
break
}
messageText.text = i18n("Hear the %1 and then choose an answer from options below!<br/>Click 'play question' if you want to hear again!", exerciseType)
if (exerciseType != "rhythm")
messageText.text = i18n("Hear %1 and then choose an answer from options below!<br/>Click 'play question' if you want to hear again!",
i18nc("technical term, do you have a musician friend?", userMessage))
if (userMessage != "the rhythm")
answerHoverEnter(0, exerciseController.chosenRootNote(), 0, "white")
exerciseController.playChoosenExercise()
}
style: MinuetButtonStyle{ labelHorizontalAlignment: Qt.AlignHCenter }
}
Button {
id: playQuestionButton
......@@ -125,6 +128,7 @@ Item {
width: 124; height: 44
text: i18n("play question")
onClicked: exerciseController.playChoosenExercise()
style: MinuetButtonStyle{ labelHorizontalAlignment: Qt.AlignHCenter }
}
Button {
id: giveUpButton
......@@ -132,7 +136,7 @@ Item {
width: 124; height: 44
text: i18n("give up")
onClicked: {
if (exerciseType != "rhythm") {
if (userMessage != "the rhythm") {
highlightRightAnswer()
}
else {
......@@ -140,6 +144,7 @@ Item {
exerciseView.state = "nextQuestion"
}
}
style: MinuetButtonStyle{ labelHorizontalAlignment: Qt.AlignHCenter }
}
}
Rectangle {
......@@ -162,14 +167,14 @@ Item {
property var model
property int index
width: (exerciseType != "rhythm") ? 120:119
height: (exerciseType != "rhythm") ? 40:59
width: (userMessage != "the rhythm") ? 120:119
height: (userMessage != "the rhythm") ? 40:59
Text {
id: option
property string originalText: model.name
visible: exerciseType != "rhythm"
visible: userMessage != "the rhythm"
text: i18nc("technical term, do you have a musician friend?", model.name)
width: parent.width - 4
anchors.centerIn: parent
......@@ -181,14 +186,14 @@ Item {
id: rhythmImage
anchors.centerIn: parent
visible: exerciseType == "rhythm"
source: (exerciseType == "rhythm") ? "exercise-images/" + model.name + ".png":""
visible: userMessage == "the rhythm"
source: (userMessage == "the rhythm") ? "exercise-images/" + model.name + ".png":""
fillMode: Image.Pad
}
MouseArea {
anchors.fill: parent
onClicked: {
if (exerciseType != "rhythm") {
if (userMessage != "the rhythm") {
onExited()
if (option.originalText == chosenExercises[0])
messageText.text = i18n("Congratulations!<br/>You answered correctly!")
......@@ -204,7 +209,7 @@ Item {
hoverEnabled: true
onEntered: {
answerRectangle.color = Qt.darker(answerRectangle.color, 1.1)
if (exerciseType != "rhythm") {
if (userMessage != "the rhythm") {
model.sequence.split(' ').forEach(function(note) {
answerHoverEnter(0, exerciseController.chosenRootNote() + parseInt(note), 0, colors[answerRectangle.index])
})
......@@ -212,7 +217,7 @@ Item {
}
onExited: {
answerRectangle.color = colors[answerRectangle.index]
if (exerciseType != "rhythm") {
if (userMessage != "the rhythm") {
if (!animation.running)
model.sequence.split(' ').forEach(function(note) {
answerHoverExit(0, exerciseController.chosenRootNote() + parseInt(note), 0)
......
......@@ -29,9 +29,9 @@ Item {
property int menuBarWidth: 280
function exerciseTypeChanged(type) {
pianoView.visible = (type != "rhythm" && type != "exercise")
rhythmAnswerView.visible = (type == "rhythm")
function userMessageChanged(message) {
pianoView.visible = (message != "the rhythm" && message != "exercise")
rhythmAnswerView.visible = (message == "the rhythm")
}
function exerciseViewStateChanged(state) {
if (state == "waitingForAnswer")
......@@ -83,8 +83,8 @@ Item {
minuetMenu.breadcrumbPressed.connect(exerciseView.clearExerciseGrid)
minuetMenu.breadcrumbPressed.connect(rhythmAnswerView.resetAnswers)
minuetMenu.itemChanged.connect(exerciseView.itemChanged)
minuetMenu.exerciseTypeChanged.connect(exerciseView.changeExerciseType)
minuetMenu.exerciseTypeChanged.connect(mainItem.exerciseTypeChanged)
minuetMenu.userMessageChanged.connect(exerciseView.changeUserMessage)
minuetMenu.userMessageChanged.connect(mainItem.userMessageChanged)
minuetMenu.itemChanged.connect(rhythmAnswerView.resetAnswers)
sequencer.noteOn.connect(pianoView.noteOn)
......
......@@ -30,11 +30,11 @@ Item {
id: minuetMenu
property Item selectedMenuItem
property string type
property string message
signal breadcrumbPressed
signal itemChanged(var model)
signal exerciseTypeChanged(string type)
signal userMessageChanged(string message)
function itemClicked(delegateRect, index) {
var model = delegateRect.ListView.view.model[index].options
......@@ -54,9 +54,9 @@ Item {
minuetMenu.breadcrumbPressed()
selectedMenuItem = null
stackView.pop()
exerciseTypeChanged("exercise")
userMessageChanged("exercise")
if (stackView.depth == 1)
type = "exercise"
message = "exercise"
}
}
StackView {
......@@ -77,13 +77,13 @@ Item {
text: i18nc("technical term, do you have a musician friend?", modelData.name)
checkable: (!delegateRect.ListView.view.model[index].children) ? true:false
onClicked: {
var exerciseType = delegateRect.ListView.view.model[index].type
if (exerciseType != undefined)
type = exerciseType
var userMessage = delegateRect.ListView.view.model[index].userMessage
if (userMessage != undefined)
message = userMessage
var children = delegateRect.ListView.view.model[index].children
if (!children) {
if (selectedMenuItem != undefined) selectedMenuItem.checked = false
exerciseTypeChanged(type)
userMessageChanged(message)
itemClicked(delegateRect, index)
selectedMenuItem = delegateRect
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment