Rename Fluent-related code to be more precise.

This commit is contained in:
Paul Chote
2024-10-01 19:34:12 +01:00
committed by Gustas
parent 771b9ddfda
commit b29b685058
176 changed files with 1349 additions and 1369 deletions

View File

@@ -33,7 +33,7 @@ namespace OpenRA.Mods.Common.Traits
{
const string CommandName = "triggers";
[TranslationReference]
[FluentReference]
const string CommandDescription = "description-cell-triggers-overlay";
bool enabled;

View File

@@ -24,13 +24,13 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Configuration options for the lobby player color picker. Attach this to the world actor.")]
public class ColorPickerManagerInfo : TraitInfo<ColorPickerManager>, IColorPickerManagerInfo
{
[TranslationReference]
[FluentReference]
const string PlayerColorTerrain = "notification-player-color-terrain";
[TranslationReference]
[FluentReference]
const string PlayerColorPlayer = "notification-player-color-player";
[TranslationReference]
[FluentReference]
const string InvalidPlayerColor = "notification-invalid-player-color";
[Desc("Minimum and maximum saturation levels that are valid for use.")]

View File

@@ -21,11 +21,11 @@ namespace OpenRA.Mods.Common.Traits
[TraitLocation(SystemActors.World)]
public class CrateSpawnerInfo : TraitInfo, ILobbyOptions
{
[TranslationReference]
[FluentReference]
[Desc("Descriptive label for the crates checkbox in the lobby.")]
public readonly string CheckboxLabel = "checkbox-crates.label";
[TranslationReference]
[FluentReference]
[Desc("Tooltip description for the crates checkbox in the lobby.")]
public readonly string CheckboxDescription = "checkbox-crates.description";

View File

@@ -146,12 +146,12 @@ namespace OpenRA.Mods.Common.Traits
sealed class OpenMapAction : IEditorAction
{
[TranslationReference]
[FluentReference]
const string Opened = "notification-opened";
public OpenMapAction()
{
Text = TranslationProvider.GetString(Opened);
Text = FluentProvider.GetString(Opened);
}
public void Execute()

View File

@@ -27,7 +27,7 @@ namespace OpenRA.Mods.Common.Traits
public readonly ActorInfo Info;
public string Tooltip =>
(tooltip == null ? " < " + Info.Name + " >" : TranslationProvider.GetString(tooltip.Name)) + "\n" + Owner.Name + " (" + Owner.Faction + ")"
(tooltip == null ? " < " + Info.Name + " >" : FluentProvider.GetString(tooltip.Name)) + "\n" + Owner.Name + " (" + Owner.Faction + ")"
+ "\nID: " + ID + "\nType: " + Info.Name;
public string Type => reference.Type;

View File

@@ -28,7 +28,7 @@ namespace OpenRA.Mods.Common.Traits
{
const string CommandName = "exits-overlay";
[TranslationReference]
[FluentReference]
const string CommandDescription = "description-exits-overlay";
public readonly SpriteFont Font;

View File

@@ -37,7 +37,7 @@ namespace OpenRA.Mods.Common.Traits
{
const string CommandName = "hpf";
[TranslationReference]
[FluentReference]
const string CommandDescription = "description-hpf-debug-overlay";
readonly HierarchicalPathFinderOverlayInfo info;

View File

@@ -18,11 +18,11 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Controls the build radius checkboxes in the lobby options.")]
public class MapBuildRadiusInfo : TraitInfo, ILobbyOptions
{
[TranslationReference]
[FluentReference]
[Desc("Descriptive label for the ally build radius checkbox in the lobby.")]
public readonly string AllyBuildRadiusCheckboxLabel = "checkbox-ally-build-radius.label";
[TranslationReference]
[FluentReference]
[Desc("Tooltip description for the ally build radius checkbox in the lobby.")]
public readonly string AllyBuildRadiusCheckboxDescription = "checkbox-ally-build-radius.description";
@@ -38,11 +38,11 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Display order for the ally build radius checkbox in the lobby.")]
public readonly int AllyBuildRadiusCheckboxDisplayOrder = 0;
[TranslationReference]
[FluentReference]
[Desc("Tooltip description for the build radius checkbox in the lobby.")]
public readonly string BuildRadiusCheckboxLabel = "checkbox-build-radius.label";
[TranslationReference]
[FluentReference]
[Desc("Tooltip description for the build radius checkbox in the lobby.")]
public readonly string BuildRadiusCheckboxDescription = "checkbox-build-radius.description";

View File

@@ -18,11 +18,11 @@ namespace OpenRA.Mods.Common.Traits
[TraitLocation(SystemActors.World)]
public class MapCreepsInfo : TraitInfo, ILobbyOptions
{
[TranslationReference]
[FluentReference]
[Desc("Descriptive label for the creeps checkbox in the lobby.")]
public readonly string CheckboxLabel = "dropdown-map-creeps.label";
[TranslationReference]
[FluentReference]
[Desc("Tooltip description for the creeps checkbox in the lobby.")]
public readonly string CheckboxDescription = "dropdown-map-creeps.description";

View File

@@ -19,11 +19,11 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Controls the game speed, tech level, and short game lobby options.")]
public class MapOptionsInfo : TraitInfo, ILobbyOptions, IRulesetLoaded
{
[TranslationReference]
[FluentReference]
[Desc("Descriptive label for the short game checkbox in the lobby.")]
public readonly string ShortGameCheckboxLabel = "checkbox-short-game.label";
[TranslationReference]
[FluentReference]
[Desc("Tooltip description for the short game checkbox in the lobby.")]
public readonly string ShortGameCheckboxDescription = "checkbox-short-game.description";
@@ -39,11 +39,11 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Display order for the short game checkbox in the lobby.")]
public readonly int ShortGameCheckboxDisplayOrder = 0;
[TranslationReference]
[FluentReference]
[Desc("Descriptive label for the tech level option in the lobby.")]
public readonly string TechLevelDropdownLabel = "dropdown-tech-level.label";
[TranslationReference]
[FluentReference]
[Desc("Tooltip description for the tech level option in the lobby.")]
public readonly string TechLevelDropdownDescription = "dropdown-tech-level.description";
@@ -59,11 +59,11 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Display order for the tech level option in the lobby.")]
public readonly int TechLevelDropdownDisplayOrder = 0;
[TranslationReference]
[FluentReference]
[Desc("Tooltip description for the game speed option in the lobby.")]
public readonly string GameSpeedDropdownLabel = "dropdown-game-speed.label";
[TranslationReference]
[FluentReference]
[Desc("Description of the game speed option in the lobby.")]
public readonly string GameSpeedDropdownDescription = "dropdown-game-speed.description";
@@ -94,7 +94,7 @@ namespace OpenRA.Mods.Common.Traits
techLevels, TechLevel, TechLevelDropdownLocked);
var gameSpeeds = Game.ModData.Manifest.Get<GameSpeeds>();
var speeds = gameSpeeds.Speeds.ToDictionary(s => s.Key, s => TranslationProvider.GetString(s.Value.Name));
var speeds = gameSpeeds.Speeds.ToDictionary(s => s.Key, s => FluentProvider.GetString(s.Value.Name));
// NOTE: This is just exposing the UI, the backend logic for this option is hardcoded in World.
yield return new LobbyOption(map, "gamespeed",

View File

@@ -25,11 +25,11 @@ namespace OpenRA.Mods.Common.Traits
{
public readonly WDist InitialExploreRange = WDist.FromCells(5);
[TranslationReference]
[FluentReference]
[Desc("Descriptive label for the spawn positions checkbox in the lobby.")]
public readonly string SeparateTeamSpawnsCheckboxLabel = "checkbox-separate-team-spawns.label";
[TranslationReference]
[FluentReference]
[Desc("Tooltip description for the spawn positions checkbox in the lobby.")]
public readonly string SeparateTeamSpawnsCheckboxDescription = "checkbox-separate-team-spawns.description";

View File

@@ -22,7 +22,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Internal class ID.")]
public readonly string Class = "none";
[TranslationReference]
[FluentReference]
[Desc("Exposed via the UI to the player.")]
public readonly string ClassName = "Unlabeled";

View File

@@ -41,7 +41,7 @@ namespace OpenRA.Mods.Common.Traits
{
const string CommandName = "path-debug";
[TranslationReference]
[FluentReference]
const string CommandDescription = "description-path-debug-overlay";
sealed class Record : PathSearch.IRecorder, IEnumerable<(CPos Source, CPos Destination, int CostSoFar, int EstimatedRemainingCost)>

View File

@@ -39,7 +39,7 @@ namespace OpenRA.Mods.Common.Traits
[FieldLoader.Require]
[Desc("Resource name used by tooltips.")]
[TranslationReference]
[FluentReference]
public readonly string Name = null;
public ResourceTypeInfo(MiniYaml yaml)
@@ -273,7 +273,7 @@ namespace OpenRA.Mods.Common.Traits
if (info == null)
return null;
return TranslationProvider.GetString(info.Name);
return FluentProvider.GetString(info.Name);
}
IEnumerable<string> IResourceRenderer.ResourceTypes => Info.ResourceTypes.Keys;

View File

@@ -23,11 +23,11 @@ namespace OpenRA.Mods.Common.Traits
public readonly string ID = null;
[FieldLoader.Require]
[TranslationReference]
[FluentReference]
[Desc("Descriptive label for this option.")]
public readonly string Label = null;
[TranslationReference]
[FluentReference]
[Desc("Tooltip description for this option.")]
public readonly string Description = null;
@@ -36,7 +36,7 @@ namespace OpenRA.Mods.Common.Traits
public readonly string Default = null;
[FieldLoader.Require]
[TranslationReference(dictionaryReference: LintDictionaryReference.Values)]
[FluentReference(dictionaryReference: LintDictionaryReference.Values)]
[Desc("Options to choose from.")]
public readonly Dictionary<string, string> Values = null;

View File

@@ -25,11 +25,11 @@ namespace OpenRA.Mods.Common.Traits
{
public readonly string StartingUnitsClass = "none";
[TranslationReference]
[FluentReference]
[Desc("Descriptive label for the starting units option in the lobby.")]
public readonly string DropdownLabel = "dropdown-starting-units.label";
[TranslationReference]
[FluentReference]
[Desc("Tooltip description for the starting units option in the lobby.")]
public readonly string DropdownDescription = "dropdown-starting-units.description";

View File

@@ -20,19 +20,19 @@ namespace OpenRA.Mods.Common.Traits
[NotificationReference("Speech")]
public readonly string Notification = "StartGame";
[TranslationReference(optional: true)]
[FluentReference(optional: true)]
public readonly string TextNotification = null;
[NotificationReference("Speech")]
public readonly string LoadedNotification = "GameLoaded";
[TranslationReference(optional: true)]
[FluentReference(optional: true)]
public readonly string LoadedTextNotification = null;
[NotificationReference("Speech")]
public readonly string SavedNotification = "GameSaved";
[TranslationReference(optional: true)]
[FluentReference(optional: true)]
public readonly string SavedTextNotification = null;
public override object Create(ActorInitializer init) { return new StartGameNotification(this); }

View File

@@ -26,7 +26,7 @@ namespace OpenRA.Mods.Common.Traits
{
const string CommandName = "terrain-geometry";
[TranslationReference]
[FluentReference]
const string CommandDescription = "description-terrain-geometry-overlay";
public bool Enabled;

View File

@@ -22,11 +22,11 @@ namespace OpenRA.Mods.Common.Traits
[Desc("This trait allows setting a time limit on matches. Attach this to the World actor.")]
public class TimeLimitManagerInfo : TraitInfo, ILobbyOptions, IRulesetLoaded
{
[TranslationReference]
[FluentReference]
[Desc("Label that will be shown for the time limit option in the lobby.")]
public readonly string TimeLimitLabel = "dropdown-time-limit.label";
[TranslationReference]
[FluentReference]
[Desc("Tooltip description that will be shown for the time limit option in the lobby.")]
public readonly string TimeLimitDescription = "dropdown-time-limit.description";
@@ -77,10 +77,10 @@ namespace OpenRA.Mods.Common.Traits
throw new YamlException("TimeLimitDefault must be a value from TimeLimitOptions");
}
[TranslationReference]
[FluentReference]
const string NoTimeLimit = "options-time-limit.no-limit";
[TranslationReference("minutes")]
[FluentReference("minutes")]
const string TimeLimitOption = "options-time-limit.options";
IEnumerable<LobbyOption> ILobbyOptions.LobbyOptions(MapPreview map)
@@ -88,9 +88,9 @@ namespace OpenRA.Mods.Common.Traits
var timelimits = TimeLimitOptions.ToDictionary(m => m.ToStringInvariant(), m =>
{
if (m == 0)
return TranslationProvider.GetString(NoTimeLimit);
return FluentProvider.GetString(NoTimeLimit);
else
return TranslationProvider.GetString(TimeLimitOption, Translation.Arguments("minutes", m));
return FluentProvider.GetString(TimeLimitOption, FluentBundle.Arguments("minutes", m));
});
yield return new LobbyOption(map, "timelimit", TimeLimitLabel, TimeLimitDescription, TimeLimitDropdownVisible, TimeLimitDisplayOrder,
@@ -102,7 +102,7 @@ namespace OpenRA.Mods.Common.Traits
public class TimeLimitManager : INotifyTimeLimit, ITick, IWorldLoaded
{
[TranslationReference]
[FluentReference]
const string TimeLimitExpired = "notification-time-limit-expired";
readonly TimeLimitManagerInfo info;
@@ -182,7 +182,7 @@ namespace OpenRA.Mods.Common.Traits
countdownLabel.GetText = () => null;
if (!info.SkipTimerExpiredNotification)
TextNotificationsManager.AddSystemLine(TranslationProvider.GetString(TimeLimitExpired));
TextNotificationsManager.AddSystemLine(FluentProvider.GetString(TimeLimitExpired));
}
}
}