Skip to content

Commit 1138108

Browse files
committed
fix: add some chinese translation in example
add some chinese translation in example
1 parent 09e0430 commit 1138108

16 files changed

+893
-125
lines changed

example/example_en_US.ts

Lines changed: 382 additions & 5 deletions
Large diffs are not rendered by default.

example/example_zh_CN.ts

Lines changed: 416 additions & 32 deletions
Large diffs are not rendered by default.

example/qml/page/T_Acrylic.qml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ FluScrollablePage{
1212
RowLayout{
1313
spacing: 10
1414
FluText{
15-
text:"tintColor:"
15+
text: qsTr("tintColor:")
1616
Layout.alignment: Qt.AlignVCenter
1717
}
1818
FluColorPicker{
@@ -22,7 +22,7 @@ FluScrollablePage{
2222
RowLayout{
2323
spacing: 10
2424
FluText{
25-
text:"tintOpacity:"
25+
text: qsTr("tintOpacity:")
2626
Layout.alignment: Qt.AlignVCenter
2727
}
2828
FluSlider{
@@ -33,7 +33,7 @@ FluScrollablePage{
3333
RowLayout{
3434
spacing: 10
3535
FluText{
36-
text:"blurRadius:"
36+
text: qsTr("blurRadius:")
3737
Layout.alignment: Qt.AlignVCenter
3838
}
3939
FluSlider{
@@ -69,7 +69,7 @@ FluScrollablePage{
6969
y:(image.height-height)/2
7070
FluText {
7171
anchors.centerIn: parent
72-
text: "Acrylic"
72+
text: qsTr("Acrylic")
7373
color: "#FFFFFF"
7474
font: FluTextStyle.Subtitle
7575
}

example/qml/page/T_BreadcrumbBar.qml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ FluScrollablePage{
1212
Component.onCompleted: {
1313
var items = []
1414
for(var i=0;i<10;i++){
15-
items.push({title:"Item_"+(i+1)})
15+
items.push({title: qsTr("Item_%1").arg(i+1)})
1616
}
1717
breadcrumb_1.items = items
1818
breadcrumb_2.items = items
@@ -51,7 +51,7 @@ FluScrollablePage{
5151
onClicked:{
5252
var items = []
5353
for(var i=0;i<10;i++){
54-
items.push({title:"Item_"+(i+1)})
54+
items.push({title: qsTr("Item_")+(i+1)})
5555
}
5656
breadcrumb_2.items = items
5757
}

example/qml/page/T_Captcha.qml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ FluScrollablePage{
4545
Layout.preferredWidth: 240
4646
}
4747
FluButton{
48-
text:"verify"
48+
text: qsTr("verify")
4949
onClicked: {
5050
var success = captcha.verify(text_box.text)
5151
if(success){

example/qml/page/T_ComboBox.qml

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@ FluScrollablePage{
1717
spacing: 5
1818
anchors.verticalCenter: parent.verticalCenter
1919
FluText{
20-
text: "editable=false"
20+
text: qsTr("editable=false")
2121
x:10
2222
}
2323
FluComboBox {
2424
model: ListModel {
2525
id: model_1
26-
ListElement { text: "Banana" }
27-
ListElement { text: "Apple" }
28-
ListElement { text: "Coconut" }
26+
ListElement { text: qsTr("Banana") }
27+
ListElement { text: qsTr("Apple") }
28+
ListElement { text: qsTr("Coconut") }
2929
}
3030
}
3131
}
@@ -40,16 +40,16 @@ FluScrollablePage{
4040
spacing: 5
4141
anchors.verticalCenter: parent.verticalCenter
4242
FluText{
43-
text: "disabled=true"
43+
text: qsTr("disabled=true")
4444
x:10
4545
}
4646
FluComboBox {
4747
disabled: true
4848
model: ListModel {
4949
id: model_2
50-
ListElement { text: "Banana" }
51-
ListElement { text: "Apple" }
52-
ListElement { text: "Coconut" }
50+
ListElement { text: qsTr("Banana") }
51+
ListElement { text: qsTr("Apple") }
52+
ListElement { text: qsTr("Coconut") }
5353
}
5454
}
5555
}
@@ -64,16 +64,16 @@ FluScrollablePage{
6464
spacing: 5
6565
anchors.verticalCenter: parent.verticalCenter
6666
FluText{
67-
text: "editable=true"
67+
text: qsTr("editable=true")
6868
x:5
6969
}
7070
FluComboBox {
7171
editable: true
7272
model: ListModel {
7373
id: model_3
74-
ListElement { text: "Banana" }
75-
ListElement { text: "Apple" }
76-
ListElement { text: "Coconut" }
74+
ListElement { text: qsTr("Banana") }
75+
ListElement { text: qsTr("Apple") }
76+
ListElement { text: qsTr("Coconut") }
7777
}
7878
onAccepted: {
7979
if (find(editText) === -1)
@@ -85,19 +85,21 @@ FluScrollablePage{
8585
CodeExpander{
8686
Layout.fillWidth: true
8787
Layout.topMargin: -6
88-
code:'FluComboBox{
88+
code:qsTr('FluComboBox{
8989
editable: true
9090
model: ListModel {
9191
id: model
92-
ListElement { text: "Banana" }
93-
ListElement { text: "Apple" }
94-
ListElement { text: "Coconut" }
92+
ListElement { text: "%1" }
93+
ListElement { text: "%2" }
94+
ListElement { text: "%3" }
9595
}
9696
onAccepted: {
9797
if (find(editText) === -1)
9898
model.append({text: editText})
9999
}
100-
}'
100+
}').arg(qsTr("Banana"))
101+
.arg(qsTr("Apple"))
102+
.arg(qsTr("Coconut"))
101103
}
102104

103105
}

example/qml/page/T_InfoBar.qml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,13 @@ FluScrollablePage{
3636
}
3737
}
3838
FluButton{
39-
text:"Error"
39+
text: qsTr("Error")
4040
onClicked: {
4141
showError(qsTr("This is an InfoBar in the Error Style"))
4242
}
4343
}
4444
FluButton{
45-
text:"Success"
45+
text: qsTr("Success")
4646
onClicked: {
4747
showSuccess(qsTr("This is an InfoBar in the Success Style"))
4848
}
@@ -61,34 +61,34 @@ FluScrollablePage{
6161
Row{
6262
spacing: 5
6363
FluButton{
64-
text: (info1 ? qsTr("close '%1'") : qsTr("show '%1")).arg("info1")
64+
text: (info1 ? qsTr("close '%1'") : qsTr("show '%1'")).arg(qsTr("info1"))
6565
onClicked: {
6666
if(info1) {
6767
info1.close()
6868
return
6969
}
70-
info1 = showInfo(qsTr("This is an '%1'").arg("info1"), 0)
70+
info1 = showInfo(qsTr("This is an '%1'").arg(qsTr("info1")), 0)
7171
info1.close()
7272
}
7373
}
7474
FluButton{
75-
text: (info2 ? qsTr("close '%1'") : qsTr("show '%1")).arg("info2")
75+
text: (info2 ? qsTr("close '%1'") : qsTr("show '%1'")).arg(qsTr("info2"))
7676
onClicked: {
7777
if(info2) {
7878
info2.close()
7979
return
8080
}
81-
info2 = showInfo(qsTr("This is an '%1'").arg("info2"), 0)
81+
info2 = showInfo(qsTr("This is an '%1'").arg(qsTr("info2")), 0)
8282
}
8383
}
8484
FluButton{
85-
text: (info3 ? qsTr("close '%1'") : qsTr("show '%1")).arg("info3")
85+
text: (info3 ? qsTr("close '%1'") : qsTr("show '%1'")).arg(qsTr("info3"))
8686
onClicked: {
8787
if(info3) {
8888
info3.close()
8989
return
9090
}
91-
info3 = showInfo(qsTr("This is an '%1'").arg("info3"), 0)
91+
info3 = showInfo(qsTr("This is an '%1'").arg(qsTr("info3")), 0)
9292
}
9393
}
9494
FluButton{
@@ -100,7 +100,7 @@ FluScrollablePage{
100100
}
101101

102102
FluButton{
103-
text:"Loading"
103+
text: qsTr("Loading")
104104
onClicked: {
105105
showLoading()
106106
}

example/qml/page/T_QRCode.qml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ FluScrollablePage{
2424
spacing: 10
2525
Layout.topMargin: 20
2626
FluText{
27-
text:"text:"
27+
text: qsTr("text:")
2828
Layout.alignment: Qt.AlignVCenter
2929
}
3030
FluTextBox{
@@ -38,7 +38,7 @@ FluScrollablePage{
3838
spacing: 10
3939
Layout.topMargin: 10
4040
FluText{
41-
text:"color:"
41+
text: qsTr("color:")
4242
Layout.alignment: Qt.AlignVCenter
4343
}
4444
FluColorPicker{
@@ -51,7 +51,7 @@ FluScrollablePage{
5151
spacing: 10
5252
Layout.topMargin: 10
5353
FluText{
54-
text:"bgColor:"
54+
text: qsTr("bgColor:")
5555
Layout.alignment: Qt.AlignVCenter
5656
}
5757
FluColorPicker{
@@ -63,7 +63,7 @@ FluScrollablePage{
6363
RowLayout{
6464
spacing: 10
6565
FluText{
66-
text:"margins:"
66+
text: qsTr("margins:")
6767
Layout.alignment: Qt.AlignVCenter
6868
}
6969
FluSlider{
@@ -77,7 +77,7 @@ FluScrollablePage{
7777
RowLayout{
7878
spacing: 10
7979
FluText{
80-
text:"size:"
80+
text: qsTr("size:")
8181
Layout.alignment: Qt.AlignVCenter
8282
}
8383
FluSlider{

example/qml/page/T_SplitLayout.qml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,21 @@ FluContentPage{
1515
top: parent.top
1616
}
1717
FluText{
18-
text:"orientation:"
18+
text: qsTr("orientation:")
1919
}
2020
FluDropDownButton{
2121
id:btn_orientation
2222
Layout.preferredWidth: 120
23-
text:"Horizontal"
23+
text: qsTr("Horizontal")
2424
FluMenuItem{
25-
text:"Horizontal"
25+
text: qsTr("Horizontal")
2626
onClicked: {
2727
btn_orientation.text = text
2828
split_layout.orientation = Qt.Horizontal
2929
}
3030
}
3131
FluMenuItem{
32-
text:"Vertical"
32+
text: qsTr("Vertical")
3333
onClicked: {
3434
btn_orientation.text = text
3535
split_layout.orientation = Qt.Vertical
@@ -54,7 +54,7 @@ FluContentPage{
5454
SplitView.maximumWidth: 400
5555
SplitView.maximumHeight: 400
5656
FluText {
57-
text: "Page 1"
57+
text: qsTr("Page 1")
5858
anchors.centerIn: parent
5959
}
6060
}
@@ -66,7 +66,7 @@ FluContentPage{
6666
SplitView.fillWidth: true
6767
SplitView.fillHeight: true
6868
FluText {
69-
text: "Page 2"
69+
text: qsTr("Page 2")
7070
anchors.centerIn: parent
7171
}
7272
}
@@ -75,7 +75,7 @@ FluContentPage{
7575
implicitWidth: 200
7676
implicitHeight: 200
7777
FluText {
78-
text: "Page 3"
78+
text: qsTr("Page 3")
7979
anchors.centerIn: parent
8080
}
8181
}

example/qml/page/T_StatusLayout.qml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,30 +19,30 @@ FluScrollablePage{
1919
FluDropDownButton{
2020
id:btn_status_mode
2121
Layout.preferredWidth: 140
22-
text:"Loading"
22+
text: qsTr("Loading")
2323
FluMenuItem{
24-
text:"Loading"
24+
text: qsTr("Loading")
2525
onClicked: {
2626
btn_status_mode.text = text
2727
status_view.statusMode = FluStatusLayoutType.Loading
2828
}
2929
}
3030
FluMenuItem{
31-
text:"Empty"
31+
text: qsTr("Empty")
3232
onClicked: {
3333
btn_status_mode.text = text
3434
status_view.statusMode = FluStatusLayoutType.Empty
3535
}
3636
}
3737
FluMenuItem{
38-
text:"Error"
38+
text: qsTr("Error")
3939
onClicked: {
4040
btn_status_mode.text = text
4141
status_view.statusMode = FluStatusLayoutType.Error
4242
}
4343
}
4444
FluMenuItem{
45-
text:"Success"
45+
text: qsTr("Success")
4646
onClicked: {
4747
btn_status_mode.text = text
4848
status_view.statusMode = FluStatusLayoutType.Success

0 commit comments

Comments
 (0)