Skip to content

Expose mod.yaml content to localisation.#21601

Merged
PunkPun merged 2 commits intoOpenRA:bleedfrom
RoosterDragon:loading-ftl
Oct 7, 2024
Merged

Expose mod.yaml content to localisation.#21601
PunkPun merged 2 commits intoOpenRA:bleedfrom
RoosterDragon:loading-ftl

Conversation

@RoosterDragon
Copy link
Member

@RoosterDragon RoosterDragon commented Sep 30, 2024

Mod metadata, load screens and mod content is all now sourced from ftl files, allowing these items to be translated.

Translations are now initialized as part of ModData creation, as currently they are made available too late for the usage we need here.

The "modcontent" mod learns a new parameter for "Content.TranslationFile" - this allows a mod to provide the path of a translation file to the mod which it can load. This allows mods such as ra, cnc, d2k, ts to own the translations for their ModContent, yet still make them accessible to the modcontent mod.

CheckFluentReference learns to validate all these new fields to ensure translations have been set.

Copy link
Member

@PunkPun PunkPun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ra crashes on startup

Exception of type `System.NullReferenceException`: Object reference not set to an instance of an object.
   at OpenRA.TranslationProvider.GetString(String key, IDictionary`2 args) in /GitHub/OpenRA/OpenRA.Game/TranslationProvider.cs:line 41
   at OpenRA.ExternalMods.Register(Manifest mod, String launchPath, IEnumerable`1 launchArgs, ModRegistration registration) in /GitHub/OpenRA/OpenRA.Game/ExternalMods.cs:line 126

@RoosterDragon
Copy link
Member Author

ra crashes on startup

This seems to be relted to external mod registrations. I've removed the "Title" field since we may not be able to provide the translated title - as we haven't loaded the translations. This means GameServer.ModTitle might not be human-readable any more since I've had to use the mod ID in some places instead. Not sure what we can reasonably do here - the "human-readable" text might not be available in the required language anyway.

@RoosterDragon RoosterDragon force-pushed the loading-ftl branch 2 times, most recently from 6ffa62a to caed592 Compare October 2, 2024 17:47
@pchote
Copy link
Member

pchote commented Oct 2, 2024

Mod registrations are local to the current computer, so its fine to take the current language and write localised strings directly into the metadata.

@RoosterDragon
Copy link
Member Author

Okay it's good that the text will match. However that still leaves the problem with the mod not being loaded, thus no translations, thus no ability to write out the translated title anyway.

Copy link
Member

@PunkPun PunkPun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't launch ./launch-dedicated.sh

OpenRA/OpenRA.Game/Manifest.cs(60,17): error CS0102: The type 'ModMetadata' already contains a definition for 'Title' [OpenRA/OpenRA.Game/OpenRA.Game.csproj]

If WordWrap is enabled, the wrapping must be applied before any TextAlign is applied, or the final position will be incorrect.

Introduce a IncreaseHeightToFitCurrentText to make such WordWrap labels easier to use, and apply to CreditsLogic.
Mod metadata, load screens and mod content is all now sourced from ftl files, allowing these items to be translated.

Translations are now initialized as part of ModData creation, as currently they are made available too late for the usage we need here.

The "modcontent" mod learns a new parameter for "Content.TranslationFile" - this allows a mod to provide the path of a translation file to the mod which it can load. This allows mods such as ra, cnc, d2k, ts to own the translations for their ModContent, yet still make them accessible to the modcontent mod.

CheckFluentReference learns to validate all these new fields to ensure translations have been set.
@RoosterDragon
Copy link
Member Author

Can't launch ./launch-dedicated.sh

That looks like a local merge error. I've rebased onto bleed if that is helpful.

@PunkPun PunkPun merged commit bb17cfa into OpenRA:bleed Oct 7, 2024
@PunkPun
Copy link
Member

PunkPun commented Oct 7, 2024

changelog

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants