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:
parent
b3641e5bf4
commit
b0d18b0654
61 changed files with 606 additions and 200 deletions
|
|
@ -199,16 +199,16 @@ namespace RacesOfValheim
|
|||
}
|
||||
|
||||
int state = BossProgressionManager.GetCurrentProgressionState();
|
||||
string boss = BossProgressionManager.GetBossNameForState(state);
|
||||
string boss = BossProgressionManager.GetBossTokenForState(state);
|
||||
|
||||
if (clearedPersonal)
|
||||
summary = $"Personal progression reset to {boss} ({state}/{BossProgressionManager.MaxState}). Claim your relics again.";
|
||||
summary = ModText.Get("rov_msg_core_progression_reset", boss, state, BossProgressionManager.MaxState);
|
||||
else if (BossProgressionManager.UsePersonalProgression)
|
||||
summary = $"Nothing to reset - you have claimed no relics yet ({state}/{BossProgressionManager.MaxState}).";
|
||||
summary = ModText.Get("rov_msg_core_nothing_reset_personal", state, BossProgressionManager.MaxState);
|
||||
else
|
||||
summary = $"Nothing to reset - you follow the world's progression: {boss} ({state}/{BossProgressionManager.MaxState}).";
|
||||
summary = ModText.Get("rov_msg_core_nothing_reset_world", boss, state, BossProgressionManager.MaxState);
|
||||
|
||||
if (hadDebugOverride) summary += " Debug override cleared.";
|
||||
if (hadDebugOverride) summary += " " + ModText.Get("rov_msg_core_debug_override_cleared");
|
||||
|
||||
Player player = Player.m_localPlayer;
|
||||
if (player != null)
|
||||
|
|
@ -537,7 +537,7 @@ namespace RacesOfValheim
|
|||
Player.m_localPlayer.m_customData["Race"] = "Human";
|
||||
ZNetView nview = Player.m_localPlayer.GetComponent<ZNetView>();
|
||||
if (nview != null && nview.IsValid()) nview.GetZDO().Set("RacesOfValheim_Race", "Human");
|
||||
Player.m_localPlayer.Message(MessageHud.MessageType.Center, "You chose to remain Human.");
|
||||
Player.m_localPlayer.Message(MessageHud.MessageType.Center, ModText.Get("rov_msg_core_chose_remain_human"));
|
||||
}
|
||||
CloseRaceSelectionMenu();
|
||||
}
|
||||
|
|
@ -552,7 +552,7 @@ namespace RacesOfValheim
|
|||
Player.m_localPlayer.m_customData["FenrirCurse_Active"] = "true";
|
||||
Player.m_localPlayer.GetSEMan().AddStatusEffect("SE_FenrirCurse".GetStableHashCode(), true);
|
||||
|
||||
Player.m_localPlayer.Message(MessageHud.MessageType.Center, "You chose the path of the Fenrir.");
|
||||
Player.m_localPlayer.Message(MessageHud.MessageType.Center, ModText.Get("rov_msg_core_chose_path_fenrir"));
|
||||
}
|
||||
CloseRaceSelectionMenu();
|
||||
}
|
||||
|
|
@ -565,7 +565,7 @@ namespace RacesOfValheim
|
|||
ZNetView nview = Player.m_localPlayer.GetComponent<ZNetView>();
|
||||
if (nview != null && nview.IsValid()) nview.GetZDO().Set("RacesOfValheim_Race", "Skadi");
|
||||
|
||||
Player.m_localPlayer.Message(MessageHud.MessageType.Center, "You chose the path of Skadi.");
|
||||
Player.m_localPlayer.Message(MessageHud.MessageType.Center, ModText.Get("rov_msg_core_chose_path_skadi"));
|
||||
|
||||
// Force update skin colors
|
||||
VisEquipment visEq = Player.m_localPlayer.GetComponent<VisEquipment>();
|
||||
|
|
@ -594,7 +594,7 @@ namespace RacesOfValheim
|
|||
visEq.GetType().GetMethod("UpdateColors", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Public)?.Invoke(visEq, null);
|
||||
}
|
||||
|
||||
Player.m_localPlayer.Message(MessageHud.MessageType.Center, "You chose the path of the Skeleton.");
|
||||
Player.m_localPlayer.Message(MessageHud.MessageType.Center, ModText.Get("rov_msg_core_chose_path_skeleton"));
|
||||
CloseRaceSelectionMenu();
|
||||
}
|
||||
}
|
||||
|
|
@ -624,7 +624,7 @@ namespace RacesOfValheim
|
|||
visEq.GetType().GetMethod("UpdateColors", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Public)?.Invoke(visEq, null);
|
||||
}
|
||||
|
||||
Player.m_localPlayer.Message(MessageHud.MessageType.Center, "You chose the path of the Aswid.");
|
||||
Player.m_localPlayer.Message(MessageHud.MessageType.Center, ModText.Get("rov_msg_core_chose_path_aswid"));
|
||||
CloseRaceSelectionMenu();
|
||||
}
|
||||
}
|
||||
|
|
@ -652,7 +652,7 @@ namespace RacesOfValheim
|
|||
visEq.GetType().GetMethod("UpdateColors", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Public)?.Invoke(visEq, null);
|
||||
}
|
||||
|
||||
Player.m_localPlayer.Message(MessageHud.MessageType.Center, "You chose the path of the Furling.");
|
||||
Player.m_localPlayer.Message(MessageHud.MessageType.Center, ModText.Get("rov_msg_core_chose_path_furling"));
|
||||
CloseRaceSelectionMenu();
|
||||
}
|
||||
}
|
||||
|
|
@ -694,7 +694,7 @@ namespace RacesOfValheim
|
|||
visEq.GetType().GetMethod("UpdateColors", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Public)?.Invoke(visEq, null);
|
||||
}
|
||||
|
||||
Player.m_localPlayer.Message(MessageHud.MessageType.Center, "You chose the path of the Trol.");
|
||||
Player.m_localPlayer.Message(MessageHud.MessageType.Center, ModText.Get("rov_msg_core_chose_path_trol"));
|
||||
CloseRaceSelectionMenu();
|
||||
}
|
||||
}
|
||||
|
|
@ -740,7 +740,7 @@ namespace RacesOfValheim
|
|||
visEq.GetType().GetMethod("UpdateColors", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Public)?.Invoke(visEq, null);
|
||||
}
|
||||
|
||||
Player.m_localPlayer.Message(MessageHud.MessageType.Center, "You chose the path of the Draugh.");
|
||||
Player.m_localPlayer.Message(MessageHud.MessageType.Center, ModText.Get("rov_msg_core_chose_path_draugh"));
|
||||
CloseRaceSelectionMenu();
|
||||
}
|
||||
}
|
||||
|
|
@ -777,7 +777,7 @@ namespace RacesOfValheim
|
|||
visEq.GetType().GetMethod("UpdateVisuals", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Public)?.Invoke(visEq, null);
|
||||
}
|
||||
|
||||
Player.m_localPlayer.Message(MessageHud.MessageType.Center, "You chose the path of the Dvergar.");
|
||||
Player.m_localPlayer.Message(MessageHud.MessageType.Center, ModText.Get("rov_msg_core_chose_path_dvergar"));
|
||||
CloseRaceSelectionMenu();
|
||||
}
|
||||
}
|
||||
|
|
@ -813,7 +813,7 @@ namespace RacesOfValheim
|
|||
visEq.GetType().GetMethod("UpdateVisuals", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Public)?.Invoke(visEq, null);
|
||||
}
|
||||
|
||||
Player.m_localPlayer.Message(MessageHud.MessageType.Center, "You chose the path of the Sverm.");
|
||||
Player.m_localPlayer.Message(MessageHud.MessageType.Center, ModText.Get("rov_msg_core_chose_path_sverm"));
|
||||
CloseRaceSelectionMenu();
|
||||
}
|
||||
}
|
||||
|
|
@ -868,7 +868,7 @@ namespace RacesOfValheim
|
|||
visEq.GetType().GetMethod("UpdateColors", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Public)?.Invoke(visEq, null);
|
||||
}
|
||||
|
||||
Player.m_localPlayer.Message(MessageHud.MessageType.Center, "You chose the path of the Trenta.");
|
||||
Player.m_localPlayer.Message(MessageHud.MessageType.Center, ModText.Get("rov_msg_core_chose_path_trenta"));
|
||||
CloseRaceSelectionMenu();
|
||||
}
|
||||
}
|
||||
|
|
@ -1015,7 +1015,7 @@ namespace RacesOfValheim
|
|||
|
||||
if (Player.m_localPlayer != null)
|
||||
{
|
||||
Player.m_localPlayer.Message(MessageHud.MessageType.Center, $"World Progression State: {state}");
|
||||
Player.m_localPlayer.Message(MessageHud.MessageType.Center, ModText.Get("rov_msg_core_world_progression_state", state));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1038,7 +1038,7 @@ namespace RacesOfValheim
|
|||
Console.instance.Print($"[DEBUG] Progression state increased to: {BossProgressionManager.DebugState}");
|
||||
if (Player.m_localPlayer != null)
|
||||
{
|
||||
Player.m_localPlayer.Message(MessageHud.MessageType.Center, $"Progression State: {BossProgressionManager.DebugState}");
|
||||
Player.m_localPlayer.Message(MessageHud.MessageType.Center, ModText.Get("rov_msg_core_progression_state", BossProgressionManager.DebugState));
|
||||
Traverse.Create(Player.m_localPlayer).Method("SetupEquipment").GetValue();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue