Route UI labels through the string table
Move start menu, settings, pause, Help, HUD, radio, shift review and campaign labels/templates into content/strings.en.json, including placeholder-validated dynamic status text. No player-facing hardcoded labels remain outside dynamic data/debug output. Headless 250/250, docs check OK.
This commit is contained in:
1 parent
3a74cedee0
commit
af923b1483
10 files changed
+179
-89
No files matched your search
+13
-14
@@ -14,9 +14,9 @@ const UiArt := preload("res://src/game/ui/art.gd")
|
||||
const Strings := preload("res://src/core/strings.gd")
|
||||
|
||||
const VENUES := [
|
||||
{"id": "hollywood_building", "label": "Hollywood Boulevard", "blurb": "Building entrance, tourists and late-night trouble."},
|
||||
{"id": "joke_shop", "label": "The Joke Shop", "blurb": "Guest list, IDs and wand screening."},
|
||||
{"id": "tv_studio", "label": "Late Night TV Studio", "blurb": "Credentials, filming boundary, celebrity arrivals."},
|
||||
{"id": "hollywood_building", "label_key": "venue.hollywood.label", "blurb_key": "venue.hollywood.blurb"},
|
||||
{"id": "joke_shop", "label_key": "venue.joke.label", "blurb_key": "venue.joke.blurb"},
|
||||
{"id": "tv_studio", "label_key": "venue.studio.label", "blurb_key": "venue.studio.blurb"},
|
||||
]
|
||||
|
||||
var _index := 0
|
||||
@@ -83,13 +83,13 @@ func _build() -> void:
|
||||
center.add_child(column)
|
||||
|
||||
var title := Label.new()
|
||||
title.text = "GIG LINE"
|
||||
title.text = Strings.lookup("ui.start_title")
|
||||
title.add_theme_font_size_override("font_size", 44)
|
||||
title.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
|
||||
column.add_child(title)
|
||||
|
||||
var subtitle := Label.new()
|
||||
subtitle.text = "Pick a venue to start your shift."
|
||||
subtitle.text = Strings.lookup("ui.start_subtitle")
|
||||
subtitle.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
|
||||
subtitle.add_theme_color_override("font_color", Color(0.72, 0.75, 0.82))
|
||||
column.add_child(subtitle)
|
||||
@@ -112,7 +112,7 @@ func _build() -> void:
|
||||
var venue: Dictionary = VENUES[i]
|
||||
var button := Button.new()
|
||||
button.name = "Venue_%s" % venue["id"]
|
||||
button.text = "%s\n%s" % [venue["label"], venue["blurb"]]
|
||||
button.text = "%s\n%s" % [Strings.lookup(str(venue["label_key"])), Strings.lookup(str(venue["blurb_key"]))]
|
||||
button.alignment = HORIZONTAL_ALIGNMENT_LEFT
|
||||
button.custom_minimum_size = Vector2(460, 62)
|
||||
button.pressed.connect(_on_venue_pressed.bind(i))
|
||||
@@ -131,13 +131,13 @@ func _build() -> void:
|
||||
|
||||
var help_button := Button.new()
|
||||
help_button.name = "HelpButton"
|
||||
help_button.text = "Help"
|
||||
help_button.text = Strings.lookup("ui.start_help")
|
||||
help_button.pressed.connect(func(): help_requested.emit())
|
||||
row.add_child(help_button)
|
||||
|
||||
var settings_button := Button.new()
|
||||
settings_button.name = "SettingsButton"
|
||||
settings_button.text = "Settings"
|
||||
settings_button.text = Strings.lookup("ui.start_settings")
|
||||
settings_button.pressed.connect(func(): settings_requested.emit())
|
||||
row.add_child(settings_button)
|
||||
|
||||
@@ -148,7 +148,7 @@ func _build() -> void:
|
||||
row.add_child(quit_button)
|
||||
|
||||
var hint := Label.new()
|
||||
hint.text = "Up/Down to choose, Enter to start, Esc to quit"
|
||||
hint.text = Strings.lookup("ui.start_hint")
|
||||
hint.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
|
||||
hint.add_theme_color_override("font_color", Color(0.55, 0.58, 0.65))
|
||||
column.add_child(hint)
|
||||
@@ -199,20 +199,19 @@ func open(campaign: Dictionary = {}) -> void:
|
||||
var complete := bool(_campaign.get("complete", false))
|
||||
if _status:
|
||||
if complete:
|
||||
_status.text = "Campaign complete — pick any venue for a free shift."
|
||||
_status.text = Strings.lookup("ui.campaign_complete")
|
||||
elif next_id != "":
|
||||
_status.text = "Campaign shift %d · next: %s" % [
|
||||
int(_campaign.get("shift_number", 1)), _venue_label(next_id)]
|
||||
_status.text = Strings.fmt("ui.campaign_status", [int(_campaign.get("shift_number", 1)), _venue_label(next_id)])
|
||||
if _continue_button:
|
||||
var next_label := _venue_label(next_id)
|
||||
_continue_button.text = "Continue shift — %s" % next_label if next_id != "" else "Campaign complete"
|
||||
_continue_button.text = Strings.fmt("ui.continue_shift", [next_label]) if next_id != "" else Strings.lookup("ui.campaign_complete_short")
|
||||
_continue_button.visible = not complete
|
||||
_focus_index(_index)
|
||||
|
||||
func _venue_label(id: String) -> String:
|
||||
for venue in VENUES:
|
||||
if str(venue["id"]) == id:
|
||||
return str(venue["label"])
|
||||
return Strings.lookup(str(venue["label_key"]))
|
||||
return id.replace("_", " ").capitalize()
|
||||
|
||||
func _on_continue_pressed() -> void:
|
||||
|
||||
Reference in new issue
Block a user