build: new generic lines fall back in the plan's language; Tomter Vel's front door deployed
List notes, empty lists and the invite form's guidance are lines no model is asked about before a page ships; on a Norwegian site they showed in English until reworded. They now fall back in Norwegian for no/nb/nn plans, like the mail fallbacks. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
5e736668e4
commit
cda3b0685a
+20
-11
@@ -747,7 +747,16 @@ fn internal_page(need: &PlanNeed, group: &str) -> String {
|
||||
/// The words every page needs, as built-in fallbacks: plain, English,
|
||||
/// made from the plan's own text. Keyed by file path, then the same
|
||||
/// JSON shape the model is asked for.
|
||||
/// A generic line in the plan's language: English, or Norwegian for
|
||||
/// `no`/`nb`/`nn`. For the few fallbacks no model is asked about
|
||||
/// before a page ships (list notes, empty lists), so a Norwegian site
|
||||
/// does not show English where its own words have not reached yet.
|
||||
fn loc(lang: &str, en: &str, no: &str) -> String {
|
||||
if lang.starts_with("no") || lang.starts_with("nb") || lang.starts_with("nn") { no } else { en }.to_string()
|
||||
}
|
||||
|
||||
pub fn fallback_words(plan: &Plan) -> BTreeMap<String, Value> {
|
||||
let lang = plan.language.as_str();
|
||||
// Every part of the card portal renders has a slot: the model
|
||||
// gets to write the button, an encouragement, the section's icon
|
||||
// and guidance line, and a placeholder per field, not only the
|
||||
@@ -814,10 +823,10 @@ pub fn fallback_words(plan: &Plan) -> BTreeMap<String, Value> {
|
||||
shopping.insert(
|
||||
format!("status-{bucket}"),
|
||||
json!({
|
||||
"heading": format!("Latest {}", humanize(bucket).to_lowercase()),
|
||||
"heading": format!("{} {}", loc(lang, "Latest", "Siste"), humanize(bucket).to_lowercase()),
|
||||
"description": public_blurb(&needs),
|
||||
"link": format!("All {}", humanize(bucket).to_lowercase()),
|
||||
"empty": "Nothing here yet.",
|
||||
"link": format!("{} {}", loc(lang, "All", "Alle"), humanize(bucket).to_lowercase()),
|
||||
"empty": loc(lang, "Nothing here yet.", "Ingenting her ennå."),
|
||||
"icon": "list",
|
||||
}),
|
||||
);
|
||||
@@ -829,7 +838,7 @@ pub fn fallback_words(plan: &Plan) -> BTreeMap<String, Value> {
|
||||
"description": plan.about,
|
||||
"opener": { "heading": "What we do", "description": "", "features": does },
|
||||
// Named for what it shows, never an invitation to look.
|
||||
"shopping": { "heading": format!("Latest from {}", plan.business), "description": "", "items": shopping },
|
||||
"shopping": { "heading": format!("{} {}", loc(lang, "Latest from", "Siste fra"), plan.business), "description": "", "items": shopping },
|
||||
// A door's feature says what is behind it, from the needs
|
||||
// that sit there: a card that leads somewhere has to say
|
||||
// where, or it is a button with decoration around it.
|
||||
@@ -890,9 +899,9 @@ pub fn fallback_words(plan: &Plan) -> BTreeMap<String, Value> {
|
||||
// buttons under it do; the card's own description says
|
||||
// what the cases are.
|
||||
let note = if moves.is_empty() {
|
||||
"Each row is one case and the stage it has reached. Another desk moves these.".to_string()
|
||||
loc(lang, "Each row is one case and the stage it has reached. Another desk moves these.", "Hver rad er én sak og hvor langt den har kommet. En annen pult flytter disse.")
|
||||
} else {
|
||||
"Each row is one case. The buttons record what you have just done with it.".to_string()
|
||||
loc(lang, "Each row is one case. The buttons record what you have just done with it.", "Hver rad er én sak. Knappene fører opp det du nettopp har gjort med den.")
|
||||
};
|
||||
let from_whom = format!("Sent in by {}.", needs.iter().map(|n| n.who.as_str()).collect::<Vec<_>>().join(" or "));
|
||||
(bucket.to_string(), json!({ "heading": humanize(bucket), "description": from_whom, "moves": moves, "list_title": humanize(bucket), "list_note": note }))
|
||||
@@ -915,7 +924,7 @@ pub fn fallback_words(plan: &Plan) -> BTreeMap<String, Value> {
|
||||
"description": format!("They get an account, a place in {}, and a one-time link to set their own password or passkey.", label_of(plan, g)),
|
||||
"button": "Invite",
|
||||
"form_title": "Who",
|
||||
"form_description": "Their name, and the address the account and its one-time link go to.".to_string(),
|
||||
"form_description": loc(lang, "Their name, and the address the account and its one-time link go to.", "Navnet deres, og adressen kontoen og engangslenken går til."),
|
||||
"labels": { "name": "Name", "email": "Email" },
|
||||
}))
|
||||
})
|
||||
@@ -927,8 +936,8 @@ pub fn fallback_words(plan: &Plan) -> BTreeMap<String, Value> {
|
||||
"heading": "Invitations sent",
|
||||
"description": "Each invite with the link it made. Mark it done when the person is in.",
|
||||
"done": "Is in",
|
||||
"list_title": "Who has been invited",
|
||||
"list_note": "Each row is one invitation, with the one-time link while it is unused.",
|
||||
"list_title": loc(lang, "Who has been invited", "Hvem som er invitert"),
|
||||
"list_note": loc(lang, "Each row is one invitation, with the one-time link while it is unused.", "Hver rad er én invitasjon, med engangslenken så lenge den ikke er brukt."),
|
||||
})
|
||||
};
|
||||
words.insert(
|
||||
@@ -948,8 +957,8 @@ pub fn fallback_words(plan: &Plan) -> BTreeMap<String, Value> {
|
||||
// A public list says what a row is and what it leaves
|
||||
// out, since the reader cannot know what was pruned.
|
||||
"list_title": humanize(bucket),
|
||||
"list_note": "Each row is one case and the stage it has reached. Names and contact details are not shown here.",
|
||||
"empty": "Nothing here yet.",
|
||||
"list_note": loc(lang, "Each row is one case and the stage it has reached. Names and contact details are not shown here.", "Hver rad er én sak og hvor langt den har kommet. Navn og kontaktopplysninger vises ikke her."),
|
||||
"empty": loc(lang, "Nothing here yet.", "Ingenting her ennå."),
|
||||
"back": "Back",
|
||||
}),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user