feat(text): the race menu reads its texts from translation files
First step of moving every piece of text out of the code so modders can translate the mod. The texts live in Translations/<Language>/*.json, one file per kind of text, which Jotunn finds on its own and falls back to English for. ModText reads them; values take Valheim's $1, $2 placeholders. This step covers the race selection menu: title, buttons, every race's name and description, in English and Italian. The race ID and the name on screen are now separate strings. The ID is what the save and the ZDO hold, so it must never be translated. The files are deployed to plugins\RacesOfValheim\Translations and packed into both release zips. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
a835a58003
commit
73b67cd6ce
5 changed files with 169 additions and 22 deletions
|
|
@ -138,18 +138,33 @@
|
|||
<Warning Text="BepInEx plugins folder not found at $(PLUGINS_PATH) - the DLL was built but not deployed." Condition="!Exists('$(PLUGINS_PATH)')" />
|
||||
<Message Text="Deploying $(TargetName).dll to $(PLUGINS_PATH)" Importance="high" Condition="Exists('$(PLUGINS_PATH)')" />
|
||||
<Copy SourceFiles="$(TargetDir)$(TargetName).dll" DestinationFolder="$(PLUGINS_PATH)\" Condition="Exists('$(PLUGINS_PATH)')" />
|
||||
<!-- The texts. Jotunn finds any Translations\<Language>\*.json anywhere under plugins, so
|
||||
they go in a folder of the mod's own rather than a bare plugins\Translations another mod
|
||||
could be writing into too. -->
|
||||
<Copy SourceFiles="@(TranslationFile)" DestinationFiles="@(TranslationFile->'$(PLUGINS_PATH)\RacesOfValheim\Translations\%(RecursiveDir)%(Filename)%(Extension)')" Condition="Exists('$(PLUGINS_PATH)')" />
|
||||
</Target>
|
||||
|
||||
<ItemGroup>
|
||||
<TranslationFile Include="$(ProjectDir)Translations\**\*.json" />
|
||||
</ItemGroup>
|
||||
|
||||
<Target Name="PackageThunderstore" AfterTargets="Build" Condition="'$(Configuration)'=='Release'">
|
||||
<PropertyGroup>
|
||||
<PackageOutputDir>$(REPO_ROOT)dist\</PackageOutputDir>
|
||||
</PropertyGroup>
|
||||
<MakeDir Directories="$(PackageOutputDir)" Condition="!Exists('$(PackageOutputDir)')" />
|
||||
<!-- Nexus users unzip straight into plugins, so the texts travel inside a RacesOfValheim
|
||||
folder there; Thunderstore already gives every package a folder of its own. -->
|
||||
<PropertyGroup>
|
||||
<NexusStaging>$(IntermediateOutputPath)nexus\</NexusStaging>
|
||||
</PropertyGroup>
|
||||
<RemoveDir Directories="$(NexusStaging)" />
|
||||
<Copy SourceFiles="@(TranslationFile)" DestinationFiles="@(TranslationFile->'$(NexusStaging)RacesOfValheim\Translations\%(RecursiveDir)%(Filename)%(Extension)')" />
|
||||
<Message Text="Packaging Thunderstore and Nexus zips into $(PackageOutputDir)" Importance="high" />
|
||||
<!-- The version is read back out of manifest.json rather than duplicated here, so
|
||||
manifest.json stays the single place a release is numbered. Written with string
|
||||
concatenation because MSBuild would eat a PowerShell $(...) subexpression. -->
|
||||
<Exec Command="powershell -NoProfile -Command "$v = (Get-Content '$(ProjectDir)..\manifest.json' -Raw | ConvertFrom-Json).version_number; Compress-Archive -Path '$(TargetDir)$(TargetName).dll', '$(ProjectDir)..\manifest.json', '$(ProjectDir)..\README.md', '$(ProjectDir)Package\icon.png' -DestinationPath ('$(PackageOutputDir)RacesOfValheim_Thunderstore_' + $v + '.zip') -Force; Compress-Archive -Path '$(TargetDir)$(TargetName).dll' -DestinationPath ('$(PackageOutputDir)RacesOfValheim_Nexus_' + $v + '.zip') -Force"" />
|
||||
<Exec Command="powershell -NoProfile -Command "$v = (Get-Content '$(ProjectDir)..\manifest.json' -Raw | ConvertFrom-Json).version_number; Compress-Archive -Path '$(TargetDir)$(TargetName).dll', '$(ProjectDir)..\manifest.json', '$(ProjectDir)..\README.md', '$(ProjectDir)Package\icon.png', '$(ProjectDir)Translations' -DestinationPath ('$(PackageOutputDir)RacesOfValheim_Thunderstore_' + $v + '.zip') -Force; Compress-Archive -Path '$(TargetDir)$(TargetName).dll', '$(NexusStaging)RacesOfValheim' -DestinationPath ('$(PackageOutputDir)RacesOfValheim_Nexus_' + $v + '.zip') -Force"" />
|
||||
</Target>
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue