feat(text): hover texts come from translation files
What the stations, thralls, the ward and the hive show under the crosshair now reads its text through ModText.Get, and hover.json holds 50 texts in English and Italian. The Aswid thralls and the Race Menu Ward wrote the use key as a literal E; they now use $KEY_Use, which shows the key the player actually bound. For that to work, ModText.Get runs a second localization pass when a $ is left in the result: Valheim resolves tokens once and never looks inside what it inserted, and hover texts go to the HUD without another pass. The Sverm hive stage names stay English for now: the compendium and the hive's goods show them too, and those come with the merchants step. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
19d7cbacbd
commit
99a1817eb0
16 changed files with 164 additions and 79 deletions
|
|
@ -28,7 +28,14 @@ namespace RacesOfValheim
|
|||
string[] words = args
|
||||
.Select(a => Localization.instance.Localize(a?.ToString() ?? ""))
|
||||
.ToArray();
|
||||
return Localization.instance.Localize("$" + key, words);
|
||||
string text = Localization.instance.Localize("$" + key, words);
|
||||
|
||||
// Valheim resolves tokens in one pass and never looks inside what it put in, so a
|
||||
// "$KEY_Use" written in a translation came out as it was. Places that localize the
|
||||
// result again (MessageHud, the stations' own Localize) hid that; hover texts returned
|
||||
// straight to the HUD did not. A second pass costs nothing when there is no $ left.
|
||||
if (text.IndexOf('$') >= 0) text = Localization.instance.Localize(text);
|
||||
return text;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue