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
|
|
@ -70,7 +70,7 @@ namespace RacesOfValheim
|
|||
|
||||
if (!TrolRace.IsTrol())
|
||||
{
|
||||
player.Message(MessageHud.MessageType.Center, "The head will not shout for you.");
|
||||
player.Message(MessageHud.MessageType.Center, ModText.Get("rov_msg_trol_head_will_not_shout"));
|
||||
// With an item in hand, false makes Humanoid.UseItem cover this message with its
|
||||
// generic "$msg_cantuseon"; true tells it the use was handled here.
|
||||
return item != null;
|
||||
|
|
@ -97,19 +97,19 @@ namespace RacesOfValheim
|
|||
{
|
||||
if (IsUpgraded())
|
||||
{
|
||||
player.Message(MessageHud.MessageType.Center, "It has already had one.");
|
||||
player.Message(MessageHud.MessageType.Center, ModText.Get("rov_msg_trol_has_already_had_one"));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (BossProgressionManager.GetCurrentProgressionState() < TrolTotem.UpgradeProgressionState)
|
||||
{
|
||||
player.Message(MessageHud.MessageType.Center, "Not until the one it belonged to has fallen.");
|
||||
player.Message(MessageHud.MessageType.Center, ModText.Get("rov_msg_trol_not_until_one_belonged_has"));
|
||||
return true;
|
||||
}
|
||||
|
||||
player.GetInventory().RemoveItem(item, 1);
|
||||
m_nview.InvokeRPC("RoV_TrolUpgrade");
|
||||
player.Message(MessageHud.MessageType.Center, "The totem wears a king now.");
|
||||
player.Message(MessageHud.MessageType.Center, ModText.Get("rov_msg_trol_totem_wears_king_now"));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -123,7 +123,7 @@ namespace RacesOfValheim
|
|||
Trader trader = GetComponent<Trader>();
|
||||
if (trader == null || StoreGui.instance == null)
|
||||
{
|
||||
player.Message(MessageHud.MessageType.Center, "The head has nothing to say.");
|
||||
player.Message(MessageHud.MessageType.Center, ModText.Get("rov_msg_trol_head_has_nothing_say"));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -148,7 +148,7 @@ namespace RacesOfValheim
|
|||
|
||||
if (CountGroups() >= TrolTotem.MaxTroops)
|
||||
{
|
||||
player.Message(MessageHud.MessageType.Center, "Five warbands is all it can shout for.");
|
||||
player.Message(MessageHud.MessageType.Center, ModText.Get("rov_msg_trol_five_warbands_all_can_shout"));
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -163,7 +163,7 @@ namespace RacesOfValheim
|
|||
|
||||
TakeCoins(inventory, troop.Price);
|
||||
m_nview.InvokeRPC("RoV_TrolHire", troop.Id);
|
||||
player.Message(MessageHud.MessageType.Center, $"{troop.Display} answers.");
|
||||
player.Message(MessageHud.MessageType.Center, ModText.Get("rov_msg_trol_answers", troop.Display));
|
||||
}
|
||||
|
||||
private const string CoinsPrefab = "Coins";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue