diff --git a/OpenRA.Game/Translation.cs b/OpenRA.Game/Translation.cs index 9f1f062f62..90b1fc6182 100644 --- a/OpenRA.Game/Translation.cs +++ b/OpenRA.Game/Translation.cs @@ -27,6 +27,7 @@ namespace OpenRA [AttributeUsage(AttributeTargets.Field)] public sealed class TranslationReferenceAttribute : Attribute { + public readonly bool Optional; public readonly string[] RequiredVariableNames; public readonly LintDictionaryReference DictionaryReference; @@ -41,6 +42,11 @@ namespace OpenRA { DictionaryReference = dictionaryReference; } + + public TranslationReferenceAttribute(bool optional) + { + Optional = optional; + } } public class Translation diff --git a/OpenRA.Mods.Common/Lint/CheckTranslationReference.cs b/OpenRA.Mods.Common/Lint/CheckTranslationReference.cs index df2ff65fae..f759bab059 100644 --- a/OpenRA.Mods.Common/Lint/CheckTranslationReference.cs +++ b/OpenRA.Mods.Common/Lint/CheckTranslationReference.cs @@ -46,7 +46,9 @@ namespace OpenRA.Mods.Common.Lint { if (key == null) { - emitError($"Trait `{traitInfo.InstanceName}` on field `{field.Name}` has an empty translation reference."); + if (!translationReference.Optional) + emitError($"Trait `{traitInfo.InstanceName}` on field `{field.Name}` has an empty translation reference."); + continue; }