diff --git a/Content.IntegrationTests/Tests/Language/LanguageLocalizationTest.cs b/Content.IntegrationTests/Tests/Language/LanguageLocalizationTest.cs new file mode 100644 index 00000000000..11f03e0a00e --- /dev/null +++ b/Content.IntegrationTests/Tests/Language/LanguageLocalizationTest.cs @@ -0,0 +1,39 @@ +using Robust.Shared.Prototypes; +using Robust.Shared.Localization; +using Content.Shared.Language; +using System.Linq; +using System.Collections.Generic; + +namespace Content.IntegrationTests.Tests.Traits; + +/// +/// Checks if every language has a valid name, chatname, and description localization string. +/// +[TestFixture] +[TestOf(typeof(LanguagePrototype))] +public sealed class LanguageLocalizationTest +{ + [Test] + public async Task TestLanguageLocalization() + { + await using var pair = await PoolManager.GetServerClient(); + var server = pair.Server; + + var locale = server.ResolveDependency(); + var proto = server.ResolveDependency(); + + await server.WaitAssertion(() => + { + var missingStrings = new List(); + + foreach (var langProto in proto.EnumeratePrototypes().OrderBy(a => a.ID)) + foreach (var locString in new List { $"language-{langProto.ID}-name", $"chat-language-{langProto.ID}-name", $"language-{langProto.ID}-description" }) + if (!locale.HasString(locString)) + missingStrings.Add($"\"{langProto.ID}\", \"{locString}\""); + + Assert.That(!missingStrings.Any(), Is.True, $"The following languages are missing localization strings:\n {string.Join("\n ", missingStrings)}"); + }); + + await pair.CleanReturnAsync(); + } +}