Added translation support for server orders.

This commit is contained in:
Matthias Mailänder
2021-12-18 20:12:28 +01:00
committed by teinarss
parent ee95d2591f
commit 0260884369
19 changed files with 834 additions and 149 deletions

View File

@@ -19,6 +19,19 @@ using OpenRA.FileSystem;
namespace OpenRA
{
[AttributeUsage(AttributeTargets.Field)]
public sealed class TranslationReferenceAttribute : Attribute
{
public readonly string[] RequiredVariableNames;
public TranslationReferenceAttribute() { }
public TranslationReferenceAttribute(params string[] requiredVariableNames)
{
RequiredVariableNames = requiredVariableNames;
}
}
public class Translation
{
readonly IEnumerable<MessageContext> messageContexts;
@@ -71,6 +84,15 @@ namespace OpenRA
return key;
}
public bool HasAttribute(string key)
{
foreach (var messageContext in messageContexts)
if (messageContext.HasMessage(key))
return true;
return false;
}
public string GetAttribute(string key, string attribute)
{
if (key == null)