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

@ -42,7 +42,7 @@ namespace RacesOfValheim
{
if (!DraughRace.IsDraugh())
{
player.Message(MessageHud.MessageType.Center, "This rotting flesh is fatal to the living.");
player.Message(MessageHud.MessageType.Center, ModText.Get("rov_msg_draugh_this_rotting_flesh_fatal_living"));
return false; // Block consumption
}
// If it IS a Draugh, let them consume it via native mechanics
@ -101,7 +101,7 @@ namespace RacesOfValheim
bool isFood = item.m_shared.m_food > 0 || item.m_shared.m_foodStamina > 0 || item.m_shared.m_foodEitr > 0;
if (isFood)
{
player.Message(MessageHud.MessageType.Center, "Draugr consume only raw flesh, eyes, entrails or blood.");
player.Message(MessageHud.MessageType.Center, ModText.Get("rov_msg_draugh_draugr_consume_only_raw_flesh"));
return false; // Block it
}
}

View file

@ -153,7 +153,7 @@ namespace RacesOfValheim
}
}
Player.m_localPlayer.Message(MessageHud.MessageType.TopLeft, "The northern wind blows");
Player.m_localPlayer.Message(MessageHud.MessageType.TopLeft, ModText.Get("rov_msg_draugh_northern_wind_blows"));
}
}
}
@ -312,7 +312,7 @@ namespace RacesOfValheim
if (prefab != null)
{
Player.m_localPlayer.Message(MessageHud.MessageType.Center, "Swarm of Terror!");
Player.m_localPlayer.Message(MessageHud.MessageType.Center, ModText.Get("rov_msg_draugh_swarm_terror"));
for (int i = 0; i < DraughConfig.SwarmSpawnCount.Value; i++)
{
@ -356,7 +356,7 @@ namespace RacesOfValheim
float healAmount = Player.m_localPlayer.GetMaxHealth() * DraughConfig.StealBreathHealPercent.Value;
Player.m_localPlayer.Heal(healAmount);
Player.m_localPlayer.Message(MessageHud.MessageType.Center, "Steal Their Breath! Death is denied.");
Player.m_localPlayer.Message(MessageHud.MessageType.Center, ModText.Get("rov_msg_draugh_steal_their_breath_death_denied"));
// Restore visuals immediately
if (Player.m_localPlayer.GetComponent<VisEquipment>() != null)

View file

@ -133,7 +133,7 @@ namespace RacesOfValheim
public System.Collections.IEnumerator UndyingWillRoutine(Player p)
{
p.Message(MessageHud.MessageType.Center, "Zombie Ritual Activated! Your borrowed time is fading...");
p.Message(MessageHud.MessageType.Center, ModText.Get("rov_msg_draugh_zombie_ritual_activated_borrowed_time"));
// Trigger a re-evaluation of visuals to apply the ghost effect
if (p.GetComponent<VisEquipment>() != null)

View file

@ -129,7 +129,7 @@ namespace RacesOfValheim
PieceDensityLimit.Register(PieceName,
PieceDensityLimit.RadiusForArea(DensityAreaKm2), MaxPilesInRange,
"The ground here already carries {0} of these. Find another country.");
"rov_msg_build_limit_draugh_bodypile");
}
// ---------------------------------------------------------------- items
@ -201,7 +201,7 @@ namespace RacesOfValheim
thrall.m_maxFollowers = maxFollowers;
thrall.m_witherSeconds = OrphanWitherSeconds;
thrall.m_homeCheckRange = HomeCheckRange;
thrall.m_refusalMessage = "The dead do not take orders from the living.";
thrall.m_refusalMessage = "$rov_msg_thrall_refusal_draugh";
PrefabManager.Instance.AddPrefab(prefab);
}

View file

@ -82,7 +82,7 @@ namespace RacesOfValheim
if (item == null) item = FindAnyInput(inventory);
if (item == null)
{
user.Message(MessageHud.MessageType.Center, "It wants flesh, or the head of one of its own.");
user.Message(MessageHud.MessageType.Center, ModText.Get("rov_msg_draugh_wants_flesh_or_head_one"));
return false;
}
@ -93,7 +93,7 @@ namespace RacesOfValheim
if (prefabName == DraughSpawner.TrophyDraugrElite && !IsUpgraded())
{
user.Message(MessageHud.MessageType.Center, "This pile keeps no officers yet.");
user.Message(MessageHud.MessageType.Center, ModText.Get("rov_msg_draugh_this_pile_keeps_no_officers"));
return false;
}
@ -162,19 +162,19 @@ namespace RacesOfValheim
{
if (IsUpgraded())
{
user.Message(MessageHud.MessageType.Center, "It has already had one.");
user.Message(MessageHud.MessageType.Center, ModText.Get("rov_msg_draugh_has_already_had_one"));
return false;
}
if (BossProgressionManager.GetCurrentProgressionState() < DraughSpawner.UpgradeProgressionState)
{
user.Message(MessageHud.MessageType.Center, "The bone will not wake. Something older has to fall first.");
user.Message(MessageHud.MessageType.Center, ModText.Get("rov_msg_draugh_bone_will_not_wake_something"));
return false;
}
inventory.RemoveItem(item, 1);
m_nview.InvokeRPC("RoV_DraughUpgrade");
user.Message(MessageHud.MessageType.Center, "The pile stirs. It will keep officers now.");
user.Message(MessageHud.MessageType.Center, ModText.Get("rov_msg_draugh_pile_stirs_will_keep_officers"));
return true;
}
@ -294,7 +294,7 @@ namespace RacesOfValheim
if (bound.Count > 0 && Player.m_localPlayer != null)
{
Player.m_localPlayer.Message(MessageHud.MessageType.Center,
$"The pile is broken. {bound.Count} will not outlast it by more than a minute.");
ModText.Get("rov_msg_draugh_pile_broken_will_not_outlast", bound.Count));
}
SetFlesh(0f);