feat(text): item, piece and creature names come from translation files

The mod's own items, build pieces and summoned creatures now carry
$rov_item_, $rov_piece_ and $rov_creature_ tokens for their names and
descriptions, and items.json holds the texts in English and Italian.
Valheim localizes these fields wherever it shows them: tooltips, hover
texts, messages, the build menu.

Where a name doubles as an identifier, both sides use the same constant,
so the comparisons still hold. The Aswid foods keep their prefix as a
constant for the refinery's check and now name the creature with its
vanilla token, so "Boar" translates too. The Furling crops get one whole
description per crop instead of an English sentence with the metal dropped
in. The Race Menu Ward's panel title is a mod UI Text, so it reads the
translation directly.

Saves are unaffected: items and eaten foods are stored by prefab name.
The Sverm hive's goods stay for the merchant step.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
kanym 2026-09-26 19:58:53 +02:00
commit b177c89c71
34 changed files with 405 additions and 142 deletions

View file

@ -7,6 +7,9 @@ namespace RacesOfValheim
{
public class AswidRace : MonoBehaviour
{
/// <summary>The start of every Aswid food's name, and how those items are told apart.</summary>
public const string AswidFoodNamePrefix = "$rov_item_aswid_food_name";
public static AswidRace Instance { get; private set; }
private static Dictionary<string, string> mobToTrophyMap = new Dictionary<string, string>
@ -117,8 +120,12 @@ namespace RacesOfValheim
string foodName = "AswidFood_" + mobName;
Jotunn.Configs.ItemConfig config = new Jotunn.Configs.ItemConfig();
config.Name = "Aswid Food: " + mobName;
config.Description = "The life force of the conquered.";
// The prefix token and the creature's own vanilla token ("$enemy_boar"), which the
// game translates too. The prefix is also how the refinery recognises these items -
// see AswidBloodRefinery.IsAswidMeal - so the two must stay the same string.
string mobDisplay = Jotunn.Managers.PrefabManager.Cache.GetPrefab<Character>(mobName)?.m_name;
config.Name = AswidFoodNamePrefix + " " + (string.IsNullOrEmpty(mobDisplay) ? mobName : mobDisplay);
config.Description = "$rov_item_aswid_food_desc";
Jotunn.Entities.CustomItem customItem = null;