1
1
-- You can run /flow-example in singleplayer to open this form
2
2
local gui = flow .widgets
3
+ local S = minetest .get_translator (" flow" )
3
4
4
5
local elements = {" box" , " label" , " image" , " field" , " checkbox" , " list" }
5
6
local alignments = {" auto" , " start" , " end" , " centre" , " fill" }
@@ -58,19 +59,19 @@ local my_gui = flow.make_gui(function(player, ctx)
58
59
59
60
gui .HBox {
60
61
gui .Image {w = 1 , h = 1 , texture_name = " air.png" },
61
- gui .Label {label = " Hello world!" },
62
+ gui .Label {label = S " Hello world!" },
62
63
},
63
- gui .Label {label = " This is an example form." },
64
+ gui .Label {label = S " This is an example form." },
64
65
gui .Checkbox {
65
66
name = " checkbox" ,
66
67
67
68
-- flow will detect that you have accessed ctx.form.checkbox and
68
69
-- will automatically redraw the formspec if the value is changed.
69
- label = ctx .form .checkbox and " Uncheck me!" or " Check me!" ,
70
+ label = ctx .form .checkbox and S " Uncheck me!" or S " Check me!" ,
70
71
},
71
72
gui .Button {
72
73
-- Names are optional
73
- label = " Toggle checkbox" ,
74
+ label = S " Toggle checkbox" ,
74
75
75
76
-- Important: Do not use the `player` and `ctx` variables from the
76
77
-- above formspec.
@@ -79,14 +80,14 @@ local my_gui = flow.make_gui(function(player, ctx)
79
80
ctx .form .checkbox = not ctx .form .checkbox
80
81
81
82
-- Send a chat message
82
- minetest .chat_send_player (player :get_player_name (), " Toggled!" )
83
+ minetest .chat_send_player (player :get_player_name (), S " Toggled!" )
83
84
84
85
-- Return true to tell flow to redraw the formspec
85
86
return true
86
87
end ,
87
88
},
88
89
89
- gui .Label {label = " A demonstration of expansion:" },
90
+ gui .Label {label = S " A demonstration of expansion:" },
90
91
91
92
-- The finer details of scroll containers are handled automatically.
92
93
-- Clients that don't support scroll_container[] will see a paginator
@@ -98,8 +99,8 @@ local my_gui = flow.make_gui(function(player, ctx)
98
99
-- order changes.
99
100
name = " vbox1" ,
100
101
101
- gui .Label {label = " By default, objects do not expand\n in the " ..
102
- " same direction as the hbox/vbox:" },
102
+ gui .Label {label = S ( " By default, objects do not expand\n in the " ..
103
+ " same direction as the hbox/vbox:" ) },
103
104
gui .HBox {
104
105
gui .Box {
105
106
w = 1 ,
@@ -108,8 +109,10 @@ local my_gui = flow.make_gui(function(player, ctx)
108
109
},
109
110
},
110
111
111
- gui .Label {label = " Items are expanded in the opposite\n direction," ..
112
- " however:" },
112
+ gui .Label {
113
+ label = S (" Items are expanded in the opposite\n direction,"
114
+ .. " however:" )
115
+ },
113
116
gui .HBox {
114
117
min_h = 2 ,
115
118
gui .Box {
@@ -119,8 +122,8 @@ local my_gui = flow.make_gui(function(player, ctx)
119
122
},
120
123
},
121
124
122
- gui .Label {label = " To automatically expand an object, add\n " ..
123
- " `expand = true` to its definition." },
125
+ gui .Label {label = S ( " To automatically expand an object, add\n " ..
126
+ " `expand = true` to its definition." ) },
124
127
gui .HBox {
125
128
gui .Box {
126
129
w = 1 ,
@@ -130,8 +133,8 @@ local my_gui = flow.make_gui(function(player, ctx)
130
133
},
131
134
},
132
135
133
- gui .Label {label = " Multiple expanded items will share the\n " ..
134
- " remaining space evenly." },
136
+ gui .Label {label = S ( " Multiple expanded items will share the\n " ..
137
+ " remaining space evenly." ) },
135
138
136
139
gui .HBox {
137
140
gui .Box {
@@ -164,10 +167,10 @@ local my_gui = flow.make_gui(function(player, ctx)
164
167
},
165
168
},
166
169
167
- gui .Label {label = " Try it yourself!" },
170
+ gui .Label {label = S " Try it yourself!" },
168
171
gui .HBox {
169
172
gui .VBox {
170
- gui .Label {label = " Element:" },
173
+ gui .Label {label = S " Element:" },
171
174
gui .Dropdown {
172
175
name = " element" ,
173
176
items = elements ,
@@ -195,12 +198,18 @@ local my_gui = flow.make_gui(function(player, ctx)
195
198
},
196
199
gui .HBox {
197
200
gui .VBox {
198
- gui .Checkbox {name = " expand" , label = " Expand" },
199
- gui .Checkbox {name = " box2" , label = " Second box" },
201
+ gui .Checkbox {name = " expand" , label = S " Expand" },
202
+ gui .Checkbox {name = " box2" , label = S " Second box" },
200
203
},
201
204
gui .VBox {
202
- gui .Checkbox {name = " vbox" , label = " Use vbox instead of hbox" },
203
- gui .Checkbox {name = " expand_box2" , label = " Expand second box" },
205
+ gui .Checkbox {
206
+ name = " vbox" ,
207
+ label = S " Use vbox instead of hbox"
208
+ },
209
+ gui .Checkbox {
210
+ name = " expand_box2" ,
211
+ label = S " Expand second box"
212
+ },
204
213
},
205
214
},
206
215
try_it_yourself_box ,
0 commit comments