Expose hotkeys to localisation.

Allows the Settings > Hotkeys screen to be localised, including hotkey decriptions, groups and contexts.

The hotkey names are exposed to localisation via KeycodeExts. Hotkey modifiers are similarly exposed via ModifersExts.

The Settings > Input screen has a Zoom Modifier dropdown, which shows the localised modifier name.

The --check-yaml utility command is taught to recognise all hotkey translation, so it can validate their usage.
This commit is contained in:
RoosterDragon
2024-09-17 19:42:42 +01:00
committed by Gustas
parent 10856ccfd0
commit 6f6fb5b393
39 changed files with 1284 additions and 722 deletions

View File

@@ -37,7 +37,9 @@ namespace OpenRA.Mods.Common.Lint
return expr != null ? expr.Variables : Enumerable.Empty<string>();
}
if (type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Dictionary<,>))
if (type.IsGenericType &&
(type.GetGenericTypeDefinition() == typeof(Dictionary<,>) ||
type.GetGenericTypeDefinition() == typeof(IReadOnlyDictionary<,>)))
{
// Use an intermediate list to cover the unlikely case where both keys and values are lintable.
var dictionaryValues = new List<string>();
@@ -60,6 +62,9 @@ namespace OpenRA.Mods.Common.Lint
"Dictionary<string, T> (LintDictionaryReference.Keys)",
"Dictionary<T, string> (LintDictionaryReference.Values)",
"Dictionary<T, IEnumerable<string>> (LintDictionaryReference.Values)",
"IReadOnlyDictionary<string, T> (LintDictionaryReference.Keys)",
"IReadOnlyDictionary<T, string> (LintDictionaryReference.Values)",
"IReadOnlyDictionary<T, IEnumerable<string>> (LintDictionaryReference.Values)",
"BooleanExpression", "IntegerExpression"
};