feat(text): on-screen messages come from translation files

Every message the mod puts in the middle or corner of the screen now reads
its text through ModText.Get, and messages.json holds 191 texts in English
and Italian. Values computed in code become $1, $2 in the text, so a
translator can put them wherever the sentence needs them. Branching
messages get one key per branch.

A few messages travel through a field before they are shown: thralls'
refusals and the building limits now hold a token or key there. Boss and
form names inside messages use tokens too, the bosses the game's own, so
"The Elder" arrives translated.

ModText.Get now localizes each argument before inserting it. A token
argument left for a later pass ran into the text after it: "$1's power"
became the unknown token "enemy_eikthyr's".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
kanym 2026-09-26 20:30:03 +02:00
commit b0d18b0654
61 changed files with 606 additions and 200 deletions

View file

@ -195,7 +195,7 @@ namespace RacesOfValheim
PieceDensityLimit.Register(PieceName,
PieceDensityLimit.RadiusForArea(DensityAreaKm2), MaxBanksInRange,
"There is already {0} contract bank within a day's walk. One ledger per valley.");
"rov_msg_build_limit_dvergar_contractbank");
}
// ---------------------------------------------------------------- the hired
@ -233,7 +233,7 @@ namespace RacesOfValheim
thrall.m_maxFollowers = MaxFollowers;
thrall.m_witherSeconds = WitherSeconds;
thrall.m_homeCheckRange = HomeCheckRange;
thrall.m_refusalMessage = "Your name is not on the contract.";
thrall.m_refusalMessage = "$rov_msg_thrall_refusal_dvergar";
// Ten seconds unhurt, then two percent a second - the sentry's regeneration, shared with
// the Trol's troops and the Fenrir's pack. A dead mercenary still stays dead.
@ -412,7 +412,7 @@ namespace RacesOfValheim
if (Utils.GetPrefabName(__0.gameObject) != DvergarBanco.PieceName) return true;
if (DvergarRace.IsDvergar()) return true;
__instance.Message(MessageHud.MessageType.Center, "The contract is in runic. You do not sign it.");
__instance.Message(MessageHud.MessageType.Center, ModText.Get("rov_msg_dvergar_contract_runic_do_not_sign"));
return false;
}
}