From 9ba51c6b5155d5f499e69d888c1057561cdb9af2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Mail=C3=A4nder?= Date: Thu, 17 Nov 2022 21:51:14 +0100 Subject: [PATCH] Manually add game speeds to the linter. --- OpenRA.Game/GameSpeed.cs | 1 + OpenRA.Mods.Common/Lint/CheckTranslationReference.cs | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/OpenRA.Game/GameSpeed.cs b/OpenRA.Game/GameSpeed.cs index fb33c1d811..e06753f637 100644 --- a/OpenRA.Game/GameSpeed.cs +++ b/OpenRA.Game/GameSpeed.cs @@ -16,6 +16,7 @@ namespace OpenRA { public class GameSpeed { + [TranslationReference] [FieldLoader.Require] public readonly string Name; diff --git a/OpenRA.Mods.Common/Lint/CheckTranslationReference.cs b/OpenRA.Mods.Common/Lint/CheckTranslationReference.cs index f4526823d1..c8261f6fd9 100644 --- a/OpenRA.Mods.Common/Lint/CheckTranslationReference.cs +++ b/OpenRA.Mods.Common/Lint/CheckTranslationReference.cs @@ -58,6 +58,15 @@ namespace OpenRA.Mods.Common.Lint } } + var gameSpeeds = modData.Manifest.Get(); + foreach (var speed in gameSpeeds.Speeds.Values) + { + if (!translation.HasMessage(speed.Name)) + emitError($"{speed.Name} not present in {language} translation."); + + referencedKeys.Add(speed.Name); + } + foreach (var modType in modData.ObjectCreator.GetTypes()) { foreach (var fieldInfo in modType.GetFields(Binding).Where(m => m.HasAttribute()))