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:
@@ -87,6 +87,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
readonly ModData modData;
|
||||
readonly ModContent content;
|
||||
readonly Dictionary<string, ModContent.ModSource> sources;
|
||||
readonly FluentBundle externalFluentBundle;
|
||||
|
||||
readonly Widget panel;
|
||||
readonly LabelWidget titleLabel;
|
||||
@@ -116,11 +117,13 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
Mode visible = Mode.Progress;
|
||||
|
||||
[ObjectCreator.UseCtor]
|
||||
public InstallFromSourceLogic(Widget widget, ModData modData, ModContent content, Dictionary<string, ModContent.ModSource> sources)
|
||||
public InstallFromSourceLogic(
|
||||
Widget widget, ModData modData, ModContent content, Dictionary<string, ModContent.ModSource> sources, FluentBundle externalFluentBundle)
|
||||
{
|
||||
this.modData = modData;
|
||||
this.content = content;
|
||||
this.sources = sources;
|
||||
this.externalFluentBundle = externalFluentBundle;
|
||||
|
||||
Log.AddChannel("install", "install.log");
|
||||
|
||||
@@ -339,7 +342,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
{
|
||||
var containerWidget = (ContainerWidget)checkboxListTemplate.Clone();
|
||||
var checkboxWidget = containerWidget.Get<CheckboxWidget>("PACKAGE_CHECKBOX");
|
||||
checkboxWidget.GetText = () => package.Title;
|
||||
var title = externalFluentBundle.GetString(package.Title);
|
||||
checkboxWidget.GetText = () => title;
|
||||
checkboxWidget.IsDisabled = () => package.Required;
|
||||
checkboxWidget.IsChecked = () => selectedPackages[package.Identifier];
|
||||
checkboxWidget.OnClick = () => selectedPackages[package.Identifier] = !selectedPackages[package.Identifier];
|
||||
|
||||
Reference in New Issue
Block a user