Allow for optional localised text notifications.
This commit is contained in:
committed by
Gustas
parent
b742a776eb
commit
94c8339e17
@@ -27,6 +27,7 @@ namespace OpenRA
|
|||||||
[AttributeUsage(AttributeTargets.Field)]
|
[AttributeUsage(AttributeTargets.Field)]
|
||||||
public sealed class TranslationReferenceAttribute : Attribute
|
public sealed class TranslationReferenceAttribute : Attribute
|
||||||
{
|
{
|
||||||
|
public readonly bool Optional;
|
||||||
public readonly string[] RequiredVariableNames;
|
public readonly string[] RequiredVariableNames;
|
||||||
public readonly LintDictionaryReference DictionaryReference;
|
public readonly LintDictionaryReference DictionaryReference;
|
||||||
|
|
||||||
@@ -41,6 +42,11 @@ namespace OpenRA
|
|||||||
{
|
{
|
||||||
DictionaryReference = dictionaryReference;
|
DictionaryReference = dictionaryReference;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public TranslationReferenceAttribute(bool optional)
|
||||||
|
{
|
||||||
|
Optional = optional;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Translation
|
public class Translation
|
||||||
|
|||||||
@@ -46,7 +46,9 @@ namespace OpenRA.Mods.Common.Lint
|
|||||||
{
|
{
|
||||||
if (key == null)
|
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;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user