Allow for optional localised text notifications.

This commit is contained in:
Matthias Mailänder
2023-05-08 21:45:03 +02:00
committed by Gustas
parent b742a776eb
commit 94c8339e17
2 changed files with 9 additions and 1 deletions

View File

@@ -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

View File

@@ -46,7 +46,9 @@ namespace OpenRA.Mods.Common.Lint
{
if (key == null)
{
if (!translationReference.Optional)
emitError($"Trait `{traitInfo.InstanceName}` on field `{field.Name}` has an empty translation reference.");
continue;
}