Added translation support for server orders.
This commit is contained in:
committed by
teinarss
parent
ee95d2591f
commit
0260884369
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user