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

View file

@ -16,7 +16,8 @@ Rectangle {
target: speedFlowChartProduct
function onPurchaseFailed() {
purchaseBt.text = qsTr("Purchase failed")
//% "Purchase failed"
purchaseBt.text = qsTrId("purchaseFailed")
purchaseBt.enabled = false
buttonTextResetTimer.start()
}
@ -29,8 +30,10 @@ Rectangle {
repeat: false
onTriggered: {
purchaseBt.text = (speedFlowChartProduct.status === Product.Registered
? "Buy now for " + speedFlowChartProduct.price
: qsTr("this item is currently unavailable"))
//% "Buy now for"
? qsTrId("buyNowFor") + " " + speedFlowChartProduct.price
//% "This item is currently unavailable"
: qsTrId("itemUnavailable"))
purchaseBt.enabled = true
}
}
@ -53,7 +56,8 @@ Rectangle {
height: parent.height * 0.015
text: qsTr("This is a premium feature.")
//% "This is a premium feature."
text: qsTrId("thisIsAPremiumFeature")
font.bold: true
font.pixelSize: height
@ -83,8 +87,9 @@ Rectangle {
Layout.alignment: Layout.Center
enabled: speedFlowChartProduct.status === Product.Registered
text: speedFlowChartProduct.status === Product.Registered
? "\uf218 Buy now for " + speedFlowChartProduct.price
: qsTr("This item is currently unavailable")
? "\uf218 "+ qsTrId("buyNowFor") +" " + speedFlowChartProduct.price
//% "This item is currently unavailable"
: qsTrId("itemIsUnavailable")
font.family: fa5solid.name
onClicked: speedFlowChartProduct.purchase()
}
@ -93,26 +98,28 @@ Rectangle {
Layout.alignment: Layout.Center
Button {
id: restorePurchaseButton
Layout.alignment: Layout.Center
visible: speedFlowChartProduct.status === Product.Registered
Button {
id: restorePurchaseButton
Layout.alignment: Layout.Center
visible: speedFlowChartProduct.status === Product.Registered
flat: true
text: "restore purchase"
flat: true
//% "Restore purchase"
text: qsTrId("restorePurchase")
onClicked: inAppProductStore.restorePurchases()
}
onClicked: inAppProductStore.restorePurchases()
}
Button {
id: contactSupportButton
Layout.alignment: Layout.Center
Button {
id: contactSupportButton
Layout.alignment: Layout.Center
flat: true
text: "contact support"
flat: true
//% "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 {
id: buttonRepeater
property var buttons: [
["\uf059", "IFSC results", ifscDisclaimerDialog.open],
["\uf042", Material.theme === Material.Light ? "Dark mode":"Light mode", app.toggleDarkMode],
["\uf05a", "About blueROCK", aboutBluerockDisclaimerDialog.open],
["\uf029", "Scan QR code", qrCodeScanPopup.open],
//% "IFSC results"
["\uf059", qsTrId("ifscResults"), ifscDisclaimerDialog.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

View file

@ -28,7 +28,8 @@ DataListView {
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 {
@ -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) {
return a['data']['sort_rank'] - b['data']['sort_rank'];
});
filterSelectPu.appear(compCats, qsTr("Select Filters"), "")
//% "Select filters"
filterSelectPu.appear(compCats, qsTrId("selectFilters"), "")
}
text: "\uf0b0"
@ -202,13 +205,18 @@ DataListView {
var infoUrls = getCompInfoUrls(compIndex)
var infosheet = "";
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)
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)
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 )
}
@ -224,7 +232,8 @@ DataListView {
}
}
selector.appear(selectOptions, qsTr("select year"))
//% "Select year"
selector.appear(selectOptions, qsTrId("selectYear"))
}
function openCup(state, data) {
@ -236,7 +245,8 @@ DataListView {
if(state === undefined){
// opened for the first time -> select cup
selectTitle = qsTr("select cup")
//% "Select cup"
selectTitle = qsTrId("selectCup")
cups.sort(function(a, b) {
return parseInt(b["SerId"]) - parseInt(a["SerId"]);
@ -264,7 +274,8 @@ DataListView {
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
for(prop in cup['cats']){

View file

@ -190,7 +190,8 @@ Page {
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
text: qsTr("age") + ": " + widgetData["age"]
//% "Age"
text: qsTrId("age") + ": " + widgetData["age"]
}
Label {
@ -206,7 +207,8 @@ Page {
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
text: qsTr("year of birth") + ": " + widgetData["birthdate"]
//% "Year of birth"
text: qsTrId("yearOfBirth") + ": " + widgetData["birthdate"]
}
Label {
@ -222,7 +224,8 @@ Page {
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
text: qsTr("city") + ": " + widgetData["city"]
//% "City"
text: qsTrId("city") + ": " + widgetData["city"]
}
}
@ -263,7 +266,11 @@ Page {
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: {
bestResultsRep.showAllResults = !bestResultsRep.showAllResults

View file

@ -27,7 +27,8 @@ DataListView {
property bool ready
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 var widgetData: currentWidgetData

View file

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

View file

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

View file

@ -28,7 +28,7 @@ DataListView {
property bool ready
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 Component headerComponent: ToolButton {
@ -52,7 +52,8 @@ DataListView {
}
}
var addition = qsTr("(Startlist)")
//% "(Startlist)"
var addition = qsTrId("startlistHeadline")
return addition + " " + titleString
}
@ -78,7 +79,7 @@ DataListView {
}
}
selector.appear(selectOptions, qsTr("select cat"))
selector.appear(selectOptions, qsTrId("startlistHeadline"))
}
Connections {

View file

@ -34,7 +34,7 @@ Window {
visible: true
width: 540
height: 960
title: qsTr("blueROCK")
title: "blueROCK"
Page {
id: app
@ -656,76 +656,36 @@ Window {
// 2 - error
var errorString
var errorDescription
switch(errorCode) {
case 0:
infoLevel = 2
errorString = "No connection to server"
errorDescription = "Please check your internet connection and try again."
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"
//% "No connection to server"
errorString = qsTrId("noConnectionError")
break
case 404:
infoLevel = 2
errorString = "Not found"
errorDescription = "The requested item was not found"
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"
//% "Not found"
errorString = qsTrId("notFoundError")
break
case 901:
infoLevel = 1
errorString = "No Data"
errorDescription = "There is currently no data available. Please try again later."
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"
//% "No Data"
errorString = qsTrId("noDataError")
break
case 906:
infoLevel = 2
errorString = "Invalid Request"
//% "Invalid Request"
errorString = qsTrId("invalidRequestError")
errorDescription = "Invalid Request"
break
default:
infoLevel = 2
errorString = "Unexpected error ("+errorCode+")"
errorDescription = "Unexpected error while getting data from the server. Please try again later."
//% "Unexpected error"
errorString = qsTrId("unexpectedError") + " ("+errorCode+")"
}
return([infoLevel, errorString, errorDescription])
return([infoLevel, errorString])
}
}