Expose lobby options to localisation.

This commit is contained in:
Matthias Mailänder
2022-10-25 21:40:49 +02:00
committed by Gustas
parent aefa49a831
commit 8297fcff30
30 changed files with 287 additions and 96 deletions

View File

@@ -18,11 +18,13 @@ namespace OpenRA.Traits
[Desc("Required for shroud and fog visibility checks. Add this to the player actor.")]
public class ShroudInfo : TraitInfo, ILobbyOptions
{
[TranslationReference]
[Desc("Descriptive label for the fog checkbox in the lobby.")]
public readonly string FogCheckboxLabel = "Fog of War";
public readonly string FogCheckboxLabel = "fog-of-war.label";
[TranslationReference]
[Desc("Tooltip description for the fog checkbox in the lobby.")]
public readonly string FogCheckboxDescription = "Line of sight is required to view enemy forces";
public readonly string FogCheckboxDescription = "fog-of-war.description";
[Desc("Default value of the fog checkbox in the lobby.")]
public readonly bool FogCheckboxEnabled = true;
@@ -36,11 +38,13 @@ namespace OpenRA.Traits
[Desc("Display order for the fog checkbox in the lobby.")]
public readonly int FogCheckboxDisplayOrder = 0;
[TranslationReference]
[Desc("Descriptive label for the explored map checkbox in the lobby.")]
public readonly string ExploredMapCheckboxLabel = "Explored Map";
public readonly string ExploredMapCheckboxLabel = "explored-map.label";
[TranslationReference]
[Desc("Tooltip description for the explored map checkbox in the lobby.")]
public readonly string ExploredMapCheckboxDescription = "Initial map shroud is revealed";
public readonly string ExploredMapCheckboxDescription = "explored-map.description";
[Desc("Default value of the explore map checkbox in the lobby.")]
public readonly bool ExploredMapCheckboxEnabled = false;
@@ -56,9 +60,11 @@ namespace OpenRA.Traits
IEnumerable<LobbyOption> ILobbyOptions.LobbyOptions(MapPreview map)
{
yield return new LobbyBooleanOption("explored", ExploredMapCheckboxLabel, ExploredMapCheckboxDescription,
yield return new LobbyBooleanOption("explored", Game.ModData.Translation.GetString(ExploredMapCheckboxLabel),
Game.ModData.Translation.GetString(ExploredMapCheckboxDescription),
ExploredMapCheckboxVisible, ExploredMapCheckboxDisplayOrder, ExploredMapCheckboxEnabled, ExploredMapCheckboxLocked);
yield return new LobbyBooleanOption("fog", FogCheckboxLabel, FogCheckboxDescription,
yield return new LobbyBooleanOption("fog", Game.ModData.Translation.GetString(FogCheckboxLabel),
Game.ModData.Translation.GetString(FogCheckboxDescription),
FogCheckboxVisible, FogCheckboxDisplayOrder, FogCheckboxEnabled, FogCheckboxLocked);
}

View File

@@ -540,8 +540,8 @@ namespace OpenRA.Traits
IReadOnlyDictionary<string, string> values, string defaultValue, bool locked)
{
Id = id;
Name = name;
Description = description;
Name = Game.ModData.Translation.GetString(name);
Description = Game.ModData.Translation.GetString(description);
IsVisible = visible;
DisplayOrder = displayorder;
Values = values;