Use short context names in hotkey yaml, generate translation key at runtime.

This commit is contained in:
RoosterDragon
2024-09-23 19:06:08 +01:00
committed by Gustas
parent 559a76be8d
commit 6bd64677ec
15 changed files with 208 additions and 203 deletions

View File

@@ -10,11 +10,14 @@
#endregion
using System.Collections.Generic;
using System.Linq;
namespace OpenRA
{
public sealed class HotkeyDefinition
{
public const string ContextFluentPrefix = "hotkey-context";
public readonly string Name;
public readonly Hotkey Default = Hotkey.Invalid;
@@ -45,7 +48,8 @@ namespace OpenRA
Types = FieldLoader.GetValue<HashSet<string>>("Types", typesYaml.Value);
if (nodeDict.TryGetValue("Contexts", out var contextYaml))
Contexts = FieldLoader.GetValue<HashSet<string>>("Contexts", contextYaml.Value);
Contexts = FieldLoader.GetValue<HashSet<string>>("Contexts", contextYaml.Value)
.Select(c => ContextFluentPrefix + "." + c).ToHashSet();
if (nodeDict.TryGetValue("Platform", out var platformYaml))
{