Expose mod.yaml content to localisation.
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.
This commit is contained in:
@@ -45,12 +45,20 @@ namespace OpenRA
|
||||
|
||||
public class ModMetadata
|
||||
{
|
||||
public string Title;
|
||||
public string Version;
|
||||
public string Website;
|
||||
public string WebIcon32;
|
||||
public string WindowTitle;
|
||||
public bool Hidden;
|
||||
// FieldLoader used here, must matching naming in YAML.
|
||||
#pragma warning disable IDE1006 // Naming Styles
|
||||
[FluentReference]
|
||||
readonly string Title;
|
||||
public readonly string Version;
|
||||
public readonly string Website;
|
||||
public readonly string WebIcon32;
|
||||
[FluentReference]
|
||||
readonly string WindowTitle;
|
||||
public readonly bool Hidden;
|
||||
#pragma warning restore IDE1006 // Naming Styles
|
||||
|
||||
public string TitleTranslated => FluentProvider.GetString(Title);
|
||||
public string WindowTitleTranslated => WindowTitle != null ? FluentProvider.GetString(WindowTitle) : null;
|
||||
}
|
||||
|
||||
/// <summary>Describes what is to be loaded in order to run a mod.</summary>
|
||||
|
||||
Reference in New Issue
Block a user