From 6e7ad9df250f8dd61c3c0b280b9bb420fa7697bb Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Thu, 24 Dec 2020 17:51:09 +0000 Subject: [PATCH] Remove vestigial translation plumbing. This was never completed to the level required to be properly used ingame. --- OpenRA.Game/FieldLoader.cs | 36 --------- OpenRA.Game/GameSpeed.cs | 1 - OpenRA.Game/Manifest.cs | 3 +- OpenRA.Game/Map/Map.cs | 2 - OpenRA.Game/ModData.cs | 38 --------- OpenRA.Game/Settings.cs | 3 - OpenRA.Game/Traits/Player/Shroud.cs | 4 - OpenRA.Game/Traits/World/Faction.cs | 1 - .../GrantPrerequisiteChargeDrainPower.cs | 2 - OpenRA.Mods.Common/Traits/Buildable.cs | 1 - .../Player/ConquestVictoryConditions.cs | 1 - .../Traits/Player/DeveloperMode.cs | 2 - .../Traits/Player/PlayerResources.cs | 2 - .../Traits/Player/ProvidesTechPrerequisite.cs | 1 - .../Player/StrategicVictoryConditions.cs | 1 - .../Traits/Render/WithTextDecoration.cs | 1 - OpenRA.Mods.Common/Traits/Tooltip.cs | 5 -- .../Traits/TooltipDescription.cs | 1 - .../Traits/World/CrateSpawner.cs | 2 - .../Traits/World/MPStartLocations.cs | 2 - .../Traits/World/MapBuildRadius.cs | 4 - OpenRA.Mods.Common/Traits/World/MapCreeps.cs | 2 - OpenRA.Mods.Common/Traits/World/MapOptions.cs | 6 -- .../Traits/World/ScriptLobbyDropdown.cs | 2 - .../Traits/World/SpawnMPUnits.cs | 2 - .../ExtractLanguageStringsCommand.cs | 79 ------------------- OpenRA.Mods.Common/Widgets/ButtonWidget.cs | 3 - OpenRA.Mods.Common/Widgets/ImageWidget.cs | 1 - OpenRA.Mods.Common/Widgets/LabelWidget.cs | 1 - .../Widgets/Logic/SettingsLogic.cs | 23 ------ .../Widgets/ProductionPaletteWidget.cs | 3 - .../Widgets/SupportPowersWidget.cs | 2 - mods/cnc/languages/english.yaml | 3 - mods/cnc/mod.yaml | 3 - mods/d2k/languages/english.yaml | 2 - mods/d2k/mod.yaml | 3 - mods/ra/languages/english.yaml | 2 - mods/ts/languages/english.yaml | 2 - mods/ts/mod.yaml | 3 - 39 files changed, 1 insertion(+), 254 deletions(-) delete mode 100644 OpenRA.Mods.Common/UtilityCommands/ExtractLanguageStringsCommand.cs delete mode 100644 mods/cnc/languages/english.yaml delete mode 100644 mods/d2k/languages/english.yaml delete mode 100644 mods/ra/languages/english.yaml delete mode 100644 mods/ts/languages/english.yaml diff --git a/OpenRA.Game/FieldLoader.cs b/OpenRA.Game/FieldLoader.cs index a1d18603bc..03dd94f647 100644 --- a/OpenRA.Game/FieldLoader.cs +++ b/OpenRA.Game/FieldLoader.cs @@ -66,17 +66,11 @@ namespace OpenRA static readonly ConcurrentCache TypeLoadInfo = new ConcurrentCache(BuildTypeLoadInfo); - static readonly ConcurrentCache MemberHasTranslateAttribute = - new ConcurrentCache(member => member.HasAttribute()); - static readonly ConcurrentCache BooleanExpressionCache = new ConcurrentCache(expression => new BooleanExpression(expression)); static readonly ConcurrentCache IntegerExpressionCache = new ConcurrentCache(expression => new IntegerExpression(expression)); - static readonly object TranslationsLock = new object(); - static Dictionary translations; - public static void Load(object self, MiniYaml my) { var loadInfo = TypeLoadInfo[self.GetType()]; @@ -213,11 +207,7 @@ namespace OpenRA return InvalidValueAction(value, fieldType, fieldName); } else if (fieldType == typeof(string)) - { - if (field != null && MemberHasTranslateAttribute[field] && value != null) - return Regex.Replace(value, "@[^@]+@", m => Translate(m.Value.Substring(1, m.Value.Length - 2)), RegexOptions.Compiled); return value; - } else if (fieldType == typeof(Color)) { if (value != null && Color.TryParse(value, out var color)) @@ -694,34 +684,8 @@ namespace OpenRA return null; } } - - public static string Translate(string key) - { - if (string.IsNullOrEmpty(key)) - return key; - - lock (TranslationsLock) - { - if (translations == null) - return key; - - if (!translations.TryGetValue(key, out var value)) - return key; - - return value; - } - } - - public static void SetTranslations(IDictionary translations) - { - lock (TranslationsLock) - FieldLoader.translations = new Dictionary(translations); - } } - [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)] - public sealed class TranslateAttribute : Attribute { } - [AttributeUsage(AttributeTargets.Field)] public sealed class FieldFromYamlKeyAttribute : FieldLoader.SerializeAttribute { diff --git a/OpenRA.Game/GameSpeed.cs b/OpenRA.Game/GameSpeed.cs index 511d0c6ec0..2316a4120b 100644 --- a/OpenRA.Game/GameSpeed.cs +++ b/OpenRA.Game/GameSpeed.cs @@ -15,7 +15,6 @@ namespace OpenRA { public class GameSpeed { - [Translate] public readonly string Name = "Default"; public readonly int Timestep = 40; public readonly int OrderLatency = 3; diff --git a/OpenRA.Game/Manifest.cs b/OpenRA.Game/Manifest.cs index 1cc18d57d4..e70538763d 100644 --- a/OpenRA.Game/Manifest.cs +++ b/OpenRA.Game/Manifest.cs @@ -60,7 +60,7 @@ namespace OpenRA public readonly string[] Rules, ServerTraits, Sequences, ModelSequences, Cursors, Chrome, Assemblies, ChromeLayout, - Weapons, Voices, Notifications, Music, Translations, TileSets, + Weapons, Voices, Notifications, Music, TileSets, ChromeMetrics, MapCompatibility, Missions, Hotkeys; public readonly IReadOnlyDictionary Packages; @@ -128,7 +128,6 @@ namespace OpenRA Voices = YamlList(yaml, "Voices"); Notifications = YamlList(yaml, "Notifications"); Music = YamlList(yaml, "Music"); - Translations = YamlList(yaml, "Translations"); TileSets = YamlList(yaml, "TileSets"); ChromeMetrics = YamlList(yaml, "ChromeMetrics"); Missions = YamlList(yaml, "Missions"); diff --git a/OpenRA.Game/Map/Map.cs b/OpenRA.Game/Map/Map.cs index 6873995e6e..76b0f1fbd5 100644 --- a/OpenRA.Game/Map/Map.cs +++ b/OpenRA.Game/Map/Map.cs @@ -173,7 +173,6 @@ namespace OpenRA new MapField("Voices", "VoiceDefinitions", required: false), new MapField("Music", "MusicDefinitions", required: false), new MapField("Notifications", "NotificationDefinitions", required: false), - new MapField("Translations", "TranslationDefinitions", required: false) }; // Format versions @@ -204,7 +203,6 @@ namespace OpenRA public readonly MiniYaml VoiceDefinitions; public readonly MiniYaml MusicDefinitions; public readonly MiniYaml NotificationDefinitions; - public readonly MiniYaml TranslationDefinitions; public readonly Dictionary ReplacedInvalidTerrainTiles = new Dictionary(); diff --git a/OpenRA.Game/ModData.cs b/OpenRA.Game/ModData.cs index 4b2149e73b..bd9c1eb501 100644 --- a/OpenRA.Game/ModData.cs +++ b/OpenRA.Game/ModData.cs @@ -138,42 +138,6 @@ namespace OpenRA public IEnumerable Languages { get; private set; } - void LoadTranslations(Map map) - { - var selectedTranslations = new Dictionary(); - var defaultTranslations = new Dictionary(); - - if (!Manifest.Translations.Any()) - { - Languages = new string[0]; - return; - } - - var yaml = MiniYaml.Load(map, Manifest.Translations, map.TranslationDefinitions); - Languages = yaml.Select(t => t.Key).ToArray(); - - foreach (var y in yaml) - { - if (y.Key == Game.Settings.Graphics.Language) - selectedTranslations = y.Value.ToDictionary(my => my.Value ?? ""); - else if (y.Key == Game.Settings.Graphics.DefaultLanguage) - defaultTranslations = y.Value.ToDictionary(my => my.Value ?? ""); - } - - var translations = new Dictionary(); - foreach (var tkv in defaultTranslations.Concat(selectedTranslations)) - { - if (translations.ContainsKey(tkv.Key)) - continue; - if (selectedTranslations.ContainsKey(tkv.Key)) - translations.Add(tkv.Key, selectedTranslations[tkv.Key]); - else - translations.Add(tkv.Key, tkv.Value); - } - - FieldLoader.SetTranslations(translations); - } - public Map PrepareMap(string uid) { LoadScreen?.Display(); @@ -185,8 +149,6 @@ namespace OpenRA using (new Support.PerfTimer("Map")) map = new Map(this, MapCache[uid].Package); - LoadTranslations(map); - // Reinitialize all our assets InitializeLoaders(map); diff --git a/OpenRA.Game/Settings.cs b/OpenRA.Game/Settings.cs index 72310200dc..f5bcf5fa36 100644 --- a/OpenRA.Game/Settings.cs +++ b/OpenRA.Game/Settings.cs @@ -190,9 +190,6 @@ namespace OpenRA public int BatchSize = 8192; public int SheetSize = 2048; - - public string Language = "english"; - public string DefaultLanguage = "english"; } public class SoundSettings diff --git a/OpenRA.Game/Traits/Player/Shroud.cs b/OpenRA.Game/Traits/Player/Shroud.cs index 229e06330d..c64b59d14c 100644 --- a/OpenRA.Game/Traits/Player/Shroud.cs +++ b/OpenRA.Game/Traits/Player/Shroud.cs @@ -17,11 +17,9 @@ namespace OpenRA.Traits [Desc("Required for shroud and fog visibility checks. Add this to the player actor.")] public class ShroudInfo : TraitInfo, ILobbyOptions { - [Translate] [Desc("Descriptive label for the fog checkbox in the lobby.")] public readonly string FogCheckboxLabel = "Fog of War"; - [Translate] [Desc("Tooltip description for the fog checkbox in the lobby.")] public readonly string FogCheckboxDescription = "Line of sight is required to view enemy forces"; @@ -37,11 +35,9 @@ namespace OpenRA.Traits [Desc("Display order for the fog checkbox in the lobby.")] public readonly int FogCheckboxDisplayOrder = 0; - [Translate] [Desc("Descriptive label for the explored map checkbox in the lobby.")] public readonly string ExploredMapCheckboxLabel = "Explored Map"; - [Translate] [Desc("Tooltip description for the explored map checkbox in the lobby.")] public readonly string ExploredMapCheckboxDescription = "Initial map shroud is revealed"; diff --git a/OpenRA.Game/Traits/World/Faction.cs b/OpenRA.Game/Traits/World/Faction.cs index a46b3aac6f..930dc1546b 100644 --- a/OpenRA.Game/Traits/World/Faction.cs +++ b/OpenRA.Game/Traits/World/Faction.cs @@ -28,7 +28,6 @@ namespace OpenRA.Traits [Desc("The side that the faction belongs to. For example, England belongs to the 'Allies' side.")] public readonly string Side = null; - [Translate] public readonly string Description = null; public readonly bool Selectable = true; diff --git a/OpenRA.Mods.Cnc/Traits/SupportPowers/GrantPrerequisiteChargeDrainPower.cs b/OpenRA.Mods.Cnc/Traits/SupportPowers/GrantPrerequisiteChargeDrainPower.cs index de519a0bfc..beea440fce 100644 --- a/OpenRA.Mods.Cnc/Traits/SupportPowers/GrantPrerequisiteChargeDrainPower.cs +++ b/OpenRA.Mods.Cnc/Traits/SupportPowers/GrantPrerequisiteChargeDrainPower.cs @@ -26,11 +26,9 @@ namespace OpenRA.Mods.Cnc.Traits [Desc("The prerequisite type that this provides.")] public readonly string Prerequisite = null; - [Translate] [Desc("Label to display over the support power icon and in its tooltip while the power is active.")] public readonly string ActiveText = "ACTIVE"; - [Translate] [Desc("Label to display over the support power icon and in its tooltip while the power is available but not active.")] public readonly string AvailableText = "READY"; diff --git a/OpenRA.Mods.Common/Traits/Buildable.cs b/OpenRA.Mods.Common/Traits/Buildable.cs index 672a37a3b1..95c3aed78c 100644 --- a/OpenRA.Mods.Common/Traits/Buildable.cs +++ b/OpenRA.Mods.Common/Traits/Buildable.cs @@ -54,7 +54,6 @@ namespace OpenRA.Mods.Common.Traits [Desc("Sort order for the production palette. Smaller numbers are presented earlier.")] public readonly int BuildPaletteOrder = 9999; - [Translate] [Desc("Text shown in the production tooltip.")] public readonly string Description = ""; diff --git a/OpenRA.Mods.Common/Traits/Player/ConquestVictoryConditions.cs b/OpenRA.Mods.Common/Traits/Player/ConquestVictoryConditions.cs index 9f98b4e988..6e8492f45c 100644 --- a/OpenRA.Mods.Common/Traits/Player/ConquestVictoryConditions.cs +++ b/OpenRA.Mods.Common/Traits/Player/ConquestVictoryConditions.cs @@ -21,7 +21,6 @@ namespace OpenRA.Mods.Common.Traits [Desc("Delay for the end game notification in milliseconds.")] public readonly int NotificationDelay = 1500; - [Translate] [Desc("Description of the objective.")] public readonly string Objective = "Destroy all opposition!"; diff --git a/OpenRA.Mods.Common/Traits/Player/DeveloperMode.cs b/OpenRA.Mods.Common/Traits/Player/DeveloperMode.cs index 7e6653b71c..4548eb6e4f 100644 --- a/OpenRA.Mods.Common/Traits/Player/DeveloperMode.cs +++ b/OpenRA.Mods.Common/Traits/Player/DeveloperMode.cs @@ -19,11 +19,9 @@ namespace OpenRA.Mods.Common.Traits [Desc("Attach this to the player actor.")] public class DeveloperModeInfo : TraitInfo, ILobbyOptions { - [Translate] [Desc("Descriptive label for the developer mode checkbox in the lobby.")] public readonly string CheckboxLabel = "Debug Menu"; - [Translate] [Desc("Tooltip description for the developer mode checkbox in the lobby.")] public readonly string CheckboxDescription = "Enables cheats and developer commands"; diff --git a/OpenRA.Mods.Common/Traits/Player/PlayerResources.cs b/OpenRA.Mods.Common/Traits/Player/PlayerResources.cs index 515aaa92be..a0cbd349c0 100644 --- a/OpenRA.Mods.Common/Traits/Player/PlayerResources.cs +++ b/OpenRA.Mods.Common/Traits/Player/PlayerResources.cs @@ -18,11 +18,9 @@ namespace OpenRA.Mods.Common.Traits { public class PlayerResourcesInfo : TraitInfo, ILobbyOptions { - [Translate] [Desc("Descriptive label for the starting cash option in the lobby.")] public readonly string DefaultCashDropdownLabel = "Starting Cash"; - [Translate] [Desc("Tooltip description for the starting cash option in the lobby.")] public readonly string DefaultCashDropdownDescription = "Change the amount of cash that players start with"; diff --git a/OpenRA.Mods.Common/Traits/Player/ProvidesTechPrerequisite.cs b/OpenRA.Mods.Common/Traits/Player/ProvidesTechPrerequisite.cs index 2963d7ea0f..0be4aa671b 100644 --- a/OpenRA.Mods.Common/Traits/Player/ProvidesTechPrerequisite.cs +++ b/OpenRA.Mods.Common/Traits/Player/ProvidesTechPrerequisite.cs @@ -19,7 +19,6 @@ namespace OpenRA.Mods.Common.Traits [Desc("Internal id for this tech level.")] public readonly string Id; - [Translate] [Desc("Name shown in the lobby options.")] public readonly string Name; diff --git a/OpenRA.Mods.Common/Traits/Player/StrategicVictoryConditions.cs b/OpenRA.Mods.Common/Traits/Player/StrategicVictoryConditions.cs index eb57eb1f0c..d3d7efc867 100644 --- a/OpenRA.Mods.Common/Traits/Player/StrategicVictoryConditions.cs +++ b/OpenRA.Mods.Common/Traits/Player/StrategicVictoryConditions.cs @@ -36,7 +36,6 @@ namespace OpenRA.Mods.Common.Traits [Desc("Delay for the end game notification in milliseconds.")] public readonly int NotificationDelay = 1500; - [Translate] [Desc("Description of the objective")] public readonly string Objective = "Hold all the strategic positions!"; diff --git a/OpenRA.Mods.Common/Traits/Render/WithTextDecoration.cs b/OpenRA.Mods.Common/Traits/Render/WithTextDecoration.cs index 10bccd8f9e..0058ac6cd6 100644 --- a/OpenRA.Mods.Common/Traits/Render/WithTextDecoration.cs +++ b/OpenRA.Mods.Common/Traits/Render/WithTextDecoration.cs @@ -21,7 +21,6 @@ namespace OpenRA.Mods.Common.Traits.Render [Desc("Displays a text overlay relative to the selection box.")] public class WithTextDecorationInfo : WithDecorationBaseInfo { - [Translate] [FieldLoader.Require] public readonly string Text = null; diff --git a/OpenRA.Mods.Common/Traits/Tooltip.cs b/OpenRA.Mods.Common/Traits/Tooltip.cs index fc470980ca..ee09e88488 100644 --- a/OpenRA.Mods.Common/Traits/Tooltip.cs +++ b/OpenRA.Mods.Common/Traits/Tooltip.cs @@ -15,7 +15,6 @@ namespace OpenRA.Mods.Common.Traits { public abstract class TooltipInfoBase : ConditionalTraitInfo, Requires { - [Translate] public readonly string Name = ""; } @@ -28,7 +27,6 @@ namespace OpenRA.Mods.Common.Traits [Desc("Shown in the build palette widget.")] public class TooltipInfo : TooltipInfoBase, ITooltipInfo { - [Translate] [Desc("An optional generic name (i.e. \"Soldier\" or \"Structure\")" + "to be shown to chosen players.")] public readonly string GenericName = null; @@ -36,15 +34,12 @@ namespace OpenRA.Mods.Common.Traits [Desc("Prefix generic tooltip name with 'Ally/Neutral/EnemyPrefix'.")] public readonly bool GenericStancePrefix = true; - [Translate] [Desc("Prefix to display in the tooltip for allied units.")] public readonly string AllyPrefix = "Allied"; - [Translate] [Desc("Prefix to display in the tooltip for neutral units.")] public readonly string NeutralPrefix = null; - [Translate] [Desc("Prefix to display in the tooltip for enemy units.")] public readonly string EnemyPrefix = "Enemy"; diff --git a/OpenRA.Mods.Common/Traits/TooltipDescription.cs b/OpenRA.Mods.Common/Traits/TooltipDescription.cs index 670c8e6f93..d552c45f02 100644 --- a/OpenRA.Mods.Common/Traits/TooltipDescription.cs +++ b/OpenRA.Mods.Common/Traits/TooltipDescription.cs @@ -17,7 +17,6 @@ namespace OpenRA.Mods.Common.Traits public class TooltipDescriptionInfo : ConditionalTraitInfo { [Desc("Text shown in tooltip.")] - [Translate] public readonly string Description = ""; [Desc("Player relationships who can view the description.")] diff --git a/OpenRA.Mods.Common/Traits/World/CrateSpawner.cs b/OpenRA.Mods.Common/Traits/World/CrateSpawner.cs index 9376a6b3eb..2c754afe38 100644 --- a/OpenRA.Mods.Common/Traits/World/CrateSpawner.cs +++ b/OpenRA.Mods.Common/Traits/World/CrateSpawner.cs @@ -20,11 +20,9 @@ namespace OpenRA.Mods.Common.Traits { public class CrateSpawnerInfo : TraitInfo, ILobbyOptions { - [Translate] [Desc("Descriptive label for the crates checkbox in the lobby.")] public readonly string CheckboxLabel = "Crates"; - [Translate] [Desc("Tooltip description for the crates checkbox in the lobby.")] public readonly string CheckboxDescription = "Collect crates with units to receive random bonuses or penalties"; diff --git a/OpenRA.Mods.Common/Traits/World/MPStartLocations.cs b/OpenRA.Mods.Common/Traits/World/MPStartLocations.cs index 0308605b65..ff1450d166 100644 --- a/OpenRA.Mods.Common/Traits/World/MPStartLocations.cs +++ b/OpenRA.Mods.Common/Traits/World/MPStartLocations.cs @@ -24,11 +24,9 @@ namespace OpenRA.Mods.Common.Traits { public readonly WDist InitialExploreRange = WDist.FromCells(5); - [Translate] [Desc("Descriptive label for the spawn positions checkbox in the lobby.")] public readonly string SeparateTeamSpawnsCheckboxLabel = "Separate Team Spawns"; - [Translate] [Desc("Tooltip description for the spawn positions checkbox in the lobby.")] public readonly string SeparateTeamSpawnsCheckboxDescription = "Players without assigned spawn points will start as far as possible from enemy players"; diff --git a/OpenRA.Mods.Common/Traits/World/MapBuildRadius.cs b/OpenRA.Mods.Common/Traits/World/MapBuildRadius.cs index 60abe12c9b..0352a842e8 100644 --- a/OpenRA.Mods.Common/Traits/World/MapBuildRadius.cs +++ b/OpenRA.Mods.Common/Traits/World/MapBuildRadius.cs @@ -17,11 +17,9 @@ namespace OpenRA.Mods.Common.Traits [Desc("Controls the build radius checkboxes in the lobby options.")] public class MapBuildRadiusInfo : TraitInfo, ILobbyOptions { - [Translate] [Desc("Descriptive label for the ally build radius checkbox in the lobby.")] public readonly string AllyBuildRadiusCheckboxLabel = "Build off Allies"; - [Translate] [Desc("Tooltip description for the ally build radius checkbox in the lobby.")] public readonly string AllyBuildRadiusCheckboxDescription = "Allow allies to place structures inside your build area"; @@ -37,11 +35,9 @@ namespace OpenRA.Mods.Common.Traits [Desc("Display order for the ally build radius checkbox in the lobby.")] public readonly int AllyBuildRadiusCheckboxDisplayOrder = 0; - [Translate] [Desc("Tooltip description for the build radius checkbox in the lobby.")] public readonly string BuildRadiusCheckboxLabel = "Limit Build Area"; - [Translate] [Desc("Tooltip description for the build radius checkbox in the lobby.")] public readonly string BuildRadiusCheckboxDescription = "Limits structure placement to areas around Construction Yards"; diff --git a/OpenRA.Mods.Common/Traits/World/MapCreeps.cs b/OpenRA.Mods.Common/Traits/World/MapCreeps.cs index f9a460e744..792339c44c 100644 --- a/OpenRA.Mods.Common/Traits/World/MapCreeps.cs +++ b/OpenRA.Mods.Common/Traits/World/MapCreeps.cs @@ -17,11 +17,9 @@ namespace OpenRA.Mods.Common.Traits [Desc("Controls the 'Creeps' checkbox in the lobby options.")] public class MapCreepsInfo : TraitInfo, ILobbyOptions { - [Translate] [Desc("Descriptive label for the creeps checkbox in the lobby.")] public readonly string CheckboxLabel = "Creep Actors"; - [Translate] [Desc("Tooltip description for the creeps checkbox in the lobby.")] public readonly string CheckboxDescription = "Hostile forces spawn on the battlefield"; diff --git a/OpenRA.Mods.Common/Traits/World/MapOptions.cs b/OpenRA.Mods.Common/Traits/World/MapOptions.cs index 216a0a1d8a..f30a28c7f5 100644 --- a/OpenRA.Mods.Common/Traits/World/MapOptions.cs +++ b/OpenRA.Mods.Common/Traits/World/MapOptions.cs @@ -18,11 +18,9 @@ namespace OpenRA.Mods.Common.Traits [Desc("Controls the game speed, tech level, and short game lobby options.")] public class MapOptionsInfo : TraitInfo, ILobbyOptions, IRulesetLoaded { - [Translate] [Desc("Descriptive label for the short game checkbox in the lobby.")] public readonly string ShortGameCheckboxLabel = "Short Game"; - [Translate] [Desc("Tooltip description for the short game checkbox in the lobby.")] public readonly string ShortGameCheckboxDescription = "Players are defeated when their bases are destroyed"; @@ -38,11 +36,9 @@ namespace OpenRA.Mods.Common.Traits [Desc("Display order for the short game checkbox in the lobby.")] public readonly int ShortGameCheckboxDisplayOrder = 0; - [Translate] [Desc("Descriptive label for the tech level option in the lobby.")] public readonly string TechLevelDropdownLabel = "Tech Level"; - [Translate] [Desc("Tooltip description for the tech level option in the lobby.")] public readonly string TechLevelDropdownDescription = "Change the units and abilities at your disposal"; @@ -58,11 +54,9 @@ namespace OpenRA.Mods.Common.Traits [Desc("Display order for the tech level option in the lobby.")] public readonly int TechLevelDropdownDisplayOrder = 0; - [Translate] [Desc("Tooltip description for the game speed option in the lobby.")] public readonly string GameSpeedDropdownLabel = "Game Speed"; - [Translate] [Desc("Description of the game speed option in the lobby.")] public readonly string GameSpeedDropdownDescription = "Change the rate at which time passes"; diff --git a/OpenRA.Mods.Common/Traits/World/ScriptLobbyDropdown.cs b/OpenRA.Mods.Common/Traits/World/ScriptLobbyDropdown.cs index 7ac23bf178..6f353f40a1 100644 --- a/OpenRA.Mods.Common/Traits/World/ScriptLobbyDropdown.cs +++ b/OpenRA.Mods.Common/Traits/World/ScriptLobbyDropdown.cs @@ -21,12 +21,10 @@ namespace OpenRA.Mods.Common.Traits [Desc("Internal id for this option.")] public readonly string ID = null; - [Translate] [FieldLoader.Require] [Desc("Descriptive label for this option.")] public readonly string Label = null; - [Translate] [Desc("Tooltip description for this option.")] public readonly string Description = null; diff --git a/OpenRA.Mods.Common/Traits/World/SpawnMPUnits.cs b/OpenRA.Mods.Common/Traits/World/SpawnMPUnits.cs index 1a984f2e4f..b17637282b 100644 --- a/OpenRA.Mods.Common/Traits/World/SpawnMPUnits.cs +++ b/OpenRA.Mods.Common/Traits/World/SpawnMPUnits.cs @@ -23,11 +23,9 @@ namespace OpenRA.Mods.Common.Traits { public readonly string StartingUnitsClass = "none"; - [Translate] [Desc("Descriptive label for the starting units option in the lobby.")] public readonly string DropdownLabel = "Starting Units"; - [Translate] [Desc("Tooltip description for the starting units option in the lobby.")] public readonly string DropdownDescription = "Change the units that you start the game with"; diff --git a/OpenRA.Mods.Common/UtilityCommands/ExtractLanguageStringsCommand.cs b/OpenRA.Mods.Common/UtilityCommands/ExtractLanguageStringsCommand.cs deleted file mode 100644 index 2dd8d140a0..0000000000 --- a/OpenRA.Mods.Common/UtilityCommands/ExtractLanguageStringsCommand.cs +++ /dev/null @@ -1,79 +0,0 @@ -#region Copyright & License Information -/* - * Copyright 2007-2020 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made - * available to you under the terms of the GNU General Public License - * as published by the Free Software Foundation, either version 3 of - * the License, or (at your option) any later version. For more - * information, see COPYING. - */ -#endregion - -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; - -namespace OpenRA.Mods.Common.UtilityCommands -{ - class ExtractLanguageStringsCommand : IUtilityCommand - { - string IUtilityCommand.Name { get { return "--extract-language-strings"; } } - - bool IUtilityCommand.ValidateArguments(string[] args) - { - return true; - } - - [Desc("Extract translatable strings that are not yet localized and update chrome layout.")] - void IUtilityCommand.Run(Utility utility, string[] args) - { - // HACK: The engine code assumes that Game.modData is set. - var modData = Game.ModData = utility.ModData; - - var types = modData.ObjectCreator.GetTypes(); - var translatableFields = types.SelectMany(t => t.GetFields()) - .Where(f => f.HasAttribute()).Distinct(); - - foreach (var filename in modData.Manifest.ChromeLayout) - { - modData.ModFiles.TryGetPackageContaining(filename, out var package, out var name); - name = package.Name + "/" + name; - Console.WriteLine("# {0}:", filename); - - var yaml = MiniYaml.FromFile(name, false); - FromChromeLayout(ref yaml, null, - translatableFields.Select(t => t.Name).Distinct(), null); - using (var file = new StreamWriter(name)) - file.WriteLine(yaml.WriteToString()); - } - - // TODO: Properties can also be translated. - } - - internal static void FromChromeLayout(ref List nodes, MiniYamlNode parent, IEnumerable translatables, string container) - { - var parentNode = parent != null && parent.Key != null ? parent.Key.Split('@') : null; - var parentType = parent != null && parent.Key != null ? parentNode.First() : null; - var parentLabel = parent != null && parent.Key != null ? parentNode.Last() : null; - - if ((parentType == "Background" || parentType == "Container") && parentLabel.IsUppercase()) - container = parentLabel; - - foreach (var node in nodes) - { - var alreadyTranslated = node.Value.Value != null && node.Value.Value.Contains('@'); - if (translatables.Contains(node.Key) && !alreadyTranslated && parentLabel != null) - { - var translationKey = "{0}-{1}".F(parentLabel.Replace('_', '-'), node.Key.ToUpper()); - if (container != null) - translationKey = "{0}-".F(container.Replace('_', '-')) + translationKey; - Console.WriteLine("\t{0}: {1}", translationKey, node.Value.Value); - node.Value.Value = "@{0}@".F(translationKey); - } - - FromChromeLayout(ref node.Value.Nodes, node, translatables, container); - } - } - } -} diff --git a/OpenRA.Mods.Common/Widgets/ButtonWidget.cs b/OpenRA.Mods.Common/Widgets/ButtonWidget.cs index bc19a7ded7..24686e37ce 100644 --- a/OpenRA.Mods.Common/Widgets/ButtonWidget.cs +++ b/OpenRA.Mods.Common/Widgets/ButtonWidget.cs @@ -26,7 +26,6 @@ namespace OpenRA.Mods.Common.Widgets public bool DisableKeyRepeat = false; public bool DisableKeySound = false; - [Translate] public string Text = ""; public TextAlign Align = TextAlign.Center; public int LeftMargin = 5; @@ -58,11 +57,9 @@ namespace OpenRA.Mods.Common.Widgets protected Lazy tooltipContainer; - [Translate] public string TooltipText; public Func GetTooltipText; - [Translate] public string TooltipDesc; public Func GetTooltipDesc; diff --git a/OpenRA.Mods.Common/Widgets/ImageWidget.cs b/OpenRA.Mods.Common/Widgets/ImageWidget.cs index 8d27f50731..0e47bf6170 100644 --- a/OpenRA.Mods.Common/Widgets/ImageWidget.cs +++ b/OpenRA.Mods.Common/Widgets/ImageWidget.cs @@ -26,7 +26,6 @@ namespace OpenRA.Mods.Common.Widgets public Func GetImageName; public Func GetImageCollection; - [Translate] public string TooltipText; Lazy tooltipContainer; diff --git a/OpenRA.Mods.Common/Widgets/LabelWidget.cs b/OpenRA.Mods.Common/Widgets/LabelWidget.cs index a174abfd70..4af8ff97f6 100644 --- a/OpenRA.Mods.Common/Widgets/LabelWidget.cs +++ b/OpenRA.Mods.Common/Widgets/LabelWidget.cs @@ -21,7 +21,6 @@ namespace OpenRA.Mods.Common.Widgets public class LabelWidget : Widget { - [Translate] public string Text = null; public TextAlign Align = TextAlign.Left; public TextVAlign VAlign = TextVAlign.Middle; diff --git a/OpenRA.Mods.Common/Widgets/Logic/SettingsLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/SettingsLogic.cs index 5ee9c28e34..1b63b0b75f 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/SettingsLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/SettingsLogic.cs @@ -247,13 +247,6 @@ namespace OpenRA.Mods.Common.Widgets.Logic BindIntSliderPref(panel, "FRAME_LIMIT_SLIDER", ds, "MaxFramerate"); BindCheckboxPref(panel, "PLAYER_STANCE_COLORS_CHECKBOX", gs, "UsePlayerStanceColors"); - var languageDropDownButton = panel.GetOrNull("LANGUAGE_DROPDOWNBUTTON"); - if (languageDropDownButton != null) - { - languageDropDownButton.OnMouseDown = _ => ShowLanguageDropdown(languageDropDownButton, modData.Languages); - languageDropDownButton.GetText = () => FieldLoader.Translate(ds.Language); - } - var windowModeDropdown = panel.Get("MODE_DROPDOWN"); windowModeDropdown.OnMouseDown = _ => ShowWindowModeDropdown(windowModeDropdown, ds); windowModeDropdown.GetText = () => ds.Mode == WindowMode.Windowed ? @@ -388,7 +381,6 @@ namespace OpenRA.Mods.Common.Widgets.Logic { ds.CapFramerate = dds.CapFramerate; ds.MaxFramerate = dds.MaxFramerate; - ds.Language = dds.Language; ds.GLProfile = dds.GLProfile; ds.Mode = dds.Mode; ds.VideoDisplay = dds.VideoDisplay; @@ -828,21 +820,6 @@ namespace OpenRA.Mods.Common.Widgets.Logic dropdown.ShowDropDown("LABEL_DROPDOWN_TEMPLATE", 500, options.Keys, setupItem); } - static void ShowLanguageDropdown(DropDownButtonWidget dropdown, IEnumerable languages) - { - Func setupItem = (o, itemTemplate) => - { - var item = ScrollItemWidget.Setup(itemTemplate, - () => Game.Settings.Graphics.Language == o, - () => Game.Settings.Graphics.Language = o); - - item.Get("LABEL").GetText = () => FieldLoader.Translate(o); - return item; - }; - - dropdown.ShowDropDown("LABEL_DROPDOWN_TEMPLATE", 500, languages, setupItem); - } - static void ShowStatusBarsDropdown(DropDownButtonWidget dropdown, GameSettings s) { var options = new Dictionary() diff --git a/OpenRA.Mods.Common/Widgets/ProductionPaletteWidget.cs b/OpenRA.Mods.Common/Widgets/ProductionPaletteWidget.cs index bdc9eb0a74..ebaa3c51ca 100644 --- a/OpenRA.Mods.Common/Widgets/ProductionPaletteWidget.cs +++ b/OpenRA.Mods.Common/Widgets/ProductionPaletteWidget.cs @@ -70,13 +70,10 @@ namespace OpenRA.Mods.Common.Widgets public readonly bool DrawTime = true; - [Translate] public readonly string ReadyText = ""; - [Translate] public readonly string HoldText = ""; - [Translate] public readonly string InfiniteSymbol = "\u221E"; public int DisplayedIconCount { get; private set; } diff --git a/OpenRA.Mods.Common/Widgets/SupportPowersWidget.cs b/OpenRA.Mods.Common/Widgets/SupportPowersWidget.cs index df7a1dc1a6..2c503df382 100644 --- a/OpenRA.Mods.Common/Widgets/SupportPowersWidget.cs +++ b/OpenRA.Mods.Common/Widgets/SupportPowersWidget.cs @@ -22,10 +22,8 @@ namespace OpenRA.Mods.Common.Widgets { public class SupportPowersWidget : Widget { - [Translate] public readonly string ReadyText = ""; - [Translate] public readonly string HoldText = ""; public readonly string OverlayFont = "TinyBold"; diff --git a/mods/cnc/languages/english.yaml b/mods/cnc/languages/english.yaml deleted file mode 100644 index 7d833ea974..0000000000 --- a/mods/cnc/languages/english.yaml +++ /dev/null @@ -1,3 +0,0 @@ -english: - english: English - diff --git a/mods/cnc/mod.yaml b/mods/cnc/mod.yaml index a8af78fb9a..df6b8d7a0b 100644 --- a/mods/cnc/mod.yaml +++ b/mods/cnc/mod.yaml @@ -140,9 +140,6 @@ Notifications: Music: cnc|audio/music.yaml -Translations: - cnc|languages/english.yaml - Hotkeys: common|hotkeys/game.yaml common|hotkeys/observer.yaml diff --git a/mods/d2k/languages/english.yaml b/mods/d2k/languages/english.yaml deleted file mode 100644 index 7dee16a0f1..0000000000 --- a/mods/d2k/languages/english.yaml +++ /dev/null @@ -1,2 +0,0 @@ -english: - english: English diff --git a/mods/d2k/mod.yaml b/mods/d2k/mod.yaml index 8cff5361d7..43a3accc00 100644 --- a/mods/d2k/mod.yaml +++ b/mods/d2k/mod.yaml @@ -127,9 +127,6 @@ Notifications: Music: d2k|audio/music.yaml -Translations: - d2k|languages/english.yaml - Hotkeys: common|hotkeys/game.yaml common|hotkeys/observer.yaml diff --git a/mods/ra/languages/english.yaml b/mods/ra/languages/english.yaml deleted file mode 100644 index 7dee16a0f1..0000000000 --- a/mods/ra/languages/english.yaml +++ /dev/null @@ -1,2 +0,0 @@ -english: - english: English diff --git a/mods/ts/languages/english.yaml b/mods/ts/languages/english.yaml deleted file mode 100644 index 7dee16a0f1..0000000000 --- a/mods/ts/languages/english.yaml +++ /dev/null @@ -1,2 +0,0 @@ -english: - english: English diff --git a/mods/ts/mod.yaml b/mods/ts/mod.yaml index 3fb73234d7..1119e7c6e2 100644 --- a/mods/ts/mod.yaml +++ b/mods/ts/mod.yaml @@ -185,9 +185,6 @@ Notifications: Music: ts|audio/music.yaml -Translations: - ts|languages/english.yaml - Hotkeys: common|hotkeys/game.yaml common|hotkeys/observer.yaml