Remove vestigial translation plumbing.

This was never completed to the level required to
be properly used ingame.
This commit is contained in:
Paul Chote
2020-12-24 17:51:09 +00:00
committed by Matthias Mailänder
parent fb20479379
commit 6e7ad9df25
39 changed files with 1 additions and 254 deletions

View File

@@ -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 = "";

View File

@@ -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!";

View File

@@ -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";

View File

@@ -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";

View File

@@ -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;

View File

@@ -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!";

View File

@@ -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;

View File

@@ -15,7 +15,6 @@ namespace OpenRA.Mods.Common.Traits
{
public abstract class TooltipInfoBase : ConditionalTraitInfo, Requires<IMouseBoundsInfo>
{
[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";

View File

@@ -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.")]

View File

@@ -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";

View File

@@ -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";

View File

@@ -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";

View File

@@ -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";

View File

@@ -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";

View File

@@ -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;

View File

@@ -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";

View File

@@ -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<TranslateAttribute>()).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<MiniYamlNode> nodes, MiniYamlNode parent, IEnumerable<string> 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);
}
}
}
}

View File

@@ -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<TooltipContainerWidget> tooltipContainer;
[Translate]
public string TooltipText;
public Func<string> GetTooltipText;
[Translate]
public string TooltipDesc;
public Func<string> GetTooltipDesc;

View File

@@ -26,7 +26,6 @@ namespace OpenRA.Mods.Common.Widgets
public Func<string> GetImageName;
public Func<string> GetImageCollection;
[Translate]
public string TooltipText;
Lazy<TooltipContainerWidget> tooltipContainer;

View File

@@ -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;

View File

@@ -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<DropDownButtonWidget>("LANGUAGE_DROPDOWNBUTTON");
if (languageDropDownButton != null)
{
languageDropDownButton.OnMouseDown = _ => ShowLanguageDropdown(languageDropDownButton, modData.Languages);
languageDropDownButton.GetText = () => FieldLoader.Translate(ds.Language);
}
var windowModeDropdown = panel.Get<DropDownButtonWidget>("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<string> languages)
{
Func<string, ScrollItemWidget, ScrollItemWidget> setupItem = (o, itemTemplate) =>
{
var item = ScrollItemWidget.Setup(itemTemplate,
() => Game.Settings.Graphics.Language == o,
() => Game.Settings.Graphics.Language = o);
item.Get<LabelWidget>("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<string, StatusBarsType>()

View File

@@ -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; }

View File

@@ -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";