Started to make strings translatable

This commit is contained in:
Dorian Zedler 2021-06-20 20:11:19 +02:00
parent 30a29003a9
commit 6594304deb
Signed by: dorian
GPG key ID: 989DE36109AFA354
10 changed files with 106 additions and 103 deletions

View file

@ -23,7 +23,8 @@ Dialog {
width: app.width * 0.8 width: app.width * 0.8
modal: true modal: true
title: "Scan QR-Code" //% "Scan QR-Code"
title: qsTrId("scanQrCode")
standardButtons: Dialog.Cancel standardButtons: Dialog.Cancel
@ -36,7 +37,8 @@ Dialog {
onClosed: cameraLoader.sourceComponent = null onClosed: cameraLoader.sourceComponent = null
function setDefaultStatusText() { function setDefaultStatusText() {
_statusText = "Place the Code in the center" //% "Place the Code in the center"
_statusText = qsTrId("placeQrCodeInCenter")
_statusColor = Material.primaryTextColor _statusColor = Material.primaryTextColor
} }
@ -177,12 +179,14 @@ Dialog {
control._freezeScanning = true control._freezeScanning = true
control._statusText = "Plase wait..." //% "Plase wait"
control._statusText = qsTrId("pleaseWait") + "..."
if(app.openWidgetFromUrl(tag)) if(app.openWidgetFromUrl(tag))
control.close() control.close()
else { else {
control._statusText = "Invalid QR-Code" //% "Invalid QR-Code"
control._statusText = qsTrId("invalidQrCode")
control._statusColor = Material.color(Material.Red) control._statusColor = Material.color(Material.Red)
statusTextResetTimer.start() statusTextResetTimer.start()
control._freezeScanning = false control._freezeScanning = false

View file

@ -16,7 +16,8 @@ Rectangle {
target: speedFlowChartProduct target: speedFlowChartProduct
function onPurchaseFailed() { function onPurchaseFailed() {
purchaseBt.text = qsTr("Purchase failed") //% "Purchase failed"
purchaseBt.text = qsTrId("purchaseFailed")
purchaseBt.enabled = false purchaseBt.enabled = false
buttonTextResetTimer.start() buttonTextResetTimer.start()
} }
@ -29,8 +30,10 @@ Rectangle {
repeat: false repeat: false
onTriggered: { onTriggered: {
purchaseBt.text = (speedFlowChartProduct.status === Product.Registered purchaseBt.text = (speedFlowChartProduct.status === Product.Registered
? "Buy now for " + speedFlowChartProduct.price //% "Buy now for"
: qsTr("this item is currently unavailable")) ? qsTrId("buyNowFor") + " " + speedFlowChartProduct.price
//% "This item is currently unavailable"
: qsTrId("itemUnavailable"))
purchaseBt.enabled = true purchaseBt.enabled = true
} }
} }
@ -53,7 +56,8 @@ Rectangle {
height: parent.height * 0.015 height: parent.height * 0.015
text: qsTr("This is a premium feature.") //% "This is a premium feature."
text: qsTrId("thisIsAPremiumFeature")
font.bold: true font.bold: true
font.pixelSize: height font.pixelSize: height
@ -83,8 +87,9 @@ Rectangle {
Layout.alignment: Layout.Center Layout.alignment: Layout.Center
enabled: speedFlowChartProduct.status === Product.Registered enabled: speedFlowChartProduct.status === Product.Registered
text: speedFlowChartProduct.status === Product.Registered text: speedFlowChartProduct.status === Product.Registered
? "\uf218 Buy now for " + speedFlowChartProduct.price ? "\uf218 "+ qsTrId("buyNowFor") +" " + speedFlowChartProduct.price
: qsTr("This item is currently unavailable") //% "This item is currently unavailable"
: qsTrId("itemIsUnavailable")
font.family: fa5solid.name font.family: fa5solid.name
onClicked: speedFlowChartProduct.purchase() onClicked: speedFlowChartProduct.purchase()
} }
@ -99,7 +104,8 @@ Rectangle {
visible: speedFlowChartProduct.status === Product.Registered visible: speedFlowChartProduct.status === Product.Registered
flat: true flat: true
text: "restore purchase" //% "Restore purchase"
text: qsTrId("restorePurchase")
onClicked: inAppProductStore.restorePurchases() onClicked: inAppProductStore.restorePurchases()
} }
@ -109,7 +115,8 @@ Rectangle {
Layout.alignment: Layout.Center Layout.alignment: Layout.Center
flat: true flat: true
text: "contact support" //% "contact support"
text: qsTrId("contact support")
onClicked: Qt.openUrlExternally("mailto:contact@itsblue.de") onClicked: Qt.openUrlExternally("mailto:contact@itsblue.de")
} }

View file

@ -104,10 +104,21 @@ Page {
Repeater { Repeater {
id: buttonRepeater id: buttonRepeater
property var buttons: [ property var buttons: [
["\uf059", "IFSC results", ifscDisclaimerDialog.open], //% "IFSC results"
["\uf042", Material.theme === Material.Light ? "Dark mode":"Light mode", app.toggleDarkMode], ["\uf059", qsTrId("ifscResults"), ifscDisclaimerDialog.open],
["\uf05a", "About blueROCK", aboutBluerockDisclaimerDialog.open], [
["\uf029", "Scan QR code", qrCodeScanPopup.open], "\uf042",
Material.theme === Material.Light ?
//% "Dark mode"
qsTrId("darkMode"):
//% "Light mode"
qsTrId("lightMode"),
app.toggleDarkMode
],
//% "About blueROCK"
["\uf05a", qsTrId("aboutBluerock"), aboutBluerockDisclaimerDialog.open],
//% "Scan QR code"
["\uf029", qsTrId("scanQrCode"), qrCodeScanPopup.open],
] ]
model: buttons model: buttons

View file

@ -28,7 +28,8 @@ DataListView {
property bool ready property bool ready
property string title: (params.nation === "ICC" ? "IFSC":params.nation === "GER" ? "DAV":"SAC") + " " + qsTr("calendar") + " " + control.year //% "calendar"
property string title: (params.nation === "ICC" ? "IFSC":params.nation === "GER" ? "DAV":"SAC") + " " + qsTrId("calendar") + " " + control.year
property Component headerComponent: RowLayout { property Component headerComponent: RowLayout {
@ -63,13 +64,15 @@ DataListView {
} }
} }
compCats.push( {"text": qsTr("Favorites"), "data": {"sort_rank":0, "cat_id":[-1]}} ) //% "Favorites"
compCats.push( {"text": qsTrId("favorites"), "data": {"sort_rank":0, "cat_id":[-1]}} )
compCats.sort(function(a, b) { compCats.sort(function(a, b) {
return a['data']['sort_rank'] - b['data']['sort_rank']; return a['data']['sort_rank'] - b['data']['sort_rank'];
}); });
filterSelectPu.appear(compCats, qsTr("Select Filters"), "") //% "Select filters"
filterSelectPu.appear(compCats, qsTrId("selectFilters"), "")
} }
text: "\uf0b0" text: "\uf0b0"
@ -202,13 +205,18 @@ DataListView {
var infoUrls = getCompInfoUrls(compIndex) var infoUrls = getCompInfoUrls(compIndex)
var infosheet = ""; var infosheet = "";
if(infoUrls.length >= 1) if(infoUrls.length >= 1)
infosheet += ("<a href='" + getCompInfoUrls(compIndex)[0] + "'>" + qsTr('infosheet') + "</a>") //% "Infosheet"
infosheet += ("<a href='" + getCompInfoUrls(compIndex)[0] + "'>" + qsTrId('infosheet') + "</a>")
if(infoUrls.length === 2) if(infoUrls.length === 2)
infosheet += (", <a href='" + getCompInfoUrls(compIndex)[1] + "'>" + qsTr('further infos') + "</a>") //% "Further infos"
infosheet += (", <a href='" + getCompInfoUrls(compIndex)[1] + "'>" + qsTrId('furtherInfos') + "</a>")
console.log("Infosheet: " + infosheet) console.log("Infosheet: " + infosheet)
var eventWebsite = control.widgetData["competitions"][compIndex]["homepage"] !== undefined ? ("<a href='" + control.widgetData["competitions"][compIndex]["homepage"] + "'>" + qsTr('Event Website') + "</a>"):""
var eventWebsite = control.widgetData["competitions"][compIndex]["homepage"] !== undefined ?
//% "Event website"
("<a href='" + control.widgetData["competitions"][compIndex]["homepage"] + "'>" + qsTrId('eventWebsite') + "</a>"):""
selector.appear(selectOptions, control.widgetData["competitions"][compIndex]['name'], eventWebsite + ((eventWebsite !== "" && infosheet !== "") ? ", ":"") + infosheet ) selector.appear(selectOptions, control.widgetData["competitions"][compIndex]['name'], eventWebsite + ((eventWebsite !== "" && infosheet !== "") ? ", ":"") + infosheet )
} }
@ -224,7 +232,8 @@ DataListView {
} }
} }
selector.appear(selectOptions, qsTr("select year")) //% "Select year"
selector.appear(selectOptions, qsTrId("selectYear"))
} }
function openCup(state, data) { function openCup(state, data) {
@ -236,7 +245,8 @@ DataListView {
if(state === undefined){ if(state === undefined){
// opened for the first time -> select cup // opened for the first time -> select cup
selectTitle = qsTr("select cup") //% "Select cup"
selectTitle = qsTrId("selectCup")
cups.sort(function(a, b) { cups.sort(function(a, b) {
return parseInt(b["SerId"]) - parseInt(a["SerId"]); return parseInt(b["SerId"]) - parseInt(a["SerId"]);
@ -264,7 +274,8 @@ DataListView {
return return
} }
selectTitle = cup['name'] + ": " + qsTr("select category") //% "Select category"
selectTitle = cup['name'] + ": " + qsTrId("selectCategory")
// build a list with all cat in the cup out of the cat keys (rkey) given in the cup.cats // build a list with all cat in the cup out of the cat keys (rkey) given in the cup.cats
for(prop in cup['cats']){ for(prop in cup['cats']){

View file

@ -190,7 +190,8 @@ Page {
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
text: qsTr("age") + ": " + widgetData["age"] //% "Age"
text: qsTrId("age") + ": " + widgetData["age"]
} }
Label { Label {
@ -206,7 +207,8 @@ Page {
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
text: qsTr("year of birth") + ": " + widgetData["birthdate"] //% "Year of birth"
text: qsTrId("yearOfBirth") + ": " + widgetData["birthdate"]
} }
Label { Label {
@ -222,7 +224,8 @@ Page {
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
text: qsTr("city") + ": " + widgetData["city"] //% "City"
text: qsTrId("city") + ": " + widgetData["city"]
} }
} }
@ -263,7 +266,11 @@ Page {
flat: true flat: true
text: bestResultsRep.showAllResults ? qsTr("show best results"):qsTr("show all results") text: bestResultsRep.showAllResults ?
//% "Show best results"
qsTrId("showBestResults"):
//% "Show all results"
qsTrId("showAllResults")
onClicked: { onClicked: {
bestResultsRep.showAllResults = !bestResultsRep.showAllResults bestResultsRep.showAllResults = !bestResultsRep.showAllResults

View file

@ -27,7 +27,8 @@ DataListView {
property bool ready property bool ready
property string title: control.widgetData['comp_name'] property string title: control.widgetData['comp_name']
property string subTitle: qsTr("(Ranking)") + " after " + control.widgetData['route_name'] //% "(Ranking)"
property string subTitle: qsTrId("rankingHeadline") + " after " + control.widgetData['route_name']
property bool titleIsPageTitle: true property bool titleIsPageTitle: true
property var widgetData: currentWidgetData property var widgetData: currentWidgetData

View file

@ -57,7 +57,8 @@ DataListView {
} }
} }
var addition = "(Registration) " //% "(Registration)"
var addition = qsTrId("registrationHeadline")
if(titleString !== undefined){ if(titleString !== undefined){
return addition + " " + titleString return addition + " " + titleString
@ -108,7 +109,7 @@ DataListView {
} }
} }
selector.appear(selectOptions, qsTr("select cat")) selector.appear(selectOptions, qsTrId("selectCategory"))
} }
function filterAthletes(athletes) { function filterAthletes(athletes) {

View file

@ -132,8 +132,8 @@ DataListView {
titleString = control.widgetData["categorys"][i]["name"] titleString = control.widgetData["categorys"][i]["name"]
} }
} }
//% "(Results)"
var addition = qsTr("(Results)") var addition = qsTrId("resultsHeadline")
if(titleString !== undefined){ if(titleString !== undefined){
return addition + " " + titleString return addition + " " + titleString
@ -166,7 +166,7 @@ DataListView {
} }
} }
selector.appear(selectOptions, qsTr("select cat")) selector.appear(selectOptions, qsTrId("selectCategory"))
} }
Connections { Connections {

View file

@ -28,7 +28,7 @@ DataListView {
property bool ready property bool ready
property string title: control.widgetData['comp_name'] property string title: control.widgetData['comp_name']
property string subTitle: qsTr("(Startlist)") + " " + control.widgetData['route_name'] //getSubtitle() property string subTitle: getSubtitle()
property bool titleIsPageTitle: true property bool titleIsPageTitle: true
property Component headerComponent: ToolButton { property Component headerComponent: ToolButton {
@ -52,7 +52,8 @@ DataListView {
} }
} }
var addition = qsTr("(Startlist)") //% "(Startlist)"
var addition = qsTrId("startlistHeadline")
return addition + " " + titleString return addition + " " + titleString
} }
@ -78,7 +79,7 @@ DataListView {
} }
} }
selector.appear(selectOptions, qsTr("select cat")) selector.appear(selectOptions, qsTrId("startlistHeadline"))
} }
Connections { Connections {

View file

@ -34,7 +34,7 @@ Window {
visible: true visible: true
width: 540 width: 540
height: 960 height: 960
title: qsTr("blueROCK") title: "blueROCK"
Page { Page {
id: app id: app
@ -656,76 +656,36 @@ Window {
// 2 - error // 2 - error
var errorString var errorString
var errorDescription
switch(errorCode) { switch(errorCode) {
case 0: case 0:
infoLevel = 2 infoLevel = 2
errorString = "No connection to server" //% "No connection to server"
errorDescription = "Please check your internet connection and try again." errorString = qsTrId("noConnectionError")
break
case 200:
infoLevel = 0
errorString = "Success"
errorDescription = "The request was successfull"
break
case 401:
infoLevel = 2
errorString = "Authentication required"
errorDescription = "The server asked for user credentinals, please chack them and try again"
break break
case 404: case 404:
infoLevel = 2 infoLevel = 2
errorString = "Not found" //% "Not found"
errorDescription = "The requested item was not found" errorString = qsTrId("notFoundError")
break
case 500:
infoLevel = 2
errorString = "Internal server error"
errorDescription = "The server was unable to process this request, this is probaply the servers fault. Please try again later."
break
case 900:
infoLevel = 2
errorString = "Internal error"
errorDescription = "Something went wron internally, this is probaply an inssue in the program code"
break break
case 901: case 901:
infoLevel = 1 infoLevel = 1
errorString = "No Data" //% "No Data"
errorDescription = "There is currently no data available. Please try again later." errorString = qsTrId("noDataError")
break
case 902:
infoLevel = 1
errorString = "Cached (old) data"
errorDescription = "Es konnte keine Verbindung zum Server hergestellt werden, aber es sind noch alte Daten gespeichert."
break
case 903:
infoLevel = 1
errorString = "Ungültiger Aufruf"
errorDescription = "Die aufgerufene Funktion ist momentan nicht verfügbar, bitte versuche es später erneut."
break
case 904:
infoLevel = 2
errorString = "Incompatible API"
errorDescription = "Please make shure that you are using the latest version of this app and try again."
break
case 905:
infoLevel = 1
errorString = "Loading..."
errorDescription = "Please wait while we're loading some data"
break break
case 906: case 906:
infoLevel = 2 infoLevel = 2
errorString = "Invalid Request" //% "Invalid Request"
errorString = qsTrId("invalidRequestError")
errorDescription = "Invalid Request" errorDescription = "Invalid Request"
break break
default: default:
infoLevel = 2 infoLevel = 2
errorString = "Unexpected error ("+errorCode+")" //% "Unexpected error"
errorDescription = "Unexpected error while getting data from the server. Please try again later." errorString = qsTrId("unexpectedError") + " ("+errorCode+")"
} }
return([infoLevel, errorString, errorDescription]) return([infoLevel, errorString])
} }
} }