Skip to content

Commit 053ee27

Browse files
committed
Simple nodes: Localize
Mark display template and description as translatable.
1 parent 91378cf commit 053ee27

File tree

4 files changed

+19
-14
lines changed

4 files changed

+19
-14
lines changed

addons/block_code/simple_nodes/simple_character/simple_character.gd

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,14 +182,19 @@ static func setup_custom_blocks():
182182
block_definition.target_node_class = _class_name
183183
block_definition.category = "Input"
184184
block_definition.type = Types.BlockType.STATEMENT
185-
block_definition.display_template = "move with {player: NIL} buttons as {kind: NIL}"
186-
block_definition.description = """Move the character using the “Player 1” or “Player 2” controls as configured in Godot.
185+
block_definition.display_template = Engine.tr("move with {player: NIL} buttons as {kind: NIL}")
186+
block_definition.description = (
187+
Engine
188+
. tr(
189+
"""Move the character using the “Player 1” or “Player 2” controls as configured in Godot.
187190
188191
“Top-down” enables the character to move in both x (horizontal) and y (vertical) dimensions, as if the camera is above the character, looking down. No gravity is added.
189192
190193
“Platformer” enables the character to move as if the camera is looking from the side, like a side-scroller. Gravity is applied on the y (vertical) axis, making the character fall down until they collide with something.
191194
192195
“Spaceship” uses the left/right controls to rotate the character and up/down controls to go forward or backward in the direction they are pointing."""
196+
)
197+
)
193198
# TODO: delta here is assumed to be the parameter name of
194199
# the _process or _physics_process method:
195200
block_definition.code_template = "move_with_player_buttons({player}, {kind}, delta)"

addons/block_code/simple_nodes/simple_ending/simple_ending.gd

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,22 +69,22 @@ static func setup_custom_blocks():
6969
block_definition.target_node_class = _class_name
7070
block_definition.category = "Lifecycle | Game"
7171
block_definition.type = Types.BlockType.STATEMENT
72-
block_definition.display_template = "game over {result: STRING}"
72+
block_definition.display_template = Engine.tr("game over {result: STRING}")
7373
block_definition.code_template = "game_over({result})"
7474
block_definition.defaults = {
7575
"result": OptionData.new(["WIN", "LOSE"]),
7676
}
77-
block_definition.description = "Show the game over label with the win or lose message."
77+
block_definition.description = Engine.tr("Show the game over label with the win or lose message.")
7878
block_list.append(block_definition)
7979

8080
block_definition = BlockDefinition.new()
8181
block_definition.name = &"simpleending_reset"
8282
block_definition.target_node_class = _class_name
8383
block_definition.category = "Lifecycle | Game"
8484
block_definition.type = Types.BlockType.STATEMENT
85-
block_definition.display_template = "reset game over"
85+
block_definition.display_template = Engine.tr("reset game over")
8686
block_definition.code_template = "reset()"
87-
block_definition.description = "Reset the game over label."
87+
block_definition.description = Engine.tr("Reset the game over label.")
8888
block_list.append(block_definition)
8989

9090
BlocksCatalog.add_custom_blocks(_class_name, block_list)

addons/block_code/simple_nodes/simple_scoring/simple_scoring.gd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ static func setup_custom_blocks():
6363
block_definition.target_node_class = _class_name
6464
block_definition.category = "Info | Score"
6565
block_definition.type = Types.BlockType.STATEMENT
66-
block_definition.display_template = "set score to {score: INT}"
66+
block_definition.display_template = Engine.tr("set score to {score: INT}")
6767
block_definition.code_template = "score = {score}"
6868
block_list.append(block_definition)
6969

@@ -72,7 +72,7 @@ static func setup_custom_blocks():
7272
block_definition.target_node_class = _class_name
7373
block_definition.category = "Info | Score"
7474
block_definition.type = Types.BlockType.STATEMENT
75-
block_definition.display_template = "change score by {score: INT}"
75+
block_definition.display_template = Engine.tr("change score by {score: INT}")
7676
block_definition.code_template = "score += {score}"
7777
block_list.append(block_definition)
7878

addons/block_code/simple_spawner/simple_spawner.gd

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ static func setup_custom_blocks():
120120
block_definition.target_node_class = _class_name
121121
block_definition.category = "Lifecycle | Spawn"
122122
block_definition.type = Types.BlockType.STATEMENT
123-
block_definition.display_template = "spawn once"
123+
block_definition.display_template = Engine.tr("spawn once")
124124
block_definition.code_template = "spawn_once()"
125125
block_list.append(block_definition)
126126

@@ -129,7 +129,7 @@ static func setup_custom_blocks():
129129
block_definition.target_node_class = _class_name
130130
block_definition.category = "Lifecycle | Spawn"
131131
block_definition.type = Types.BlockType.STATEMENT
132-
block_definition.display_template = "start spawning"
132+
block_definition.display_template = Engine.tr("start spawning")
133133
block_definition.code_template = "spawn_start()"
134134
block_list.append(block_definition)
135135

@@ -138,7 +138,7 @@ static func setup_custom_blocks():
138138
block_definition.target_node_class = _class_name
139139
block_definition.category = "Lifecycle | Spawn"
140140
block_definition.type = Types.BlockType.STATEMENT
141-
block_definition.display_template = "stop spawning"
141+
block_definition.display_template = Engine.tr("stop spawning")
142142
block_definition.code_template = "spawn_stop()"
143143
block_list.append(block_definition)
144144

@@ -148,7 +148,7 @@ static func setup_custom_blocks():
148148
block_definition.category = "Lifecycle | Spawn"
149149
block_definition.type = Types.BlockType.VALUE
150150
block_definition.variant_type = TYPE_BOOL
151-
block_definition.display_template = "is spawning"
151+
block_definition.display_template = Engine.tr("is spawning")
152152
block_definition.code_template = "is_spawning()"
153153
block_list.append(block_definition)
154154

@@ -157,7 +157,7 @@ static func setup_custom_blocks():
157157
block_definition.target_node_class = _class_name
158158
block_definition.category = "Lifecycle | Spawn"
159159
block_definition.type = Types.BlockType.STATEMENT
160-
block_definition.display_template = "set spawn period to {new_period: FLOAT}"
160+
block_definition.display_template = Engine.tr("set spawn period to {new_period: FLOAT}")
161161
block_definition.code_template = "spawn_period = {new_period}"
162162
block_list.append(block_definition)
163163

@@ -167,7 +167,7 @@ static func setup_custom_blocks():
167167
block_definition.category = "Lifecycle | Spawn"
168168
block_definition.type = Types.BlockType.VALUE
169169
block_definition.variant_type = TYPE_FLOAT
170-
block_definition.display_template = "spawn period"
170+
block_definition.display_template = Engine.tr("spawn period")
171171
block_definition.code_template = "spawn_period"
172172
block_list.append(block_definition)
173173

0 commit comments

Comments
 (0)