Skip to content

Commit 0faefe0

Browse files
committed
autotranslate bbcode stuff
1 parent c9e1dde commit 0faefe0

File tree

4 files changed

+31
-18
lines changed

4 files changed

+31
-18
lines changed

pets-gd/i18n/translations.csv

+4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
keys,en_US,pr,tlh_US
2+
MAINMENU_OPTION_PLAY,Play,Set Sail,Play
3+
MAINMENU_OPTION_OPTIONS,Options,Fiddle 'round,Options
4+
MAINMENU_OPTION_CREDITS,Credits,Th' Crew,Credits
5+
MAINMENU_OPTION_QUIT,Quit,Avast!,Touch Grass
26
IZ_INTERACT_INTERACT,Interact,Interact,Interact
37
IZ_INTERACT_CHECK,Check,Peer,Critique
48
IZ_INTERACT_PRESS,Press,Push,Press

pets-gd/scenes/title_screen.tscn

+14-14
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ tracks/7/keys = {
254254
"times": PackedFloat32Array(1.92, 3.2),
255255
"transitions": PackedFloat32Array(0.307786, 1),
256256
"update": 0,
257-
"values": [Vector2(-400, 320), Vector2(64, 320)]
257+
"values": [Vector2(-700, 320), Vector2(64, 320)]
258258
}
259259

260260
[sub_resource type="Animation" id="Animation_m5j65"]
@@ -354,7 +354,7 @@ tracks/7/keys = {
354354
"times": PackedFloat32Array(0, 1),
355355
"transitions": PackedFloat32Array(1, 1),
356356
"update": 0,
357-
"values": [Vector2(64, 320), Vector2(-2400, 320)]
357+
"values": [Vector2(64, 320), Vector2(-3000, 320)]
358358
}
359359
tracks/8/type = "value"
360360
tracks/8/imported = false
@@ -574,65 +574,65 @@ offset_bottom = 360.0
574574
[node name="Play" type="RichTextLabel" parent="MoveRight/MenuChoices"]
575575
clip_contents = false
576576
layout_mode = 0
577-
offset_right = 456.0
577+
offset_right = 720.0
578578
offset_bottom = 136.0
579579
focus_neighbor_top = NodePath("../Quit")
580580
focus_neighbor_bottom = NodePath("../Options")
581581
focus_next = NodePath("../Options")
582582
focus_previous = NodePath("../Quit")
583583
focus_mode = 2
584584
theme_override_colors/default_color = Color(0.803922, 0.839216, 0.956863, 1)
585-
theme_override_font_sizes/normal_font_size = 80
585+
theme_override_font_sizes/normal_font_size = 68
586586
bbcode_enabled = true
587-
text = "Play"
587+
text = "MAINMENU_OPTION_PLAY"
588588

589589
[node name="Options" type="RichTextLabel" parent="MoveRight/MenuChoices"]
590590
clip_contents = false
591591
layout_mode = 0
592592
offset_top = 128.0
593-
offset_right = 456.0
593+
offset_right = 720.0
594594
offset_bottom = 264.0
595595
focus_neighbor_top = NodePath("../Play")
596596
focus_neighbor_bottom = NodePath("../Credits")
597597
focus_next = NodePath("../Credits")
598598
focus_previous = NodePath("../Play")
599599
focus_mode = 2
600600
theme_override_colors/default_color = Color(0.803922, 0.839216, 0.956863, 1)
601-
theme_override_font_sizes/normal_font_size = 80
601+
theme_override_font_sizes/normal_font_size = 68
602602
bbcode_enabled = true
603-
text = "Options"
603+
text = "MAINMENU_OPTION_OPTIONS"
604604

605605
[node name="Credits" type="RichTextLabel" parent="MoveRight/MenuChoices"]
606606
clip_contents = false
607607
layout_mode = 0
608608
offset_top = 256.0
609-
offset_right = 456.0
609+
offset_right = 720.0
610610
offset_bottom = 392.0
611611
focus_neighbor_top = NodePath("../Options")
612612
focus_neighbor_bottom = NodePath("../Quit")
613613
focus_next = NodePath("../Quit")
614614
focus_previous = NodePath("../Options")
615615
focus_mode = 2
616616
theme_override_colors/default_color = Color(0.803922, 0.839216, 0.956863, 1)
617-
theme_override_font_sizes/normal_font_size = 80
617+
theme_override_font_sizes/normal_font_size = 68
618618
bbcode_enabled = true
619-
text = "Credits"
619+
text = "MAINMENU_OPTION_CREDITS"
620620

621621
[node name="Quit" type="RichTextLabel" parent="MoveRight/MenuChoices"]
622622
clip_contents = false
623623
layout_mode = 0
624624
offset_top = 384.0
625-
offset_right = 456.0
625+
offset_right = 720.0
626626
offset_bottom = 520.0
627627
focus_neighbor_top = NodePath("../Credits")
628628
focus_neighbor_bottom = NodePath("../Play")
629629
focus_next = NodePath("../Play")
630630
focus_previous = NodePath("../Credits")
631631
focus_mode = 2
632632
theme_override_colors/default_color = Color(0.803922, 0.839216, 0.956863, 1)
633-
theme_override_font_sizes/normal_font_size = 80
633+
theme_override_font_sizes/normal_font_size = 68
634634
bbcode_enabled = true
635-
text = "Quit"
635+
text = "MAINMENU_OPTION_QUIT"
636636

637637
[node name="BlackFade" type="ColorRect" parent="MoveRight"]
638638
unique_name_in_owner = true

pets-lib/src/util/choices.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ impl ChoiceAgent {
9090
)
9191
.unwrap();
9292

93-
bbcode_toggle(label, CHOICE_WAVE_BBCODE, is_picked);
93+
bbcode_toggle(label, CHOICE_WAVE_BBCODE, is_picked, true);
9494
}
9595

9696
if !self.tween_property.is_empty() {

pets-lib/src/util/node_stuff.rs

+12-3
Original file line numberDiff line numberDiff line change
@@ -135,9 +135,18 @@ pub fn si() -> Gd<StatsInterface> {
135135
pub struct GdW<T: GodotClass>(pub Gd<T>);
136136

137137
/// takes a bbcode string and prepends or removes it from the label text
138-
pub fn bbcode_toggle(mut node: Gd<RichTextLabel>, bbcode: &str, active: bool) {
139-
let old_text = node.get_text().to_string();
140-
let new_text = prefix_mod(&old_text, bbcode, active);
138+
pub fn bbcode_toggle(
139+
mut node: Gd<RichTextLabel>,
140+
bbcode: &str,
141+
active: bool,
142+
autotranslate: bool,
143+
) {
144+
let mut old_text = node.get_text();
145+
if autotranslate {
146+
old_text = tr(old_text.arg());
147+
}
148+
149+
let new_text = prefix_mod(old_text.to_string().as_str(), bbcode, active);
141150

142151
node.set_text(&new_text);
143152
}

0 commit comments

Comments
 (0)