Localize the splitscreen join and controller prompts

The join strip, the waiting player's prompt and the controller notices
read horizon.splitscreen.prompt.* keys (en_us, fr_fr) instead of English
literals.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
martipopsandClaude Opus 5.5 committed 2026-11-01 19:32:34 -05:00
1 parent ecf18374a8
commit 3c3060ae5a
4 files changed
+43 -12

No files matched your search

@@ -361,6 +361,17 @@
"horizon.splitscreen.setup.help.apply": "Play the way the map shows.",
"horizon.splitscreen.setup.help.unchanged": "Nothing changed yet.",
"horizon.splitscreen.setup.give_up_pad": "Give Up Pad",
"horizon.splitscreen.prompt.controller_connected": "Controller connected",
"horizon.splitscreen.prompt.controller_disconnected": "Controller disconnected",
"horizon.splitscreen.prompt.controller_disconnected.hint": "Reconnect it, or press a button on another",
"horizon.splitscreen.prompt.join.one": "%s wants to join",
"horizon.splitscreen.prompt.join.many": "%s controllers want to join",
"horizon.splitscreen.prompt.join.yes": "Join",
"horizon.splitscreen.prompt.join.as_p1": "Play as P1",
"horizon.splitscreen.prompt.join.no": "No",
"horizon.splitscreen.prompt.lost": "%s: controller disconnected",
"horizon.splitscreen.prompt.lost.use_another": "Use another",
"horizon.splitscreen.prompt.lost.leave": "Leave",
"horizon.splitscreen.setup.help.give_up_pad": "Your controller stops driving you and is offered to join (A).",
"horizon.splitscreen.setup.note.held_at": "%s to %s: A drops it here, B puts it back.",
"horizon.splitscreen.setup.note.held": "%s picked up: left/right picks where, A drops, B puts it back."
@@ -345,6 +345,17 @@
"horizon.splitscreen.setup.help.apply": "Jouer comme le montre la carte.",
"horizon.splitscreen.setup.help.unchanged": "Rien n'a encore changé.",
"horizon.splitscreen.setup.give_up_pad": "Céder la manette",
"horizon.splitscreen.prompt.controller_connected": "Manette connectée",
"horizon.splitscreen.prompt.controller_disconnected": "Manette déconnectée",
"horizon.splitscreen.prompt.controller_disconnected.hint": "Reconnectez-la, ou appuyez sur un bouton d'une autre",
"horizon.splitscreen.prompt.join.one": "%s veut rejoindre",
"horizon.splitscreen.prompt.join.many": "%s manettes veulent rejoindre",
"horizon.splitscreen.prompt.join.yes": "Rejoindre",
"horizon.splitscreen.prompt.join.as_p1": "Jouer en J1",
"horizon.splitscreen.prompt.join.no": "Non",
"horizon.splitscreen.prompt.lost": "%s : manette déconnectée",
"horizon.splitscreen.prompt.lost.use_another": "Utiliser une autre",
"horizon.splitscreen.prompt.lost.leave": "Quitter",
"horizon.splitscreen.setup.help.give_up_pad": "Votre manette ne vous contrôle plus et peut rejoindre la partie (A).",
"horizon.splitscreen.setup.note.held_at": "%s vers %s : A le dépose ici, B le remet en place.",
"horizon.splitscreen.setup.note.held": "%s est pris : gauche/droite choisit où, A dépose, B remet en place."
+12 -4
View File
@@ -58,7 +58,7 @@ fn panel(batch: &mut HudBatch, atlas: &horizon_client::hud::HudAtlas, [px, py, p
pub(super) struct Prompt {
pub(super) ask: Ask,
pub(super) title: String,
pub(super) choices: Vec<(Button, &'static str)>,
pub(super) choices: Vec<(Button, String)>,
}
/// What a prompt asks: a controller may join (every view, a strip at the top: nobody stops
@@ -70,12 +70,20 @@ pub(super) enum Ask {
Lost,
}
/// A splitscreen prompt's text in the selected language (`horizon.splitscreen.prompt.*`).
pub(super) fn tr(key: &str, args: &[&dyn std::fmt::Display]) -> String {
horizon_client::lang::tr(&format!("horizon.splitscreen.prompt.{key}"), args)
}
/// The question on a waiting player's view.
pub(super) fn lost_prompt(name: &str) -> Prompt {
Prompt {
ask: Ask::Lost,
title: format!("{name}: controller disconnected"),
choices: vec![(Button::South, "Use another"), (Button::East, "Leave")],
title: tr("lost", &[&name]),
choices: vec![
(Button::South, tr("lost.use_another", &[])),
(Button::East, tr("lost.leave", &[])),
],
}
}
@@ -119,7 +127,7 @@ impl Game<'_> {
let glyphs: Vec<_> = prompt
.choices
.iter()
.map(|&(b, what)| (b.label(style), b.color(style), what))
.map(|(b, what)| (b.label(style), b.color(style), what.as_str()))
.collect();
let line: f32 = glyphs
.iter()
+9 -8
View File
@@ -1,6 +1,7 @@
//! Controllers: which player each drives, joining with one, and one disconnecting (its player
//! waits for another). One reader for every player's game (`PadRouter`) while splitscreen
//! watches the controllers; otherwise P1 reads them itself, as without splitscreen.
use super::hud::tr;
use super::*;
use crate::game::pad::{PadEvent, PadId};
use horizon_client::gamepad::{Button, PadState};
@@ -312,8 +313,8 @@ impl Split<'_> {
if self.in_world() {
self.lost.push(Lost { seat: 1, id, uuid });
self.host.split_hud.notice = Some(Notice::new(
"Controller disconnected",
"Reconnect it, or press a button on another",
tr("controller_disconnected", &[]),
tr("controller_disconnected.hint", &[]),
));
}
return;
@@ -351,7 +352,7 @@ impl Split<'_> {
if hud.prompt.as_ref().is_some_and(|p| p.ask == Ask::Lost) {
hud.prompt = None;
}
hud.notice = Some(Notice::new("Controller connected", ""));
hud.notice = Some(Notice::new(tr("controller_connected", &[]), ""));
}
/// A button on a controller nobody has while players wait for one: true when it answered
@@ -396,14 +397,14 @@ impl Split<'_> {
/// Every player sees the controllers waiting to join, whatever it is doing.
fn ask_to_join(&mut self) {
let title = match self.offers.as_slice() {
[(id, _)] => format!("{} wants to join", self.pads.name(*id)),
offers => format!("{} controllers want to join", offers.len()),
[(id, _)] => tr("join.one", &[&self.pads.name(*id)]),
offers => tr("join.many", &[&offers.len()]),
};
let mut choices = vec![(Button::South, "Join")];
let mut choices = vec![(Button::South, tr("join.yes", &[]))];
if self.p1_pad.owner.is_none() && self.host.settings.controller.enabled {
choices.push((Button::North, "Play as P1"));
choices.push((Button::North, tr("join.as_p1", &[])));
}
choices.push((Button::East, "No"));
choices.push((Button::East, tr("join.no", &[])));
self.prompt_join(Some(Prompt {
ask: Ask::Join,
title,