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

@@ -25,7 +25,7 @@ namespace OpenRA.Mods.Common.Widgets
public bool DisableKeyRepeat = false;
public bool DisableKeySound = false;
[TranslationReference]
[FluentReference]
public string Text = "";
public TextAlign Align = TextAlign.Center;
public int LeftMargin = 5;
@@ -55,11 +55,11 @@ namespace OpenRA.Mods.Common.Widgets
protected Lazy<TooltipContainerWidget> tooltipContainer;
[TranslationReference]
[FluentReference]
public string TooltipText;
public Func<string> GetTooltipText;
[TranslationReference]
[FluentReference]
public string TooltipDesc;
public Func<string> GetTooltipDesc;
@@ -77,9 +77,9 @@ namespace OpenRA.Mods.Common.Widgets
{
ModRules = modData.DefaultRules;
var textCache = new CachedTransform<string, string>(s => !string.IsNullOrEmpty(s) ? TranslationProvider.GetString(s) : "");
var tooltipTextCache = new CachedTransform<string, string>(s => !string.IsNullOrEmpty(s) ? TranslationProvider.GetString(s) : "");
var tooltipDescCache = new CachedTransform<string, string>(s => !string.IsNullOrEmpty(s) ? TranslationProvider.GetString(s) : "");
var textCache = new CachedTransform<string, string>(s => !string.IsNullOrEmpty(s) ? FluentProvider.GetString(s) : "");
var tooltipTextCache = new CachedTransform<string, string>(s => !string.IsNullOrEmpty(s) ? FluentProvider.GetString(s) : "");
var tooltipDescCache = new CachedTransform<string, string>(s => !string.IsNullOrEmpty(s) ? FluentProvider.GetString(s) : "");
GetText = () => textCache.Update(Text);
GetColor = () => TextColor;

View File

@@ -36,11 +36,11 @@ namespace OpenRA.Mods.Common.Widgets
var cancelButton = prompt.GetOrNull<ButtonWidget>("CANCEL_BUTTON");
var otherButton = prompt.GetOrNull<ButtonWidget>("OTHER_BUTTON");
var titleMessage = TranslationProvider.GetString(title, titleArguments);
var titleMessage = FluentProvider.GetString(title, titleArguments);
prompt.Get<LabelWidget>("PROMPT_TITLE").GetText = () => titleMessage;
var headerTemplate = prompt.Get<LabelWidget>("PROMPT_TEXT");
var textMessage = TranslationProvider.GetString(text, textArguments);
var textMessage = FluentProvider.GetString(text, textArguments);
var headerLines = textMessage.Split('\n');
var headerHeight = 0;
foreach (var l in headerLines)
@@ -68,7 +68,7 @@ namespace OpenRA.Mods.Common.Widgets
if (!string.IsNullOrEmpty(confirmText))
{
var confirmTextMessage = TranslationProvider.GetString(confirmText);
var confirmTextMessage = FluentProvider.GetString(confirmText);
confirmButton.GetText = () => confirmTextMessage;
}
}
@@ -85,7 +85,7 @@ namespace OpenRA.Mods.Common.Widgets
if (!string.IsNullOrEmpty(cancelText))
{
var cancelTextMessage = TranslationProvider.GetString(cancelText);
var cancelTextMessage = FluentProvider.GetString(cancelText);
cancelButton.GetText = () => cancelTextMessage;
}
}
@@ -98,7 +98,7 @@ namespace OpenRA.Mods.Common.Widgets
if (!string.IsNullOrEmpty(otherText))
{
var otherTextMessage = TranslationProvider.GetString(otherText);
var otherTextMessage = FluentProvider.GetString(otherText);
otherButton.GetText = () => otherTextMessage;
}
}
@@ -114,10 +114,10 @@ namespace OpenRA.Mods.Common.Widgets
Func<bool> doValidate = null;
ButtonWidget acceptButton = null, cancelButton = null;
var titleMessage = TranslationProvider.GetString(title);
var titleMessage = FluentProvider.GetString(title);
panel.Get<LabelWidget>("PROMPT_TITLE").GetText = () => titleMessage;
var promptMessage = TranslationProvider.GetString(prompt);
var promptMessage = FluentProvider.GetString(prompt);
panel.Get<LabelWidget>("PROMPT_TEXT").GetText = () => promptMessage;
var input = panel.Get<TextFieldWidget>("INPUT_TEXT");
@@ -147,7 +147,7 @@ namespace OpenRA.Mods.Common.Widgets
acceptButton = panel.Get<ButtonWidget>("ACCEPT_BUTTON");
if (!string.IsNullOrEmpty(acceptText))
{
var acceptTextMessage = TranslationProvider.GetString(acceptText);
var acceptTextMessage = FluentProvider.GetString(acceptText);
acceptButton.GetText = () => acceptTextMessage;
}
@@ -163,7 +163,7 @@ namespace OpenRA.Mods.Common.Widgets
cancelButton = panel.Get<ButtonWidget>("CANCEL_BUTTON");
if (!string.IsNullOrEmpty(cancelText))
{
var cancelTextMessage = TranslationProvider.GetString(cancelText);
var cancelTextMessage = FluentProvider.GetString(cancelText);
cancelButton.GetText = () => cancelTextMessage;
}

View File

@@ -28,7 +28,7 @@ namespace OpenRA.Mods.Common.Widgets
public Func<string> GetImageCollection;
public Func<Sprite> GetSprite;
[TranslationReference]
[FluentReference]
public string TooltipText;
readonly Lazy<TooltipContainerWidget> tooltipContainer;
@@ -41,7 +41,7 @@ namespace OpenRA.Mods.Common.Widgets
{
GetImageName = () => ImageName;
GetImageCollection = () => ImageCollection;
var tooltipCache = new CachedTransform<string, string>(s => !string.IsNullOrEmpty(s) ? TranslationProvider.GetString(s) : "");
var tooltipCache = new CachedTransform<string, string>(s => !string.IsNullOrEmpty(s) ? FluentProvider.GetString(s) : "");
GetTooltipText = () => tooltipCache.Update(TooltipText);
tooltipContainer = Exts.Lazy(() =>
Ui.Root.Get<TooltipContainerWidget>(TooltipContainer));

View File

@@ -21,7 +21,7 @@ namespace OpenRA.Mods.Common.Widgets
public class LabelWidget : Widget
{
[TranslationReference]
[FluentReference]
public string Text = null;
public TextAlign Align = TextAlign.Left;
public TextVAlign VAlign = TextVAlign.Middle;
@@ -41,7 +41,7 @@ namespace OpenRA.Mods.Common.Widgets
[ObjectCreator.UseCtor]
public LabelWidget(ModData modData)
{
var textCache = new CachedTransform<string, string>(s => !string.IsNullOrEmpty(s) ? TranslationProvider.GetString(s) : "");
var textCache = new CachedTransform<string, string>(s => !string.IsNullOrEmpty(s) ? FluentProvider.GetString(s) : "");
GetText = () => textCache.Update(Text);
GetColor = () => TextColor;
GetContrastColorDark = () => ContrastColorDark;

View File

@@ -35,10 +35,10 @@ namespace OpenRA.Mods.Common.Widgets.Logic
Unknown = 16
}
[TranslationReference("length")]
[FluentReference("length")]
const string LengthInSeconds = "label-length-in-seconds";
[TranslationReference]
[FluentReference]
const string AllPackages = "label-all-packages";
readonly string[] allowedExtensions;
@@ -96,7 +96,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
this.modData = modData;
panel = widget;
allPackages = TranslationProvider.GetString(AllPackages);
allPackages = FluentProvider.GetString(AllPackages);
var colorPickerPalettes = world.WorldActor.TraitsImplementing<IProvidesAssetBrowserColorPickerPalettes>()
.SelectMany(p => p.ColorPickerPaletteNames)
@@ -238,7 +238,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
if (frameText != null)
{
var soundLength = new CachedTransform<double, string>(p =>
TranslationProvider.GetString(LengthInSeconds, Translation.Arguments("length", Math.Round(p, 3))));
FluentProvider.GetString(LengthInSeconds, FluentBundle.Arguments("length", Math.Round(p, 3))));
frameText.GetText = () =>
{

View File

@@ -17,7 +17,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
{
public class ConnectionLogic : ChromeLogic
{
[TranslationReference("endpoint")]
[FluentReference("endpoint")]
const string ConnectingToEndpoint = "label-connecting-to-endpoint";
readonly Action onConnect;
@@ -66,7 +66,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
var panel = widget;
panel.Get<ButtonWidget>("ABORT_BUTTON").OnClick = () => { CloseWindow(); onAbort(); };
var connectingDesc = TranslationProvider.GetString(ConnectingToEndpoint, Translation.Arguments("endpoint", endpoint));
var connectingDesc = FluentProvider.GetString(ConnectingToEndpoint, FluentBundle.Arguments("endpoint", endpoint));
widget.Get<LabelWidget>("CONNECTING_DESC").GetText = () => connectingDesc;
}
@@ -87,16 +87,16 @@ namespace OpenRA.Mods.Common.Widgets.Logic
public class ConnectionFailedLogic : ChromeLogic
{
[TranslationReference("target")]
[FluentReference("target")]
const string CouldNotConnectToTarget = "label-could-not-connect-to-target";
[TranslationReference]
[FluentReference]
const string UnknownError = "label-unknown-error";
[TranslationReference]
[FluentReference]
const string PasswordRequired = "label-password-required";
[TranslationReference]
[FluentReference]
const string ConnectionFailed = "label-connection-failed";
readonly PasswordFieldWidget passwordField;
@@ -130,17 +130,17 @@ namespace OpenRA.Mods.Common.Widgets.Logic
onRetry(pass);
};
var connectingDescText = TranslationProvider.GetString(CouldNotConnectToTarget, Translation.Arguments("target", connection.Target));
var connectingDescText = FluentProvider.GetString(CouldNotConnectToTarget, FluentBundle.Arguments("target", connection.Target));
widget.Get<LabelWidget>("CONNECTING_DESC").GetText = () => connectingDescText;
var connectionError = widget.Get<LabelWidget>("CONNECTION_ERROR");
var connectionErrorText = orderManager.ServerError != null
? TranslationProvider.GetString(orderManager.ServerError)
: connection.ErrorMessage ?? TranslationProvider.GetString(UnknownError);
? FluentProvider.GetString(orderManager.ServerError)
: connection.ErrorMessage ?? FluentProvider.GetString(UnknownError);
connectionError.GetText = () => connectionErrorText;
var panelTitle = widget.Get<LabelWidget>("TITLE");
var panelTitleText = orderManager.AuthenticationFailed ? TranslationProvider.GetString(PasswordRequired) : TranslationProvider.GetString(ConnectionFailed);
var panelTitleText = orderManager.AuthenticationFailed ? FluentProvider.GetString(PasswordRequired) : FluentProvider.GetString(ConnectionFailed);
panelTitle.GetText = () => panelTitleText;
passwordField = panel.GetOrNull<PasswordFieldWidget>("PASSWORD");
@@ -182,7 +182,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
public class ConnectionSwitchModLogic : ChromeLogic
{
[TranslationReference]
[FluentReference]
const string ModSwitchFailed = "notification-mod-switch-failed";
[ObjectCreator.UseCtor]

View File

@@ -21,13 +21,13 @@ namespace OpenRA.Mods.Common.Widgets.Logic
{
public class ActorEditLogic : ChromeLogic
{
[TranslationReference]
[FluentReference]
const string DuplicateActorId = "label-duplicate-actor-id";
[TranslationReference]
[FluentReference]
const string EnterActorId = "label-actor-id";
[TranslationReference]
[FluentReference]
const string Owner = "label-actor-owner";
// Error states define overlapping bits to simplify panel reflow logic
@@ -94,8 +94,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic
actorIDErrorLabel.IsVisible = () => actorIDStatus != ActorIDStatus.Normal;
actorIDErrorLabel.GetText = () =>
actorIDStatus == ActorIDStatus.Duplicate || nextActorIDStatus == ActorIDStatus.Duplicate
? TranslationProvider.GetString(DuplicateActorId)
: TranslationProvider.GetString(EnterActorId);
? FluentProvider.GetString(DuplicateActorId)
: FluentProvider.GetString(EnterActorId);
okButton.IsDisabled = () => !IsValid() || editActorPreview == null || !editActorPreview.IsDirty;
okButton.OnClick = Save;
@@ -167,7 +167,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
initialActorID = actorIDField.Text = SelectedActor.ID;
var font = Game.Renderer.Fonts[typeLabel.Font];
var truncatedType = WidgetUtils.TruncateText(TranslationProvider.GetString(SelectedActor.DescriptiveName), typeLabel.Bounds.Width, font);
var truncatedType = WidgetUtils.TruncateText(FluentProvider.GetString(SelectedActor.DescriptiveName), typeLabel.Bounds.Width, font);
typeLabel.GetText = () => truncatedType;
actorIDField.CursorPosition = SelectedActor.ID.Length;
@@ -180,7 +180,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
// Add owner dropdown
var ownerContainer = dropdownOptionTemplate.Clone();
var owner = TranslationProvider.GetString(Owner);
var owner = FluentProvider.GetString(Owner);
ownerContainer.Get<LabelWidget>("LABEL").GetText = () => owner;
var ownerDropdown = ownerContainer.Get<DropDownButtonWidget>("OPTION");
var selectedOwner = SelectedActor.Owner;
@@ -439,10 +439,10 @@ namespace OpenRA.Mods.Common.Widgets.Logic
sealed class EditActorEditorAction : IEditorAction
{
[TranslationReference("name", "id")]
[FluentReference("name", "id")]
const string EditedActor = "notification-edited-actor";
[TranslationReference("name", "old-id", "new-id")]
[FluentReference("name", "old-id", "new-id")]
const string EditedActorId = "notification-edited-actor-id";
public string Text { get; private set; }
@@ -454,7 +454,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
{
Actor = actor;
this.handles = handles;
Text = TranslationProvider.GetString(EditedActor, Translation.Arguments("name", actor.Info.Name, "id", actor.ID));
Text = FluentProvider.GetString(EditedActor, FluentBundle.Arguments("name", actor.Info.Name, "id", actor.ID));
}
public void Execute()
@@ -466,7 +466,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
var after = Actor;
if (before != after)
Text = TranslationProvider.GetString(EditedActorId, Translation.Arguments("name", after.Info.Name, "old-id", before.ID, "new-id", after.ID));
Text = FluentProvider.GetString(EditedActorId, FluentBundle.Arguments("name", after.Info.Name, "old-id", before.ID, "new-id", after.ID));
}
public void Do()

View File

@@ -21,7 +21,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
{
public class ActorSelectorLogic : CommonSelectorLogic
{
[TranslationReference("actorType")]
[FluentReference("actorType")]
const string ActorTypeTooltip = "label-actor-type";
sealed class ActorSelectorActor
@@ -112,12 +112,12 @@ namespace OpenRA.Mods.Common.Widgets.Logic
var tooltip = a.TraitInfos<EditorOnlyTooltipInfo>().FirstOrDefault(ti => ti.EnabledByDefault) as TooltipInfoBase
?? a.TraitInfos<TooltipInfo>().FirstOrDefault(ti => ti.EnabledByDefault);
var actorType = TranslationProvider.GetString(ActorTypeTooltip, Translation.Arguments("actorType", a.Name));
var actorType = FluentProvider.GetString(ActorTypeTooltip, FluentBundle.Arguments("actorType", a.Name));
var searchTerms = new List<string>() { a.Name };
if (tooltip != null)
{
var actorName = TranslationProvider.GetString(tooltip.Name);
var actorName = FluentProvider.GetString(tooltip.Name);
searchTerms.Add(actorName);
allActorsTemp.Add(new ActorSelectorActor(a, editorData.Categories, searchTerms.ToArray(), actorName + $"\n{actorType}"));
}

View File

@@ -19,16 +19,16 @@ namespace OpenRA.Mods.Common.Widgets.Logic
{
public abstract class CommonSelectorLogic : ChromeLogic
{
[TranslationReference]
[FluentReference]
const string None = "options-common-selector.none";
[TranslationReference]
[FluentReference]
const string SearchResults = "options-common-selector.search-results";
[TranslationReference]
[FluentReference]
const string All = "options-common-selector.all";
[TranslationReference]
[FluentReference]
const string Multiple = "options-common-selector.multiple";
protected readonly Widget Widget;
@@ -73,10 +73,10 @@ namespace OpenRA.Mods.Common.Widgets.Logic
Editor.DefaultBrush.SelectionChanged += HandleSelectionChanged;
var none = TranslationProvider.GetString(None);
var searchResults = TranslationProvider.GetString(SearchResults);
var all = TranslationProvider.GetString(All);
var multiple = TranslationProvider.GetString(Multiple);
var none = FluentProvider.GetString(None);
var searchResults = FluentProvider.GetString(SearchResults);
var all = FluentProvider.GetString(All);
var multiple = FluentProvider.GetString(Multiple);
var categorySelector = widget.Get<DropDownButtonWidget>("CATEGORIES_DROPDOWN");
categorySelector.GetText = () =>

View File

@@ -20,7 +20,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
{
public class MapEditorSelectionLogic : ChromeLogic
{
[TranslationReference]
[FluentReference]
const string AreaSelection = "label-area-selection";
readonly EditorViewportControllerWidget editor;
@@ -151,7 +151,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
var resourceValueInRegion = editorResourceLayer.CalculateRegionValue(selectedRegion);
var areaSelectionLabel =
$"{TranslationProvider.GetString(AreaSelection)} ({DimensionsAsString(selectionSize)}) " +
$"{FluentProvider.GetString(AreaSelection)} ({DimensionsAsString(selectionSize)}) " +
$"{PositionAsString(selectedRegion.TopLeft)} : {PositionAsString(selectedRegion.BottomRight)}";
AreaEditTitle.GetText = () => areaSelectionLabel;

View File

@@ -22,14 +22,14 @@ namespace OpenRA.Mods.Common.Widgets.Logic
{
public class MapMarkerTilesLogic : ChromeLogic
{
[TranslationReference]
const string MarkerMirrorModeNoneTranslation = "mirror-mode.none";
[FluentReference]
const string MarkerMirrorModeNone = "mirror-mode.none";
[TranslationReference]
const string MarkerMirrorModeFlipTranslation = "mirror-mode.flip";
[FluentReference]
const string MarkerMirrorModeFlip = "mirror-mode.flip";
[TranslationReference]
const string MarkerMirrorModeRotateTranslation = "mirror-mode.rotate";
[FluentReference]
const string MarkerMirrorModeRotate = "mirror-mode.rotate";
readonly EditorActionManager editorActionManager;
readonly MarkerLayerOverlay markerLayerTrait;
@@ -130,13 +130,13 @@ namespace OpenRA.Mods.Common.Widgets.Logic
switch (markerLayerTrait.MirrorMode)
{
case MarkerTileMirrorMode.None:
return TranslationProvider.GetString(MarkerMirrorModeNoneTranslation);
return FluentProvider.GetString(MarkerMirrorModeNone);
case MarkerTileMirrorMode.Flip:
return TranslationProvider.GetString(MarkerMirrorModeFlipTranslation);
return FluentProvider.GetString(MarkerMirrorModeFlip);
case MarkerTileMirrorMode.Rotate:
return TranslationProvider.GetString(MarkerMirrorModeRotateTranslation);
return FluentProvider.GetString(MarkerMirrorModeRotate);
default:
throw new ArgumentException($"Couldn't find translation for marker tile mirror mode '{markerLayerTrait.MirrorMode}'");
throw new ArgumentException($"Couldn't find fluent string for marker tile mirror mode '{markerLayerTrait.MirrorMode}'");
}
};
@@ -221,13 +221,13 @@ namespace OpenRA.Mods.Common.Widgets.Logic
switch (mode)
{
case MarkerTileMirrorMode.None:
return TranslationProvider.GetString(MarkerMirrorModeNoneTranslation);
return FluentProvider.GetString(MarkerMirrorModeNone);
case MarkerTileMirrorMode.Flip:
return TranslationProvider.GetString(MarkerMirrorModeFlipTranslation);
return FluentProvider.GetString(MarkerMirrorModeFlip);
case MarkerTileMirrorMode.Rotate:
return TranslationProvider.GetString(MarkerMirrorModeRotateTranslation);
return FluentProvider.GetString(MarkerMirrorModeRotate);
default:
throw new ArgumentException($"Couldn't find translation for marker tile mirror mode '{mode}'");
throw new ArgumentException($"Couldn't find fluent string for marker tile mirror mode '{mode}'");
}
};

View File

@@ -17,7 +17,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
{
public class MapToolsLogic : ChromeLogic
{
[TranslationReference]
[FluentReference]
const string MarkerTiles = "label-tool-marker-tiles";
enum MapTool
@@ -44,7 +44,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
toolPanels.Add(MapTool.MarkerTiles, markerToolPanel);
toolsDropdown.OnMouseDown = _ => ShowToolsDropDown(toolsDropdown);
toolsDropdown.GetText = () => TranslationProvider.GetString(toolNames[selectedTool]);
toolsDropdown.GetText = () => FluentProvider.GetString(toolNames[selectedTool]);
toolsDropdown.Disabled = true; // TODO: Enable if new tools are added
}
@@ -56,7 +56,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
() => selectedTool == tool,
() => SelectTool(tool));
item.Get<LabelWidget>("LABEL").GetText = () => TranslationProvider.GetString(toolNames[tool]);
item.Get<LabelWidget>("LABEL").GetText = () => FluentProvider.GetString(toolNames[tool]);
return item;
}

View File

@@ -44,37 +44,37 @@ namespace OpenRA.Mods.Common.Widgets.Logic
}
}
[TranslationReference]
[FluentReference]
const string SaveMapFailedTitle = "dialog-save-map-failed.title";
[TranslationReference]
[FluentReference]
const string SaveMapFailedPrompt = "dialog-save-map-failed.prompt";
[TranslationReference]
[FluentReference]
const string SaveMapFailedConfirm = "dialog-save-map-failed.confirm";
[TranslationReference]
[FluentReference]
const string Unpacked = "label-unpacked-map";
[TranslationReference]
[FluentReference]
const string OverwriteMapFailedTitle = "dialog-overwrite-map-failed.title";
[TranslationReference]
[FluentReference]
const string OverwriteMapFailedPrompt = "dialog-overwrite-map-failed.prompt";
[TranslationReference]
[FluentReference]
const string OverwriteMapFailedConfirm = "dialog-overwrite-map-failed.confirm";
[TranslationReference]
[FluentReference]
const string OverwriteMapOutsideEditTitle = "dialog-overwrite-map-outside-edit.title";
[TranslationReference]
[FluentReference]
const string OverwriteMapOutsideEditPrompt = "dialog-overwrite-map-outside-edit.prompt";
[TranslationReference]
[FluentReference]
const string SaveMapMapOutsideConfirm = "dialog-overwrite-map-outside-edit.confirm";
[TranslationReference]
[FluentReference]
const string SaveCurrentMap = "notification-save-current-map";
[ObjectCreator.UseCtor]
@@ -171,7 +171,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
var fileTypes = new Dictionary<MapFileType, MapFileTypeInfo>()
{
{ MapFileType.OraMap, new MapFileTypeInfo { Extension = ".oramap", UiLabel = ".oramap" } },
{ MapFileType.Unpacked, new MapFileTypeInfo { Extension = "", UiLabel = $"({TranslationProvider.GetString(Unpacked)})" } }
{ MapFileType.Unpacked, new MapFileTypeInfo { Extension = "", UiLabel = $"({FluentProvider.GetString(Unpacked)})" } }
};
var typeDropdown = widget.Get<DropDownButtonWidget>("TYPE_DROPDOWN");

View File

@@ -116,7 +116,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
var label = item.Get<LabelWithTooltipWidget>("TITLE");
var name = actor.TraitInfos<TooltipInfo>().FirstOrDefault(info => info.EnabledByDefault)?.Name;
if (!string.IsNullOrEmpty(name))
WidgetUtils.TruncateLabelToTooltip(label, TranslationProvider.GetString(name));
WidgetUtils.TruncateLabelToTooltip(label, FluentProvider.GetString(name));
if (firstItem == null)
{
@@ -159,7 +159,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
var info = actor.TraitInfoOrDefault<EncyclopediaInfo>();
if (info != null && !string.IsNullOrEmpty(info.Description))
text += WidgetUtils.WrapText(TranslationProvider.GetString(info.Description) + "\n\n", descriptionLabel.Bounds.Width, descriptionFont);
text += WidgetUtils.WrapText(FluentProvider.GetString(info.Description) + "\n\n", descriptionLabel.Bounds.Width, descriptionFont);
var height = descriptionFont.Measure(text).Y;
descriptionLabel.GetText = () => text;
@@ -175,7 +175,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
{
var actorTooltip = actor.TraitInfos<TooltipInfo>().FirstOrDefault(info => info.EnabledByDefault);
if (actorTooltip != null)
return TranslationProvider.GetString(actorTooltip.Name);
return FluentProvider.GetString(actorTooltip.Name);
}
return name;

View File

@@ -21,43 +21,43 @@ namespace OpenRA.Mods.Common.Widgets.Logic
{
public class GameSaveBrowserLogic : ChromeLogic
{
[TranslationReference]
[FluentReference]
const string RenameSaveTitle = "dialog-rename-save.title";
[TranslationReference]
[FluentReference]
const string RenameSavePrompt = "dialog-rename-save.prompt";
[TranslationReference]
[FluentReference]
const string RenameSaveAccept = "dialog-rename-save.confirm";
[TranslationReference]
[FluentReference]
const string DeleteSaveTitle = "dialog-delete-save.title";
[TranslationReference("save")]
[FluentReference("save")]
const string DeleteSavePrompt = "dialog-delete-save.prompt";
[TranslationReference]
[FluentReference]
const string DeleteSaveAccept = "dialog-delete-save.confirm";
[TranslationReference]
[FluentReference]
const string DeleteAllSavesTitle = "dialog-delete-all-saves.title";
[TranslationReference("count")]
[FluentReference("count")]
const string DeleteAllSavesPrompt = "dialog-delete-all-saves.prompt";
[TranslationReference]
[FluentReference]
const string DeleteAllSavesAccept = "dialog-delete-all-saves.confirm";
[TranslationReference("savePath")]
[FluentReference("savePath")]
const string SaveDeletionFailed = "notification-save-deletion-failed";
[TranslationReference]
[FluentReference]
const string OverwriteSaveTitle = "dialog-overwrite-save.title";
[TranslationReference("file")]
[FluentReference("file")]
const string OverwriteSavePrompt = "dialog-overwrite-save.prompt";
[TranslationReference]
[FluentReference]
const string OverwriteSaveAccpet = "dialog-overwrite-save.confirm";
readonly Widget panel;
@@ -173,7 +173,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
ConfirmationDialogs.ButtonPrompt(modData,
title: DeleteSaveTitle,
text: DeleteSavePrompt,
textArguments: Translation.Arguments("save", Path.GetFileNameWithoutExtension(selectedSave)),
textArguments: FluentBundle.Arguments("save", Path.GetFileNameWithoutExtension(selectedSave)),
onConfirm: () =>
{
Delete(selectedSave);
@@ -197,7 +197,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
ConfirmationDialogs.ButtonPrompt(modData,
title: DeleteAllSavesTitle,
text: DeleteAllSavesPrompt,
textArguments: Translation.Arguments("count", games.Count),
textArguments: FluentBundle.Arguments("count", games.Count),
onConfirm: () =>
{
foreach (var s in games.ToList())
@@ -293,7 +293,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
}
catch (Exception ex)
{
TextNotificationsManager.Debug(TranslationProvider.GetString(SaveDeletionFailed, Translation.Arguments("savePath", savePath)));
TextNotificationsManager.Debug(FluentProvider.GetString(SaveDeletionFailed, FluentBundle.Arguments("savePath", savePath)));
Log.Write("debug", ex.ToString());
return;
}
@@ -373,7 +373,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
ConfirmationDialogs.ButtonPrompt(modData,
title: OverwriteSaveTitle,
text: OverwriteSavePrompt,
textArguments: Translation.Arguments("file", saveTextField.Text),
textArguments: FluentBundle.Arguments("file", saveTextField.Text),
onConfirm: Inner,
confirmText: OverwriteSaveAccpet,
onCancel: () => { });

View File

@@ -38,13 +38,13 @@ namespace OpenRA.Mods.Common.Widgets.Logic
return;
var tooltip = armyUnit.TooltipInfo;
var name = tooltip != null ? TranslationProvider.GetString(tooltip.Name) : armyUnit.ActorInfo.Name;
var name = tooltip != null ? FluentProvider.GetString(tooltip.Name) : armyUnit.ActorInfo.Name;
var buildable = armyUnit.BuildableInfo;
nameLabel.GetText = () => name;
var nameSize = font.Measure(name);
var desc = string.IsNullOrEmpty(buildable.Description) ? "" : TranslationProvider.GetString(buildable.Description);
var desc = string.IsNullOrEmpty(buildable.Description) ? "" : FluentProvider.GetString(buildable.Description);
descLabel.GetText = () => desc;
var descSize = descFont.Measure(desc);
descLabel.Bounds.Width = descSize.X;

View File

@@ -22,19 +22,19 @@ namespace OpenRA.Mods.Common.Widgets.Logic
sealed class GameInfoLogic : ChromeLogic
{
[TranslationReference]
[FluentReference]
const string Objectives = "menu-game-info.objectives";
[TranslationReference]
[FluentReference]
const string Briefing = "menu-game-info.briefing";
[TranslationReference]
[FluentReference]
const string Options = "menu-game-info.options";
[TranslationReference]
[FluentReference]
const string Debug = "menu-game-info.debug";
[TranslationReference]
[FluentReference]
const string Chat = "menu-game-info.chat";
readonly World world;
@@ -108,7 +108,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
if (tabButton != null)
{
var tabButtonText = TranslationProvider.GetString(label);
var tabButtonText = FluentProvider.GetString(label);
tabButton.GetText = () => tabButtonText;
tabButton.OnClick = () =>
{

View File

@@ -18,13 +18,13 @@ namespace OpenRA.Mods.Common.Widgets.Logic
{
sealed class GameInfoObjectivesLogic : ChromeLogic
{
[TranslationReference]
[FluentReference]
const string InProgress = "label-mission-in-progress";
[TranslationReference]
[FluentReference]
const string Accomplished = "label-mission-accomplished";
[TranslationReference]
[FluentReference]
const string Failed = "label-mission-failed";
readonly ContainerWidget template;
@@ -51,9 +51,9 @@ namespace OpenRA.Mods.Common.Widgets.Logic
}
var missionStatus = widget.Get<LabelWidget>("MISSION_STATUS");
var inProgress = TranslationProvider.GetString(InProgress);
var accomplished = TranslationProvider.GetString(Accomplished);
var failed = TranslationProvider.GetString(Failed);
var inProgress = FluentProvider.GetString(InProgress);
var accomplished = FluentProvider.GetString(Accomplished);
var failed = FluentProvider.GetString(Failed);
missionStatus.GetText = () => player.WinState == WinState.Undefined ? inProgress :
player.WinState == WinState.Won ? accomplished : failed;
missionStatus.GetColor = () => player.WinState == WinState.Undefined ? Color.White :

View File

@@ -23,67 +23,67 @@ namespace OpenRA.Mods.Common.Widgets.Logic
{
sealed class GameInfoStatsLogic : ChromeLogic
{
[TranslationReference]
[FluentReference]
const string Unmute = "label-unmute-player";
[TranslationReference]
[FluentReference]
const string Mute = "label-mute-player";
[TranslationReference]
[FluentReference]
const string Accomplished = "label-mission-accomplished";
[TranslationReference]
[FluentReference]
const string Failed = "label-mission-failed";
[TranslationReference]
[FluentReference]
const string InProgress = "label-mission-in-progress";
[TranslationReference("team")]
[FluentReference("team")]
const string TeamNumber = "label-team-name";
[TranslationReference]
[FluentReference]
const string NoTeam = "label-no-team";
[TranslationReference]
[FluentReference]
const string Spectators = "label-spectators";
[TranslationReference]
[FluentReference]
const string Gone = "label-client-state-disconnected";
[TranslationReference]
[FluentReference]
const string KickTooltip = "button-kick-player";
[TranslationReference("player")]
[FluentReference("player")]
const string KickTitle = "dialog-kick.title";
[TranslationReference]
[FluentReference]
const string KickPrompt = "dialog-kick.prompt";
[TranslationReference]
[FluentReference]
const string KickAccept = "dialog-kick.confirm";
[TranslationReference]
[FluentReference]
const string KickVoteTooltip = "button-vote-kick-player";
[TranslationReference("player")]
[FluentReference("player")]
const string VoteKickTitle = "dialog-vote-kick.title";
[TranslationReference]
[FluentReference]
const string VoteKickPrompt = "dialog-vote-kick.prompt";
[TranslationReference("bots")]
[FluentReference("bots")]
const string VoteKickPromptBreakBots = "dialog-vote-kick.prompt-break-bots";
[TranslationReference]
[FluentReference]
const string VoteKickVoteStart = "dialog-vote-kick.vote-start";
[TranslationReference]
[FluentReference]
const string VoteKickVoteFor = "dialog-vote-kick.vote-for";
[TranslationReference]
[FluentReference]
const string VoteKickVoteAgainst = "dialog-vote-kick.vote-against";
[TranslationReference]
[FluentReference]
const string VoteKickVoteCancel = "dialog-vote-kick.vote-cancel";
[ObjectCreator.UseCtor]
@@ -108,9 +108,9 @@ namespace OpenRA.Mods.Common.Widgets.Logic
checkbox.GetText = () => mo.Objectives[0].Description;
}
var failed = TranslationProvider.GetString(Failed);
var inProgress = TranslationProvider.GetString(InProgress);
var accomplished = TranslationProvider.GetString(Accomplished);
var failed = FluentProvider.GetString(Failed);
var inProgress = FluentProvider.GetString(InProgress);
var accomplished = FluentProvider.GetString(Accomplished);
statusLabel.GetText = () => player.WinState == WinState.Won ? accomplished :
player.WinState == WinState.Lost ? failed : inProgress;
statusLabel.GetColor = () => player.WinState == WinState.Won ? Color.LimeGreen :
@@ -133,10 +133,10 @@ namespace OpenRA.Mods.Common.Widgets.Logic
var teamTemplate = playerPanel.Get<ScrollItemWidget>("TEAM_TEMPLATE");
var playerTemplate = playerPanel.Get("PLAYER_TEMPLATE");
var spectatorTemplate = playerPanel.Get("SPECTATOR_TEMPLATE");
var unmuteTooltip = TranslationProvider.GetString(Unmute);
var muteTooltip = TranslationProvider.GetString(Mute);
var kickTooltip = TranslationProvider.GetString(KickTooltip);
var voteKickTooltip = TranslationProvider.GetString(KickVoteTooltip);
var unmuteTooltip = FluentProvider.GetString(Unmute);
var muteTooltip = FluentProvider.GetString(Mute);
var kickTooltip = FluentProvider.GetString(KickTooltip);
var voteKickTooltip = FluentProvider.GetString(KickVoteTooltip);
playerPanel.RemoveChildren();
var teams = world.Players.Where(p => !p.NonCombatant && p.Playable)
@@ -160,8 +160,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic
ConfirmationDialogs.ButtonPrompt(modData,
title: VoteKickTitle,
text: botsCount > 0 ? VoteKickPromptBreakBots : VoteKickPrompt,
titleArguments: Translation.Arguments("player", client.Name),
textArguments: Translation.Arguments("bots", botsCount),
titleArguments: FluentBundle.Arguments("player", client.Name),
textArguments: FluentBundle.Arguments("bots", botsCount),
onConfirm: () =>
{
orderManager.IssueOrder(Order.Command($"vote_kick {client.Index} {true}"));
@@ -176,8 +176,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic
ConfirmationDialogs.ButtonPrompt(modData,
title: VoteKickTitle,
text: botsCount > 0 ? VoteKickPromptBreakBots : VoteKickPrompt,
titleArguments: Translation.Arguments("player", client.Name),
textArguments: Translation.Arguments("bots", botsCount),
titleArguments: FluentBundle.Arguments("player", client.Name),
textArguments: FluentBundle.Arguments("bots", botsCount),
onConfirm: () =>
{
orderManager.IssueOrder(Order.Command($"vote_kick {client.Index} {true}"));
@@ -201,7 +201,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
ConfirmationDialogs.ButtonPrompt(modData,
title: KickTitle,
text: KickPrompt,
titleArguments: Translation.Arguments("player", client.Name),
titleArguments: FluentBundle.Arguments("player", client.Name),
onConfirm: () =>
{
orderManager.IssueOrder(Order.Command($"kick {client.Index} {false}"));
@@ -227,8 +227,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic
{
var teamHeader = ScrollItemWidget.Setup(teamTemplate, () => false, () => { });
var team = t.Key > 0
? TranslationProvider.GetString(TeamNumber, Translation.Arguments("team", t.Key))
: TranslationProvider.GetString(NoTeam);
? FluentProvider.GetString(TeamNumber, FluentBundle.Arguments("team", t.Key))
: FluentProvider.GetString(NoTeam);
teamHeader.Get<LabelWidget>("TEAM").GetText = () => team;
var teamRating = teamHeader.Get<LabelWidget>("TEAM_SCORE");
var scoreCache = new CachedTransform<int, string>(s => s.ToString(NumberFormatInfo.CurrentInfo));
@@ -257,13 +257,13 @@ namespace OpenRA.Mods.Common.Widgets.Logic
{
flag.GetImageName = () => pp.Faction.InternalName;
factionName = pp.Faction.Name != factionName
? $"{TranslationProvider.GetString(factionName)} ({TranslationProvider.GetString(pp.Faction.Name)})"
: TranslationProvider.GetString(pp.Faction.Name);
? $"{FluentProvider.GetString(factionName)} ({FluentProvider.GetString(pp.Faction.Name)})"
: FluentProvider.GetString(pp.Faction.Name);
}
else
{
flag.GetImageName = () => pp.DisplayFaction.InternalName;
factionName = TranslationProvider.GetString(factionName);
factionName = FluentProvider.GetString(factionName);
}
WidgetUtils.TruncateLabelToTooltip(item.Get<LabelWithTooltipWidget>("FACTION"), factionName);
@@ -291,7 +291,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
if (spectators.Count > 0)
{
var spectatorHeader = ScrollItemWidget.Setup(teamTemplate, () => false, () => { });
var spectatorTeam = TranslationProvider.GetString(Spectators);
var spectatorTeam = FluentProvider.GetString(Spectators);
spectatorHeader.Get<LabelWidget>("TEAM").GetText = () => spectatorTeam;
playerPanel.AddChild(spectatorHeader);
@@ -310,7 +310,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
nameLabel.GetText = () =>
{
var suffix = client.State == Session.ClientState.Disconnected ? $" ({TranslationProvider.GetString(Gone)})" : "";
var suffix = client.State == Session.ClientState.Disconnected ? $" ({FluentProvider.GetString(Gone)})" : "";
return name.Update((client.Name, suffix));
};

View File

@@ -19,16 +19,16 @@ namespace OpenRA.Mods.Common.Widgets.Logic
{
public class GameTimerLogic : ChromeLogic
{
[TranslationReference]
[FluentReference]
const string Paused = "label-paused";
[TranslationReference]
[FluentReference]
const string MaxSpeed = "label-max-speed";
[TranslationReference("percentage")]
[FluentReference("percentage")]
const string Speed = "label-replay-speed";
[TranslationReference("percentage")]
[FluentReference("percentage")]
const string Complete = "label-replay-complete";
[ObjectCreator.UseCtor]
@@ -44,10 +44,10 @@ namespace OpenRA.Mods.Common.Widgets.Logic
bool Paused() => world.Paused || world.ReplayTimestep == 0;
var pausedText = TranslationProvider.GetString(GameTimerLogic.Paused);
var maxSpeedText = TranslationProvider.GetString(MaxSpeed);
var pausedText = FluentProvider.GetString(GameTimerLogic.Paused);
var maxSpeedText = FluentProvider.GetString(MaxSpeed);
var speedText = new CachedTransform<int, string>(p =>
TranslationProvider.GetString(Speed, Translation.Arguments("percentage", p)));
FluentProvider.GetString(Speed, FluentBundle.Arguments("percentage", p)));
if (timer != null)
{
@@ -79,7 +79,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
}
var timerText = new CachedTransform<int, string>(p =>
TranslationProvider.GetString(Complete, Translation.Arguments("percentage", p)));
FluentProvider.GetString(Complete, FluentBundle.Arguments("percentage", p)));
if (timer is LabelWithTooltipWidget timerTooltip)
{
var connection = orderManager.Connection as ReplayConnection;

View File

@@ -27,10 +27,10 @@ namespace OpenRA.Mods.Common.Widgets.Logic.Ingame
public readonly string ClickSound = ChromeMetrics.Get<string>("ClickSound");
[TranslationReference("units")]
[FluentReference("units")]
const string SelectedUnitsAcrossScreen = "selected-units-across-screen";
[TranslationReference("units")]
[FluentReference("units")]
const string SelectedUnitsAcrossMap = "selected-units-across-map";
[ObjectCreator.UseCtor]
@@ -54,12 +54,12 @@ namespace OpenRA.Mods.Common.Widgets.Logic.Ingame
// Check if selecting actors on the screen has selected new units
if (newSelection.Count > selection.Actors.Count)
TextNotificationsManager.AddFeedbackLine(SelectedUnitsAcrossScreen, Translation.Arguments("units", newSelection.Count));
TextNotificationsManager.AddFeedbackLine(SelectedUnitsAcrossScreen, FluentBundle.Arguments("units", newSelection.Count));
else
{
// Select actors in the world that have highest selection priority
newSelection = SelectionUtils.SelectActorsInWorld(world, null, eligiblePlayers).SubsetWithHighestSelectionPriority(e.Modifiers).ToList();
TextNotificationsManager.AddFeedbackLine(SelectedUnitsAcrossMap, Translation.Arguments("units", newSelection.Count));
TextNotificationsManager.AddFeedbackLine(SelectedUnitsAcrossMap, FluentBundle.Arguments("units", newSelection.Count));
}
selection.Combine(world, newSelection, false, false);

View File

@@ -29,13 +29,13 @@ namespace OpenRA.Mods.Common.Widgets.Logic.Ingame
public readonly string ClickSound = ChromeMetrics.Get<string>("ClickSound");
public readonly string ClickDisabledSound = ChromeMetrics.Get<string>("ClickDisabledSound");
[TranslationReference]
[FluentReference]
const string NothingSelected = "nothing-selected";
[TranslationReference("units")]
[FluentReference("units")]
const string SelectedUnitsAcrossScreen = "selected-units-across-screen";
[TranslationReference("units")]
[FluentReference("units")]
const string SelectedUnitsAcrossMap = "selected-units-across-map";
[ObjectCreator.UseCtor]
@@ -79,12 +79,12 @@ namespace OpenRA.Mods.Common.Widgets.Logic.Ingame
// Check if selecting actors on the screen has selected new units
if (newSelection.Count > selection.Actors.Count)
TextNotificationsManager.AddFeedbackLine(SelectedUnitsAcrossScreen, Translation.Arguments("units", newSelection.Count));
TextNotificationsManager.AddFeedbackLine(SelectedUnitsAcrossScreen, FluentBundle.Arguments("units", newSelection.Count));
else
{
// Select actors in the world that have the same selection class as one of the already selected actors
newSelection = SelectionUtils.SelectActorsInWorld(world, selectedClasses, eligiblePlayers).ToList();
TextNotificationsManager.AddFeedbackLine(SelectedUnitsAcrossMap, Translation.Arguments("units", newSelection.Count));
TextNotificationsManager.AddFeedbackLine(SelectedUnitsAcrossMap, FluentBundle.Arguments("units", newSelection.Count));
}
selection.Combine(world, newSelection, true, false);

View File

@@ -19,7 +19,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
{
public class IngameCashCounterLogic : ChromeLogic
{
[TranslationReference("usage", "capacity")]
[FluentReference("usage", "capacity")]
const string SiloUsage = "label-silo-usage";
const float DisplayFracPerFrame = .07f;
@@ -45,7 +45,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
displayResources = playerResources.GetCashAndResources();
siloUsageTooltipCache = new CachedTransform<(int Resources, int Capacity), string>(x =>
TranslationProvider.GetString(SiloUsage, Translation.Arguments("usage", x.Resources, "capacity", x.Capacity)));
FluentProvider.GetString(SiloUsage, FluentBundle.Arguments("usage", x.Resources, "capacity", x.Capacity)));
cashLabel = widget.Get<LabelWithTooltipWidget>("CASH");
cashLabel.GetTooltipText = () => siloUsageTooltip;
}

View File

@@ -23,16 +23,16 @@ namespace OpenRA.Mods.Common.Widgets.Logic
[ChromeLogicArgsHotkeys("OpenTeamChat", "OpenGeneralChat")]
public class IngameChatLogic : ChromeLogic, INotificationHandler<TextNotification>
{
[TranslationReference]
[FluentReference]
const string TeamChat = "button-team-chat";
[TranslationReference]
[FluentReference]
const string GeneralChat = "button-general-chat";
[TranslationReference("seconds")]
[FluentReference("seconds")]
const string ChatAvailability = "label-chat-availability";
[TranslationReference]
[FluentReference]
const string ChatDisabled = "label-chat-disabled";
readonly Ruleset modRules;
@@ -70,10 +70,10 @@ namespace OpenRA.Mods.Common.Widgets.Logic
var disableTeamChat = alwaysDisabled || (world.LocalPlayer != null && !players.Any(p => p.IsAlliedWith(world.LocalPlayer)));
var teamChat = !disableTeamChat;
var teamMessage = TranslationProvider.GetString(TeamChat);
var allMessage = TranslationProvider.GetString(GeneralChat);
var teamMessage = FluentProvider.GetString(TeamChat);
var allMessage = FluentProvider.GetString(GeneralChat);
chatDisabled = TranslationProvider.GetString(ChatDisabled);
chatDisabled = FluentProvider.GetString(ChatDisabled);
// Only execute this once, the first time this widget is loaded
if (TextNotificationsManager.MutedPlayers.Count == 0)
@@ -194,7 +194,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
return true;
};
chatAvailableIn = new CachedTransform<int, string>(x => TranslationProvider.GetString(ChatAvailability, Translation.Arguments("seconds", x)));
chatAvailableIn = new CachedTransform<int, string>(x => FluentProvider.GetString(ChatAvailability, FluentBundle.Arguments("seconds", x)));
if (!isMenuChat)
{

View File

@@ -21,121 +21,121 @@ namespace OpenRA.Mods.Common.Widgets.Logic
{
public class IngameMenuLogic : ChromeLogic
{
[TranslationReference]
[FluentReference]
const string Leave = "menu-ingame.leave";
[TranslationReference]
[FluentReference]
const string AbortMission = "menu-ingame.abort";
[TranslationReference]
[FluentReference]
const string LeaveMissionTitle = "dialog-leave-mission.title";
[TranslationReference]
[FluentReference]
const string LeaveMissionPrompt = "dialog-leave-mission.prompt";
[TranslationReference]
[FluentReference]
const string LeaveMissionAccept = "dialog-leave-mission.confirm";
[TranslationReference]
[FluentReference]
const string LeaveMissionCancel = "dialog-leave-mission.cancel";
[TranslationReference]
[FluentReference]
const string RestartButton = "menu-ingame.restart";
[TranslationReference]
[FluentReference]
const string RestartMissionTitle = "dialog-restart-mission.title";
[TranslationReference]
[FluentReference]
const string RestartMissionPrompt = "dialog-restart-mission.prompt";
[TranslationReference]
[FluentReference]
const string RestartMissionAccept = "dialog-restart-mission.confirm";
[TranslationReference]
[FluentReference]
const string RestartMissionCancel = "dialog-restart-mission.cancel";
[TranslationReference]
[FluentReference]
const string SurrenderButton = "menu-ingame.surrender";
[TranslationReference]
[FluentReference]
const string SurrenderTitle = "dialog-surrender.title";
[TranslationReference]
[FluentReference]
const string SurrenderPrompt = "dialog-surrender.prompt";
[TranslationReference]
[FluentReference]
const string SurrenderAccept = "dialog-surrender.confirm";
[TranslationReference]
[FluentReference]
const string SurrenderCancel = "dialog-surrender.cancel";
[TranslationReference]
[FluentReference]
const string LoadGameButton = "menu-ingame.load-game";
[TranslationReference]
[FluentReference]
const string SaveGameButton = "menu-ingame.save-game";
[TranslationReference]
[FluentReference]
const string MusicButton = "menu-ingame.music";
[TranslationReference]
[FluentReference]
const string SettingsButton = "menu-ingame.settings";
[TranslationReference]
[FluentReference]
const string ReturnToMap = "menu-ingame.return-to-map";
[TranslationReference]
[FluentReference]
const string Resume = "menu-ingame.resume";
[TranslationReference]
[FluentReference]
const string SaveMapButton = "menu-ingame.save-map";
[TranslationReference]
[FluentReference]
const string ErrorMaxPlayerTitle = "dialog-error-max-player.title";
[TranslationReference("players", "max")]
[FluentReference("players", "max")]
const string ErrorMaxPlayerPrompt = "dialog-error-max-player.prompt";
[TranslationReference]
[FluentReference]
const string ErrorMaxPlayerAccept = "dialog-error-max-player.confirm";
[TranslationReference]
[FluentReference]
const string ExitMapButton = "menu-ingame.exit-map";
[TranslationReference]
[FluentReference]
const string ExitMapEditorTitle = "dialog-exit-map-editor.title";
[TranslationReference]
[FluentReference]
const string ExitMapEditorPromptUnsaved = "dialog-exit-map-editor.prompt-unsaved";
[TranslationReference]
[FluentReference]
const string ExitMapEditorPromptDeleted = "dialog-exit-map-editor.prompt-deleted";
[TranslationReference]
[FluentReference]
const string ExitMapEditorAnywayConfirm = "dialog-exit-map-editor.confirm-anyway";
[TranslationReference]
[FluentReference]
const string ExitMapEditorConfirm = "dialog-exit-map-editor.confirm";
[TranslationReference]
[FluentReference]
const string PlayMapWarningTitle = "dialog-play-map-warning.title";
[TranslationReference]
[FluentReference]
const string PlayMapWarningPrompt = "dialog-play-map-warning.prompt";
[TranslationReference]
[FluentReference]
const string PlayMapWarningCancel = "dialog-play-map-warning.cancel";
[TranslationReference]
[FluentReference]
const string ExitToMapEditorTitle = "dialog-exit-to-map-editor.title";
[TranslationReference]
[FluentReference]
const string ExitToMapEditorPrompt = "dialog-exit-to-map-editor.prompt";
[TranslationReference]
[FluentReference]
const string ExitToMapEditorConfirm = "dialog-exit-to-map-editor.confirm";
[TranslationReference]
[FluentReference]
const string ExitToMapEditorCancel = "dialog-exit-to-map-editor.cancel";
readonly Widget menu;
@@ -293,7 +293,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
Ui.ResetTooltips();
}
ButtonWidget AddButton(string id, string text)
ButtonWidget AddButton(string id, string label)
{
var button = buttonTemplate.Clone() as ButtonWidget;
var lastButton = buttons.LastOrDefault();
@@ -305,8 +305,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic
button.Id = id;
button.IsDisabled = () => leaving;
var translation = TranslationProvider.GetString(text);
button.GetText = () => translation;
var text = FluentProvider.GetString(label);
button.GetText = () => text;
buttonContainer.AddChild(button);
buttons.Add(button);
@@ -319,8 +319,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic
return;
var button = AddButton("ABORT_MISSION", world.IsGameOver
? TranslationProvider.GetString(Leave)
: TranslationProvider.GetString(AbortMission));
? FluentProvider.GetString(Leave)
: FluentProvider.GetString(AbortMission));
button.OnClick = () =>
{
@@ -494,7 +494,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
ConfirmationDialogs.ButtonPrompt(modData,
title: ErrorMaxPlayerTitle,
text: ErrorMaxPlayerPrompt,
textArguments: Translation.Arguments("players", playerCount, "max", MapPlayers.MaximumPlayerCount),
textArguments: FluentBundle.Arguments("players", playerCount, "max", MapPlayers.MaximumPlayerCount),
onConfirm: ShowMenu,
confirmText: ErrorMaxPlayerAccept);

View File

@@ -18,10 +18,10 @@ namespace OpenRA.Mods.Common.Widgets.Logic
{
public class IngamePowerBarLogic : ChromeLogic
{
[TranslationReference("usage", "capacity")]
[FluentReference("usage", "capacity")]
const string PowerUsage = "label-power-usage";
[TranslationReference]
[FluentReference]
const string Infinite = "label-infinite-power";
[ObjectCreator.UseCtor]
@@ -36,12 +36,12 @@ namespace OpenRA.Mods.Common.Widgets.Logic
powerBar.TooltipTextCached = new CachedTransform<(float Current, float Capacity), string>(usage =>
{
var capacity = developerMode.UnlimitedPower ?
TranslationProvider.GetString(Infinite) :
FluentProvider.GetString(Infinite) :
powerManager.PowerProvided.ToString(NumberFormatInfo.CurrentInfo);
return TranslationProvider.GetString(
return FluentProvider.GetString(
PowerUsage,
Translation.Arguments("usage", usage.Current, "capacity", capacity));
FluentBundle.Arguments("usage", usage.Current, "capacity", capacity));
});
powerBar.GetBarColor = () =>

View File

@@ -18,10 +18,10 @@ namespace OpenRA.Mods.Common.Widgets.Logic
{
public class IngamePowerCounterLogic : ChromeLogic
{
[TranslationReference("usage", "capacity")]
[FluentReference("usage", "capacity")]
const string PowerUsage = "label-power-usage";
[TranslationReference]
[FluentReference]
const string Infinite = "label-infinite-power";
[ObjectCreator.UseCtor]
@@ -32,7 +32,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
var powerManager = world.LocalPlayer.PlayerActor.Trait<PowerManager>();
var power = widget.Get<LabelWithTooltipWidget>("POWER");
var powerIcon = widget.Get<ImageWidget>("POWER_ICON");
var unlimitedCapacity = TranslationProvider.GetString(Infinite);
var unlimitedCapacity = FluentProvider.GetString(Infinite);
powerIcon.GetImageName = () => powerManager.ExcessPower < 0 ? "power-critical" : "power-normal";
power.GetColor = () => powerManager.ExcessPower < 0 ? Color.Red : Color.White;
@@ -41,9 +41,9 @@ namespace OpenRA.Mods.Common.Widgets.Logic
var tooltipTextCached = new CachedTransform<(int, int?), string>(((int Usage, int? Capacity) args) =>
{
var capacity = args.Capacity == null ? unlimitedCapacity : args.Capacity.Value.ToString(NumberFormatInfo.CurrentInfo);
return TranslationProvider.GetString(
return FluentProvider.GetString(
PowerUsage,
Translation.Arguments(
FluentBundle.Arguments(
"usage", args.Usage.ToString(NumberFormatInfo.CurrentInfo),
"capacity", capacity));
});

View File

@@ -17,7 +17,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
{
public class IngameSiloBarLogic : ChromeLogic
{
[TranslationReference("usage", "capacity")]
[FluentReference("usage", "capacity")]
const string SiloUsage = "label-silo-usage";
[ObjectCreator.UseCtor]
@@ -30,9 +30,9 @@ namespace OpenRA.Mods.Common.Widgets.Logic
siloBar.GetUsed = () => playerResources.Resources;
siloBar.TooltipTextCached = new CachedTransform<(float Current, float Capacity), string>(usage =>
{
return TranslationProvider.GetString(
return FluentProvider.GetString(
SiloUsage,
Translation.Arguments("usage", usage.Current, "capacity", usage.Capacity));
FluentBundle.Arguments("usage", usage.Current, "capacity", usage.Capacity));
});
siloBar.GetBarColor = () =>
{

View File

@@ -23,22 +23,22 @@ namespace OpenRA.Mods.Common.Widgets.Logic
[ChromeLogicArgsHotkeys("CombinedViewKey", "WorldViewKey")]
public class ObserverShroudSelectorLogic : ChromeLogic
{
[TranslationReference]
[FluentReference]
const string CameraOptionAllPlayers = "options-shroud-selector.all-players";
[TranslationReference]
[FluentReference]
const string CameraOptionDisableShroud = "options-shroud-selector.disable-shroud";
[TranslationReference]
[FluentReference]
const string CameraOptionOther = "options-shroud-selector.other";
[TranslationReference]
[FluentReference]
const string Players = "label-players";
[TranslationReference("team")]
[FluentReference("team")]
const string TeamNumber = "label-team-name";
[TranslationReference]
[FluentReference]
const string NoTeam = "label-no-team";
readonly CameraOption combined, disableShroud;
@@ -104,10 +104,10 @@ namespace OpenRA.Mods.Common.Widgets.Logic
var groups = new Dictionary<string, IEnumerable<CameraOption>>();
combined = new CameraOption(this, world, TranslationProvider.GetString(CameraOptionAllPlayers), world.Players.First(p => p.InternalName == "Everyone"));
disableShroud = new CameraOption(this, world, TranslationProvider.GetString(CameraOptionDisableShroud), null);
combined = new CameraOption(this, world, FluentProvider.GetString(CameraOptionAllPlayers), world.Players.First(p => p.InternalName == "Everyone"));
disableShroud = new CameraOption(this, world, FluentProvider.GetString(CameraOptionDisableShroud), null);
if (!limitViews)
groups.Add(TranslationProvider.GetString(CameraOptionOther), new List<CameraOption>() { combined, disableShroud });
groups.Add(FluentProvider.GetString(CameraOptionOther), new List<CameraOption>() { combined, disableShroud });
teams = world.Players.Where(p => !p.NonCombatant && p.Playable)
.Select(p => new CameraOption(this, p))
@@ -120,9 +120,9 @@ namespace OpenRA.Mods.Common.Widgets.Logic
foreach (var t in teams)
{
totalPlayers += t.Count();
var label = noTeams ? TranslationProvider.GetString(Players) : t.Key > 0
? TranslationProvider.GetString(TeamNumber, Translation.Arguments("team", t.Key))
: TranslationProvider.GetString(NoTeam);
var label = noTeams ? FluentProvider.GetString(Players) : t.Key > 0
? FluentProvider.GetString(TeamNumber, FluentBundle.Arguments("team", t.Key))
: FluentProvider.GetString(NoTeam);
groups.Add(label, t);
}

View File

@@ -35,37 +35,37 @@ namespace OpenRA.Mods.Common.Widgets.Logic
"StatisticsArmyGraphKey")]
public class ObserverStatsLogic : ChromeLogic
{
[TranslationReference]
[FluentReference]
const string InformationNone = "options-observer-stats.none";
[TranslationReference]
[FluentReference]
const string Basic = "options-observer-stats.basic";
[TranslationReference]
[FluentReference]
const string Economy = "options-observer-stats.economy";
[TranslationReference]
[FluentReference]
const string Production = "options-observer-stats.production";
[TranslationReference]
[FluentReference]
const string SupportPowers = "options-observer-stats.support-powers";
[TranslationReference]
[FluentReference]
const string Combat = "options-observer-stats.combat";
[TranslationReference]
[FluentReference]
const string Army = "options-observer-stats.army";
[TranslationReference]
[FluentReference]
const string EarningsGraph = "options-observer-stats.earnings-graph";
[TranslationReference]
[FluentReference]
const string ArmyGraph = "options-observer-stats.army-graph";
[TranslationReference("team")]
[FluentReference("team")]
const string TeamNumber = "label-team-name";
[TranslationReference]
[FluentReference]
const string NoTeam = "label-no-team";
readonly ContainerWidget basicStatsHeaders;
@@ -155,10 +155,10 @@ namespace OpenRA.Mods.Common.Widgets.Logic
var statsDropDown = widget.Get<DropDownButtonWidget>("STATS_DROPDOWN");
StatsDropDownOption CreateStatsOption(string title, ObserverStatsPanel panel, ScrollItemWidget template, Action a)
{
title = TranslationProvider.GetString(title);
title = FluentProvider.GetString(title);
return new StatsDropDownOption
{
Title = TranslationProvider.GetString(title),
Title = FluentProvider.GetString(title),
IsSelected = () => activePanel == panel,
OnClick = () =>
{
@@ -179,11 +179,11 @@ namespace OpenRA.Mods.Common.Widgets.Logic
{
new()
{
Title = TranslationProvider.GetString(InformationNone),
Title = FluentProvider.GetString(InformationNone),
IsSelected = () => activePanel == ObserverStatsPanel.None,
OnClick = () =>
{
var informationNone = TranslationProvider.GetString(InformationNone);
var informationNone = FluentProvider.GetString(InformationNone);
statsDropDown.GetText = () => informationNone;
playerStatsPanel.Visible = false;
ClearStats();
@@ -286,8 +286,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic
tt.IgnoreMouseOver = true;
var teamLabel = tt.Get<LabelWidget>("TEAM");
var teamText = team.Key > 0 ? TranslationProvider.GetString(TeamNumber, Translation.Arguments("team", team.Key))
: TranslationProvider.GetString(NoTeam);
var teamText = team.Key > 0 ? FluentProvider.GetString(TeamNumber, FluentBundle.Arguments("team", team.Key))
: FluentProvider.GetString(NoTeam);
teamLabel.GetText = () => teamText;
tt.Bounds.Width = teamLabel.Bounds.Width = Game.Renderer.Fonts[tt.Font].Measure(teamText).X;

View File

@@ -20,7 +20,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
{
public class ProductionTooltipLogic : ChromeLogic
{
[TranslationReference("prequisites")]
[FluentReference("prequisites")]
const string Requires = "label-requires";
[ObjectCreator.UseCtor]
@@ -69,7 +69,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
return;
var tooltip = actor.TraitInfos<TooltipInfo>().FirstOrDefault(info => info.EnabledByDefault);
var name = tooltip != null ? TranslationProvider.GetString(tooltip.Name) : actor.Name;
var name = tooltip != null ? FluentProvider.GetString(tooltip.Name) : actor.Name;
var buildable = actor.TraitInfo<BuildableInfo>();
var cost = 0;
@@ -105,7 +105,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
var requiresSize = int2.Zero;
if (prereqs.Count > 0)
{
var requiresText = TranslationProvider.GetString(Requires, Translation.Arguments("prequisites", prereqs.JoinWith(", ")));
var requiresText = FluentProvider.GetString(Requires, FluentBundle.Arguments("prequisites", prereqs.JoinWith(", ")));
requiresLabel.GetText = () => requiresText;
requiresSize = requiresFont.Measure(requiresText);
requiresLabel.Visible = true;
@@ -146,7 +146,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
costLabel.GetColor = () => pr.GetCashAndResources() >= cost ? Color.White : Color.Red;
var costSize = font.Measure(costText);
var desc = string.IsNullOrEmpty(buildable.Description) ? "" : TranslationProvider.GetString(buildable.Description);
var desc = string.IsNullOrEmpty(buildable.Description) ? "" : FluentProvider.GetString(buildable.Description);
descLabel.GetText = () => desc;
var descSize = descFont.Measure(desc);
descLabel.Bounds.Width = descSize.X;
@@ -180,7 +180,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
{
var actorTooltip = ai.TraitInfos<TooltipInfo>().FirstOrDefault(info => info.EnabledByDefault);
if (actorTooltip != null)
return TranslationProvider.GetString(actorTooltip.Name);
return FluentProvider.GetString(actorTooltip.Name);
}
return a;

View File

@@ -18,7 +18,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
{
public class WorldTooltipLogic : ChromeLogic
{
[TranslationReference]
[FluentReference]
const string UnrevealedTerrain = "label-unrevealed-terrain";
[ObjectCreator.UseCtor]
@@ -44,7 +44,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
var extraHeightOnDouble = extras.Bounds.Y;
var extraHeightOnSingle = extraHeightOnDouble - (doubleHeight - singleHeight);
var unrevealedTerrain = TranslationProvider.GetString(UnrevealedTerrain);
var unrevealedTerrain = FluentProvider.GetString(UnrevealedTerrain);
tooltipContainer.BeforeRender = () =>
{

View File

@@ -24,37 +24,37 @@ namespace OpenRA.Mods.Common.Widgets.Logic
{
public class DownloadPackageLogic : ChromeLogic
{
[TranslationReference("title")]
[FluentReference("title")]
const string Downloading = "label-downloading";
[TranslationReference]
[FluentReference]
const string FetchingMirrorList = "label-fetching-mirror-list";
[TranslationReference]
[FluentReference]
const string UnknownHost = "label-unknown-host";
[TranslationReference("host", "received", "suffix")]
[FluentReference("host", "received", "suffix")]
const string DownloadingFrom = "label-downloading-from";
[TranslationReference("host", "received", "total", "suffix", "progress")]
[FluentReference("host", "received", "total", "suffix", "progress")]
const string DownloadingFromProgress = "label-downloading-from-progress";
[TranslationReference]
[FluentReference]
const string VerifyingArchive = "label-verifying-archive";
[TranslationReference]
[FluentReference]
const string ArchiveValidationFailed = "label-archive-validation-failed";
[TranslationReference]
[FluentReference]
const string Extracting = "label-extracting-archive";
[TranslationReference("entry")]
[FluentReference("entry")]
const string ExtractingEntry = "label-extracting-archive-entry";
[TranslationReference]
[FluentReference]
const string ArchiveExtractionFailed = "label-archive-extraction-failed";
[TranslationReference]
[FluentReference]
const string MirrorSelectionFailed = "label-mirror-selection-failed";
static readonly string[] SizeSuffixes = { "bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB" };
@@ -86,7 +86,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
var status = new CachedTransform<string, string>(s => WidgetUtils.TruncateText(s, statusLabel.Bounds.Width, statusFont));
statusLabel.GetText = () => status.Update(getStatusText());
var text = TranslationProvider.GetString(Downloading, Translation.Arguments("title", download.Title));
var text = FluentProvider.GetString(Downloading, FluentBundle.Arguments("title", download.Title));
panel.Get<LabelWidget>("TITLE").GetText = () => text;
ShowDownloadDialog();
@@ -94,7 +94,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
void ShowDownloadDialog()
{
getStatusText = () => TranslationProvider.GetString(FetchingMirrorList);
getStatusText = () => FluentProvider.GetString(FetchingMirrorList);
progressBar.Indeterminate = true;
var retryButton = panel.Get<ButtonWidget>("RETRY_BUTTON");
@@ -108,7 +108,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
var dataTotal = 0.0f;
var mag = 0;
var dataSuffix = "";
var host = downloadHost ?? TranslationProvider.GetString(UnknownHost);
var host = downloadHost ?? FluentProvider.GetString(UnknownHost);
if (total < 0)
{
@@ -116,8 +116,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic
dataReceived = read / (float)(1L << (mag * 10));
dataSuffix = SizeSuffixes[mag];
getStatusText = () => TranslationProvider.GetString(DownloadingFrom,
Translation.Arguments("host", host, "received", $"{dataReceived:0.00}", "suffix", dataSuffix));
getStatusText = () => FluentProvider.GetString(DownloadingFrom,
FluentBundle.Arguments("host", host, "received", $"{dataReceived:0.00}", "suffix", dataSuffix));
progressBar.Indeterminate = true;
}
else
@@ -127,8 +127,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic
dataReceived = read / (float)(1L << (mag * 10));
dataSuffix = SizeSuffixes[mag];
getStatusText = () => TranslationProvider.GetString(DownloadingFromProgress,
Translation.Arguments("host", host, "received", $"{dataReceived:0.00}", "total", $"{dataTotal:0.00}",
getStatusText = () => FluentProvider.GetString(DownloadingFromProgress,
FluentBundle.Arguments("host", host, "received", $"{dataReceived:0.00}", "total", $"{dataTotal:0.00}",
"suffix", dataSuffix, "progress", progressPercentage));
progressBar.Indeterminate = false;
}
@@ -140,7 +140,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
void OnError(string s) => Game.RunAfterTick(() =>
{
var host = downloadHost ?? TranslationProvider.GetString(UnknownHost);
var host = downloadHost ?? FluentProvider.GetString(UnknownHost);
Log.Write("install", $"Download from {host} failed: " + s);
progressBar.Indeterminate = false;
@@ -184,7 +184,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
// Validate integrity
if (!string.IsNullOrEmpty(download.SHA1))
{
getStatusText = () => TranslationProvider.GetString(VerifyingArchive);
getStatusText = () => FluentProvider.GetString(VerifyingArchive);
progressBar.Indeterminate = true;
var archiveValid = false;
@@ -206,13 +206,13 @@ namespace OpenRA.Mods.Common.Widgets.Logic
if (!archiveValid)
{
OnError(TranslationProvider.GetString(ArchiveValidationFailed));
OnError(FluentProvider.GetString(ArchiveValidationFailed));
return;
}
}
// Automatically extract
getStatusText = () => TranslationProvider.GetString(Extracting);
getStatusText = () => FluentProvider.GetString(Extracting);
progressBar.Indeterminate = true;
var extracted = new List<string>();
@@ -232,7 +232,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
continue;
}
OnExtractProgress(TranslationProvider.GetString(ExtractingEntry, Translation.Arguments("entry", kv.Value)));
OnExtractProgress(FluentProvider.GetString(ExtractingEntry, FluentBundle.Arguments("entry", kv.Value)));
Log.Write("install", "Extracting " + kv.Value);
var targetPath = Platform.ResolvePath(kv.Key);
Directory.CreateDirectory(Path.GetDirectoryName(targetPath));
@@ -263,7 +263,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
File.Delete(f);
}
OnError(TranslationProvider.GetString(ArchiveExtractionFailed));
OnError(FluentProvider.GetString(ArchiveExtractionFailed));
}
}
catch (Exception e)
@@ -296,7 +296,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
{
Log.Write("install", "Mirror selection failed with error:");
Log.Write("install", e.ToString());
OnError(TranslationProvider.GetString(MirrorSelectionFailed));
OnError(FluentProvider.GetString(MirrorSelectionFailed));
}
});
}

View File

@@ -22,61 +22,61 @@ namespace OpenRA.Mods.Common.Widgets.Logic
{
public class InstallFromSourceLogic : ChromeLogic
{
[TranslationReference]
[FluentReference]
const string DetectingSources = "label-detecting-sources";
[TranslationReference]
[FluentReference]
const string CheckingSources = "label-checking-sources";
[TranslationReference("title")]
[FluentReference("title")]
const string SearchingSourceFor = "label-searching-source-for";
[TranslationReference]
[FluentReference]
const string ContentPackageInstallation = "label-content-package-installation";
[TranslationReference]
[FluentReference]
const string GameSources = "label-game-sources";
[TranslationReference]
[FluentReference]
const string DigitalInstalls = "label-digital-installs";
[TranslationReference]
[FluentReference]
const string GameContentNotFound = "label-game-content-not-found";
[TranslationReference]
[FluentReference]
const string AlternativeContentSources = "label-alternative-content-sources";
[TranslationReference]
[FluentReference]
const string InstallingContent = "label-installing-content";
[TranslationReference("filename")]
[FluentReference("filename")]
public const string CopyingFilename = "label-copying-filename";
[TranslationReference("filename", "progress")]
[FluentReference("filename", "progress")]
public const string CopyingFilenameProgress = "label-copying-filename-progress";
[TranslationReference]
[FluentReference]
const string InstallationFailed = "label-installation-failed";
[TranslationReference]
[FluentReference]
const string CheckInstallLog = "label-check-install-log";
[TranslationReference("filename")]
[FluentReference("filename")]
public const string Extracing = "label-extracting-filename";
[TranslationReference("filename", "progress")]
[FluentReference("filename", "progress")]
public const string ExtractingProgress = "label-extracting-filename-progress";
[TranslationReference]
[FluentReference]
public const string Continue = "button-continue";
[TranslationReference]
[FluentReference]
const string Cancel = "button-cancel";
[TranslationReference]
[FluentReference]
const string Retry = "button-retry";
[TranslationReference]
[FluentReference]
const string Back = "button-back";
// Hide percentage indicators for files smaller than 25 MB
@@ -160,15 +160,15 @@ namespace OpenRA.Mods.Common.Widgets.Logic
void DetectContentSources()
{
var message = TranslationProvider.GetString(DetectingSources);
ShowProgressbar(TranslationProvider.GetString(CheckingSources), () => message);
var message = FluentProvider.GetString(DetectingSources);
ShowProgressbar(FluentProvider.GetString(CheckingSources), () => message);
ShowBackRetry(DetectContentSources);
new Task(() =>
{
foreach (var kv in sources)
{
message = TranslationProvider.GetString(SearchingSourceFor, Translation.Arguments("title", kv.Value.Title));
message = FluentProvider.GetString(SearchingSourceFor, FluentBundle.Arguments("title", kv.Value.Title));
var sourceResolver = kv.Value.ObjectCreator.CreateObject<ISourceResolver>($"{kv.Value.Type.Value}SourceResolver");
@@ -188,7 +188,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
{
Game.RunAfterTick(() =>
{
ShowList(kv.Value, TranslationProvider.GetString(ContentPackageInstallation));
ShowList(kv.Value, FluentProvider.GetString(ContentPackageInstallation));
ShowContinueCancel(() => InstallFromSource(path, kv.Value));
});
@@ -220,14 +220,14 @@ namespace OpenRA.Mods.Common.Widgets.Logic
var options = new Dictionary<string, IEnumerable<string>>();
if (gameSources.Count != 0)
options.Add(TranslationProvider.GetString(GameSources), gameSources);
options.Add(FluentProvider.GetString(GameSources), gameSources);
if (digitalInstalls.Count != 0)
options.Add(TranslationProvider.GetString(DigitalInstalls), digitalInstalls);
options.Add(FluentProvider.GetString(DigitalInstalls), digitalInstalls);
Game.RunAfterTick(() =>
{
ShowList(TranslationProvider.GetString(GameContentNotFound), TranslationProvider.GetString(AlternativeContentSources), options);
ShowList(FluentProvider.GetString(GameContentNotFound), FluentProvider.GetString(AlternativeContentSources), options);
ShowBackRetry(DetectContentSources);
});
}).Start();
@@ -236,7 +236,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
void InstallFromSource(string path, ModContent.ModSource modSource)
{
var message = "";
ShowProgressbar(TranslationProvider.GetString(InstallingContent), () => message);
ShowProgressbar(FluentProvider.GetString(InstallingContent), () => message);
ShowDisabledCancel();
new Task(() =>
@@ -292,7 +292,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
Game.RunAfterTick(() =>
{
ShowMessage(TranslationProvider.GetString(InstallationFailed), TranslationProvider.GetString(CheckInstallLog));
ShowMessage(FluentProvider.GetString(InstallationFailed), FluentProvider.GetString(CheckInstallLog));
ShowBackRetry(() => InstallFromSource(path, modSource));
});
}
@@ -398,12 +398,12 @@ namespace OpenRA.Mods.Common.Widgets.Logic
void ShowContinueCancel(Action continueAction)
{
primaryButton.OnClick = continueAction;
var primaryButtonText = TranslationProvider.GetString(Continue);
var primaryButtonText = FluentProvider.GetString(Continue);
primaryButton.GetText = () => primaryButtonText;
primaryButton.Visible = true;
secondaryButton.OnClick = Ui.CloseWindow;
var secondaryButtonText = TranslationProvider.GetString(Cancel);
var secondaryButtonText = FluentProvider.GetString(Cancel);
secondaryButton.GetText = () => secondaryButtonText;
secondaryButton.Visible = true;
secondaryButton.Disabled = false;
@@ -413,12 +413,12 @@ namespace OpenRA.Mods.Common.Widgets.Logic
void ShowBackRetry(Action retryAction)
{
primaryButton.OnClick = retryAction;
var primaryButtonText = TranslationProvider.GetString(Retry);
var primaryButtonText = FluentProvider.GetString(Retry);
primaryButton.GetText = () => primaryButtonText;
primaryButton.Visible = true;
secondaryButton.OnClick = Ui.CloseWindow;
var secondaryButtonText = TranslationProvider.GetString(Back);
var secondaryButtonText = FluentProvider.GetString(Back);
secondaryButton.GetText = () => secondaryButtonText;
secondaryButton.Visible = true;
secondaryButton.Disabled = false;

View File

@@ -20,7 +20,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
{
public class ModContentLogic : ChromeLogic
{
[TranslationReference]
[FluentReference]
const string ManualInstall = "button-manual-install";
readonly ModContent content;
@@ -144,7 +144,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
requiresSourceWidget.IsVisible = () => !installed && !downloadEnabled;
if (!isSourceAvailable)
{
var manualInstall = TranslationProvider.GetString(ManualInstall);
var manualInstall = FluentProvider.GetString(ManualInstall);
requiresSourceWidget.GetText = () => manualInstall;
}

View File

@@ -20,10 +20,10 @@ namespace OpenRA.Mods.Common.Widgets.Logic
{
public class ModContentPromptLogic : ChromeLogic
{
[TranslationReference]
[FluentReference]
const string Continue = "button-continue";
[TranslationReference]
[FluentReference]
const string Quit = "button-quit";
readonly ModContent content;
@@ -35,8 +35,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic
this.content = content;
CheckRequiredContentInstalled();
var continueMessage = TranslationProvider.GetString(Continue);
var quitMessage = TranslationProvider.GetString(Quit);
var continueMessage = FluentProvider.GetString(Continue);
var quitMessage = FluentProvider.GetString(Quit);
var panel = widget.Get("CONTENT_PROMPT_PANEL");
var headerTemplate = panel.Get<LabelWidget>("HEADER_TEMPLATE");

View File

@@ -22,10 +22,10 @@ namespace OpenRA.Mods.Common.Widgets.Logic
// Increment the version number when adding new stats
const int IntroductionVersion = 1;
[TranslationReference]
[FluentReference]
const string Classic = "options-control-scheme.classic";
[TranslationReference]
[FluentReference]
const string Modern = "options-control-scheme.modern";
readonly string classic;
@@ -43,8 +43,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic
var ds = Game.Settings.Graphics;
var gs = Game.Settings.Game;
classic = TranslationProvider.GetString(Classic);
modern = TranslationProvider.GetString(Modern);
classic = FluentProvider.GetString(Classic);
modern = FluentProvider.GetString(Modern);
var escPressed = false;
var nameTextfield = widget.Get<TextFieldWidget>("PLAYERNAME");

View File

@@ -16,13 +16,13 @@ namespace OpenRA.Mods.Common.Widgets.Logic
{
sealed class KickClientLogic : ChromeLogic
{
[TranslationReference("player")]
[FluentReference("player")]
const string KickClient = "dialog-kick-client.prompt";
[ObjectCreator.UseCtor]
public KickClientLogic(Widget widget, string clientName, Action<bool> okPressed, Action cancelPressed)
{
var kickMessage = TranslationProvider.GetString(KickClient, Translation.Arguments("player", clientName));
var kickMessage = FluentProvider.GetString(KickClient, FluentBundle.Arguments("player", clientName));
widget.Get<LabelWidget>("TITLE").GetText = () => kickMessage;
var tempBan = false;

View File

@@ -16,13 +16,13 @@ namespace OpenRA.Mods.Common.Widgets.Logic
{
sealed class KickSpectatorsLogic : ChromeLogic
{
[TranslationReference("count")]
[FluentReference("count")]
const string KickSpectators = "dialog-kick-spectators.prompt";
[ObjectCreator.UseCtor]
public KickSpectatorsLogic(Widget widget, int clientCount, Action okPressed, Action cancelPressed)
{
var kickMessage = TranslationProvider.GetString(KickSpectators, Translation.Arguments("count", clientCount));
var kickMessage = FluentProvider.GetString(KickSpectators, FluentBundle.Arguments("count", clientCount));
widget.Get<LabelWidget>("TEXT").GetText = () => kickMessage;
widget.Get<ButtonWidget>("OK_BUTTON").OnClick = () =>

View File

@@ -23,40 +23,40 @@ namespace OpenRA.Mods.Common.Widgets.Logic
{
public class LobbyLogic : ChromeLogic, INotificationHandler<TextNotification>
{
[TranslationReference]
[FluentReference]
const string Add = "options-slot-admin.add-bots";
[TranslationReference]
[FluentReference]
const string Remove = "options-slot-admin.remove-bots";
[TranslationReference]
[FluentReference]
const string ConfigureBots = "options-slot-admin.configure-bots";
[TranslationReference("count")]
[FluentReference("count")]
const string NumberTeams = "options-slot-admin.teams-count";
[TranslationReference]
[FluentReference]
const string HumanVsBots = "options-slot-admin.humans-vs-bots";
[TranslationReference]
[FluentReference]
const string FreeForAll = "options-slot-admin.free-for-all";
[TranslationReference]
[FluentReference]
const string ConfigureTeams = "options-slot-admin.configure-teams";
[TranslationReference]
[FluentReference]
const string Back = "button-back";
[TranslationReference]
[FluentReference]
const string TeamChat = "button-team-chat";
[TranslationReference]
[FluentReference]
const string GeneralChat = "button-general-chat";
[TranslationReference("seconds")]
[FluentReference("seconds")]
const string ChatAvailability = "label-chat-availability";
[TranslationReference]
[FluentReference]
const string ChatDisabled = "label-chat-disabled";
static readonly Action DoNothing = () => { };
@@ -282,7 +282,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
{
new()
{
Title = TranslationProvider.GetString(Add),
Title = FluentProvider.GetString(Add),
IsSelected = () => false,
OnClick = () =>
{
@@ -301,7 +301,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
{
botOptions.Add(new DropDownOption()
{
Title = TranslationProvider.GetString(Remove),
Title = FluentProvider.GetString(Remove),
IsSelected = () => false,
OnClick = () =>
{
@@ -315,7 +315,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
});
}
options.Add(TranslationProvider.GetString(ConfigureBots), botOptions);
options.Add(FluentProvider.GetString(ConfigureBots), botOptions);
}
var teamCount = (orderManager.LobbyInfo.Slots.Count(s => !s.Value.LockTeam && orderManager.LobbyInfo.ClientInSlot(s.Key) != null) + 1) / 2;
@@ -323,7 +323,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
{
var teamOptions = Enumerable.Range(2, teamCount - 1).Reverse().Select(d => new DropDownOption
{
Title = TranslationProvider.GetString(NumberTeams, Translation.Arguments("count", d)),
Title = FluentProvider.GetString(NumberTeams, FluentBundle.Arguments("count", d)),
IsSelected = () => false,
OnClick = () => orderManager.IssueOrder(Order.Command($"assignteams {d}"))
}).ToList();
@@ -332,7 +332,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
{
teamOptions.Add(new DropDownOption
{
Title = TranslationProvider.GetString(HumanVsBots),
Title = FluentProvider.GetString(HumanVsBots),
IsSelected = () => false,
OnClick = () => orderManager.IssueOrder(Order.Command("assignteams 1"))
});
@@ -340,12 +340,12 @@ namespace OpenRA.Mods.Common.Widgets.Logic
teamOptions.Add(new DropDownOption
{
Title = TranslationProvider.GetString(FreeForAll),
Title = FluentProvider.GetString(FreeForAll),
IsSelected = () => false,
OnClick = () => orderManager.IssueOrder(Order.Command("assignteams 0"))
});
options.Add(TranslationProvider.GetString(ConfigureTeams), teamOptions);
options.Add(FluentProvider.GetString(ConfigureTeams), teamOptions);
}
ScrollItemWidget SetupItem(DropDownOption option, ScrollItemWidget template)
@@ -483,7 +483,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
if (skirmishMode)
{
var disconnectButtonText = TranslationProvider.GetString(Back);
var disconnectButtonText = FluentProvider.GetString(Back);
disconnectButton.GetText = () => disconnectButtonText;
}
@@ -497,8 +497,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic
}
var chatMode = lobby.Get<ButtonWidget>("CHAT_MODE");
var team = TranslationProvider.GetString(TeamChat);
var all = TranslationProvider.GetString(GeneralChat);
var team = FluentProvider.GetString(TeamChat);
var all = FluentProvider.GetString(GeneralChat);
chatMode.GetText = () => teamChat ? team : all;
chatMode.OnClick = () => teamChat ^= true;
chatMode.IsDisabled = () => disableTeamChat || !chatEnabled;
@@ -539,8 +539,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic
chatTextField.OnEscKey = _ => chatTextField.YieldKeyboardFocus();
chatAvailableIn = new CachedTransform<int, string>(x => TranslationProvider.GetString(ChatAvailability, Translation.Arguments("seconds", x)));
chatDisabled = TranslationProvider.GetString(ChatDisabled);
chatAvailableIn = new CachedTransform<int, string>(x => FluentProvider.GetString(ChatAvailability, FluentBundle.Arguments("seconds", x)));
chatDisabled = FluentProvider.GetString(ChatDisabled);
lobbyChatPanel = lobby.Get<ScrollPanelWidget>("CHAT_DISPLAY");
lobbyChatPanel.RemoveChildren();

View File

@@ -21,7 +21,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
{
public class LobbyOptionsLogic : ChromeLogic
{
[TranslationReference]
[FluentReference]
const string NotAvailable = "label-not-available";
readonly ScrollPanelWidget panel;
@@ -146,7 +146,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
var getOptionLabel = new CachedTransform<string, string>(id =>
{
if (id == null || !option.Values.TryGetValue(id, out var value))
return TranslationProvider.GetString(NotAvailable);
return FluentProvider.GetString(NotAvailable);
return value;
});

View File

@@ -24,19 +24,19 @@ namespace OpenRA.Mods.Common.Widgets.Logic
{
public static class LobbyUtils
{
[TranslationReference]
[FluentReference]
const string Open = "options-lobby-slot.open";
[TranslationReference]
[FluentReference]
const string Closed = "options-lobby-slot.closed";
[TranslationReference]
[FluentReference]
const string Bots = "options-lobby-slot.bots";
[TranslationReference]
[FluentReference]
const string BotsDisabled = "options-lobby-slot.bots-disabled";
[TranslationReference]
[FluentReference]
const string Slot = "options-lobby-slot.slot";
sealed class SlotDropDownOption
@@ -56,12 +56,12 @@ namespace OpenRA.Mods.Common.Widgets.Logic
public static void ShowSlotDropDown(DropDownButtonWidget dropdown, Session.Slot slot,
Session.Client client, OrderManager orderManager, MapPreview map, ModData modData)
{
var open = TranslationProvider.GetString(Open);
var closed = TranslationProvider.GetString(Closed);
var open = FluentProvider.GetString(Open);
var closed = FluentProvider.GetString(Closed);
var options = new Dictionary<string, IEnumerable<SlotDropDownOption>>
{
{
TranslationProvider.GetString(Slot), new List<SlotDropDownOption>
FluentProvider.GetString(Slot), new List<SlotDropDownOption>
{
new(open, "slot_open " + slot.PlayerReference, () => !slot.Closed && client == null),
new(closed, "slot_close " + slot.PlayerReference, () => slot.Closed)
@@ -75,13 +75,13 @@ namespace OpenRA.Mods.Common.Widgets.Logic
foreach (var b in map.PlayerActorInfo.TraitInfos<IBotInfo>())
{
var botController = orderManager.LobbyInfo.Clients.FirstOrDefault(c => c.IsAdmin);
bots.Add(new SlotDropDownOption(TranslationProvider.GetString(b.Name),
bots.Add(new SlotDropDownOption(FluentProvider.GetString(b.Name),
$"slot_bot {slot.PlayerReference} {botController.Index} {b.Type}",
() => client != null && client.Bot == b.Type));
}
}
options.Add(bots.Count > 0 ? TranslationProvider.GetString(Bots) : TranslationProvider.GetString(BotsDisabled), bots);
options.Add(bots.Count > 0 ? FluentProvider.GetString(Bots) : FluentProvider.GetString(BotsDisabled), bots);
ScrollItemWidget SetupItem(SlotDropDownOption o, ScrollItemWidget itemTemplate)
{
@@ -222,14 +222,14 @@ namespace OpenRA.Mods.Common.Widgets.Logic
var faction = factions[factionId];
var label = item.Get<LabelWidget>("LABEL");
var labelText = WidgetUtils.TruncateText(TranslationProvider.GetString(faction.Name), label.Bounds.Width, Game.Renderer.Fonts[label.Font]);
var labelText = WidgetUtils.TruncateText(FluentProvider.GetString(faction.Name), label.Bounds.Width, Game.Renderer.Fonts[label.Font]);
label.GetText = () => labelText;
var flag = item.Get<ImageWidget>("FLAG");
flag.GetImageCollection = () => "flags";
flag.GetImageName = () => factionId;
var description = faction.Description != null ? TranslationProvider.GetString(faction.Description) : null;
var description = faction.Description != null ? FluentProvider.GetString(faction.Description) : null;
var (text, desc) = SplitOnFirstToken(description);
item.GetTooltipText = () => text;
item.GetTooltipDesc = () => desc;
@@ -238,7 +238,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
}
var options = factions.Where(f => f.Value.Selectable).GroupBy(f => f.Value.Side)
.ToDictionary(g => g.Key != null ? TranslationProvider.GetString(g.Key) : "", g => g.Select(f => TranslationProvider.GetString(f.Key)));
.ToDictionary(g => g.Key != null ? FluentProvider.GetString(g.Key) : "", g => g.Select(f => FluentProvider.GetString(f.Key)));
dropdown.ShowDropDown("FACTION_DROPDOWN_TEMPLATE", 154, options, SetupItem);
}
@@ -430,7 +430,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
var label = parent.Get<LabelWidget>("NAME");
label.IsVisible = () => true;
var font = Game.Renderer.Fonts[label.Font];
var name = c.IsBot ? TranslationProvider.GetString(c.Name) : c.Name;
var name = c.IsBot ? FluentProvider.GetString(c.Name) : c.Name;
var text = WidgetUtils.TruncateText(name, label.Bounds.Width, font);
label.GetText = () => text;
@@ -448,10 +448,10 @@ namespace OpenRA.Mods.Common.Widgets.Logic
WidgetUtils.TruncateText(name, slot.Bounds.Width - slot.Bounds.Height - slot.LeftMargin - slot.RightMargin,
Game.Renderer.Fonts[slot.Font]));
var closed = TranslationProvider.GetString(Closed);
var open = TranslationProvider.GetString(Open);
var closed = FluentProvider.GetString(Closed);
var open = FluentProvider.GetString(Open);
slot.GetText = () => truncated.Update(c != null ?
c.IsBot ? TranslationProvider.GetString(c.Name) : c.Name
c.IsBot ? FluentProvider.GetString(c.Name) : c.Name
: s.Closed ? closed : open);
slot.OnMouseDown = _ => ShowSlotDropDown(slot, s, c, orderManager, map, modData);
@@ -465,8 +465,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic
var name = parent.Get<LabelWidget>("NAME");
name.IsVisible = () => true;
name.GetText = () => c != null ? c.Name : s.Closed
? TranslationProvider.GetString(Closed)
: TranslationProvider.GetString(Open);
? FluentProvider.GetString(Closed)
: FluentProvider.GetString(Open);
// Ensure Slot selector (if present) is hidden
HideChildWidget(parent, "SLOT_OPTIONS");
@@ -564,7 +564,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
dropdown.IsDisabled = () => s.LockFaction || orderManager.LocalClient.IsReady;
dropdown.OnMouseDown = _ => ShowFactionDropDown(dropdown, c, orderManager, factions);
var description = factions[c.Faction].Description != null ? TranslationProvider.GetString(factions[c.Faction].Description) : null;
var description = factions[c.Faction].Description != null ? FluentProvider.GetString(factions[c.Faction].Description) : null;
var (text, desc) = SplitOnFirstToken(description);
dropdown.GetTooltipText = () => text;
dropdown.GetTooltipDesc = () => desc;
@@ -577,7 +577,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
var factionName = parent.Get<LabelWidget>("FACTIONNAME");
var font = Game.Renderer.Fonts[factionName.Font];
var truncated = new CachedTransform<string, string>(clientFaction =>
WidgetUtils.TruncateText(TranslationProvider.GetString(factions[clientFaction].Name), factionName.Bounds.Width, font));
WidgetUtils.TruncateText(FluentProvider.GetString(factions[clientFaction].Name), factionName.Bounds.Width, font));
factionName.GetText = () => truncated.Update(c.Faction);
var factionFlag = parent.Get<ImageWidget>("FACTIONFLAG");

View File

@@ -20,22 +20,22 @@ namespace OpenRA.Mods.Common.Widgets.Logic
{
public class MapPreviewLogic : ChromeLogic
{
[TranslationReference]
[FluentReference]
const string Connecting = "label-connecting";
[TranslationReference("size")]
[FluentReference("size")]
const string Downloading = "label-downloading-map";
[TranslationReference("size", "progress")]
[FluentReference("size", "progress")]
const string DownloadingPercentage = "label-downloading-map-progress";
[TranslationReference]
[FluentReference]
const string RetryInstall = "button-retry-install";
[TranslationReference]
[FluentReference]
const string RetrySearch = "button-retry-search";
[TranslationReference("author")]
[FluentReference("author")]
const string CreatedBy = "label-created-by";
readonly int blinkTickLength = 10;
@@ -106,7 +106,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
}
var authorCache = new CachedTransform<string, string>(
text => TranslationProvider.GetString(CreatedBy, Translation.Arguments("author", text)));
text => FluentProvider.GetString(CreatedBy, FluentBundle.Arguments("author", text)));
Widget SetupAuthorAndMapType(Widget parent)
{
@@ -165,13 +165,13 @@ namespace OpenRA.Mods.Common.Widgets.Logic
{
var (map, _) = getMap();
if (map.DownloadBytes == 0)
return TranslationProvider.GetString(Connecting);
return FluentProvider.GetString(Connecting);
// Server does not provide the total file length.
if (map.DownloadPercentage == 0)
return TranslationProvider.GetString(Downloading, Translation.Arguments("size", map.DownloadBytes / 1024));
return FluentProvider.GetString(Downloading, FluentBundle.Arguments("size", map.DownloadBytes / 1024));
return TranslationProvider.GetString(DownloadingPercentage, Translation.Arguments("size", map.DownloadBytes / 1024, "progress", map.DownloadPercentage));
return FluentProvider.GetString(DownloadingPercentage, FluentBundle.Arguments("size", map.DownloadBytes / 1024, "progress", map.DownloadPercentage));
};
return parent;
@@ -198,8 +198,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic
modData.MapCache.QueryRemoteMapDetails(mapRepository, new[] { map.Uid });
};
var retryInstall = TranslationProvider.GetString(RetryInstall);
var retrySearch = TranslationProvider.GetString(RetrySearch);
var retryInstall = FluentProvider.GetString(RetryInstall);
var retrySearch = FluentProvider.GetString(RetrySearch);
retryButton.GetText = () => getMap().Map.Status == MapStatus.DownloadError ? retryInstall : retrySearch;
var previewLarge = SetupMapPreview(widget.Get("MAP_LARGE"));

View File

@@ -18,13 +18,13 @@ namespace OpenRA.Mods.Common.Widgets.Logic
{
public class SpawnSelectorTooltipLogic : ChromeLogic
{
[TranslationReference]
[FluentReference]
const string DisabledSpawn = "label-disabled-spawn";
[TranslationReference]
[FluentReference]
const string AvailableSpawn = "label-available-spawn";
[TranslationReference("team")]
[FluentReference("team")]
const string TeamNumber = "label-team-name";
readonly CachedTransform<int, string> teamMessage;
@@ -49,9 +49,9 @@ namespace OpenRA.Mods.Common.Widgets.Logic
var labelText = "";
string playerFaction = null;
var playerTeam = -1;
teamMessage = new CachedTransform<int, string>(t => TranslationProvider.GetString(TeamNumber, Translation.Arguments("team", t)));
var disabledSpawn = TranslationProvider.GetString(DisabledSpawn);
var availableSpawn = TranslationProvider.GetString(AvailableSpawn);
teamMessage = new CachedTransform<int, string>(t => FluentProvider.GetString(TeamNumber, FluentBundle.Arguments("team", t)));
var disabledSpawn = FluentProvider.GetString(DisabledSpawn);
var availableSpawn = FluentProvider.GetString(AvailableSpawn);
tooltipContainer.BeforeRender = () =>
{

View File

@@ -23,16 +23,16 @@ namespace OpenRA.Mods.Common.Widgets.Logic
{
public class MainMenuLogic : ChromeLogic
{
[TranslationReference]
[FluentReference]
const string LoadingNews = "label-loading-news";
[TranslationReference("message")]
[FluentReference("message")]
const string NewsRetrivalFailed = "label-news-retrieval-failed";
[TranslationReference("message")]
[FluentReference("message")]
const string NewsParsingFailed = "label-news-parsing-failed";
[TranslationReference("author", "datetime")]
[FluentReference("author", "datetime")]
const string AuthorDateTime = "label-author-datetime";
protected enum MenuType { Main, Singleplayer, Extras, MapEditor, StartupPrompts, None }
@@ -234,7 +234,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
newsPanel.RemoveChild(newsTemplate);
newsStatus = newsPanel.Get<LabelWidget>("NEWS_STATUS");
SetNewsStatus(TranslationProvider.GetString(LoadingNews));
SetNewsStatus(FluentProvider.GetString(LoadingNews));
}
Game.OnRemoteDirectConnect += OnRemoteDirectConnect;
@@ -346,7 +346,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
catch (Exception e)
{
Game.RunAfterTick(() => // run on the main thread
SetNewsStatus(TranslationProvider.GetString(NewsRetrivalFailed, Translation.Arguments("message", e.Message))));
SetNewsStatus(FluentProvider.GetString(NewsRetrivalFailed, FluentBundle.Arguments("message", e.Message))));
}
});
}
@@ -417,7 +417,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
}
catch (Exception ex)
{
SetNewsStatus(TranslationProvider.GetString(NewsParsingFailed, Translation.Arguments("message", ex.Message)));
SetNewsStatus(FluentProvider.GetString(NewsParsingFailed, FluentBundle.Arguments("message", ex.Message)));
}
return null;
@@ -438,7 +438,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
titleLabel.GetText = () => item.Title;
var authorDateTimeLabel = newsItem.Get<LabelWidget>("AUTHOR_DATETIME");
var authorDateTime = TranslationProvider.GetString(AuthorDateTime, Translation.Arguments(
var authorDateTime = FluentProvider.GetString(AuthorDateTime, FluentBundle.Arguments(
"author", item.Author,
"datetime", item.DateTime.ToLocalTime().ToString(CultureInfo.CurrentCulture)));

View File

@@ -19,67 +19,67 @@ namespace OpenRA.Mods.Common.Widgets.Logic
{
public class MapChooserLogic : ChromeLogic
{
[TranslationReference]
[FluentReference]
const string AllMaps = "label-all-maps";
[TranslationReference]
[FluentReference]
const string NoMatches = "label-no-matches";
[TranslationReference("players")]
[FluentReference("players")]
const string Players = "label-player-count";
[TranslationReference("author")]
[FluentReference("author")]
const string CreatedBy = "label-created-by";
[TranslationReference]
[FluentReference]
const string MapSizeHuge = "label-map-size-huge";
[TranslationReference]
[FluentReference]
const string MapSizeLarge = "label-map-size-large";
[TranslationReference]
[FluentReference]
const string MapSizeMedium = "label-map-size-medium";
[TranslationReference]
[FluentReference]
const string MapSizeSmall = "label-map-size-small";
[TranslationReference("count")]
[FluentReference("count")]
const string MapSearchingCount = "label-map-searching-count";
[TranslationReference("count")]
[FluentReference("count")]
const string MapUnavailableCount = "label-map-unavailable-count";
[TranslationReference("map")]
[FluentReference("map")]
const string MapDeletionFailed = "notification-map-deletion-failed";
[TranslationReference]
[FluentReference]
const string DeleteMapTitle = "dialog-delete-map.title";
[TranslationReference("title")]
[FluentReference("title")]
const string DeleteMapPrompt = "dialog-delete-map.prompt";
[TranslationReference]
[FluentReference]
const string DeleteMapAccept = "dialog-delete-map.confirm";
[TranslationReference]
[FluentReference]
const string DeleteAllMapsTitle = "dialog-delete-all-maps.title";
[TranslationReference]
[FluentReference]
const string DeleteAllMapsPrompt = "dialog-delete-all-maps.prompt";
[TranslationReference]
[FluentReference]
const string DeleteAllMapsAccept = "dialog-delete-all-maps.confirm";
[TranslationReference]
[FluentReference]
const string OrderMapsByPlayers = "options-order-maps.player-count";
[TranslationReference]
[FluentReference]
const string OrderMapsByTitle = "options-order-maps.title";
[TranslationReference]
[FluentReference]
const string OrderMapsByDate = "options-order-maps.date";
[TranslationReference]
[FluentReference]
const string OrderMapsBySize = "options-order-maps.size";
readonly string allMaps;
@@ -117,7 +117,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
this.onSelect = onSelect;
this.remoteMapPool = remoteMapPool;
allMaps = TranslationProvider.GetString(AllMaps);
allMaps = FluentProvider.GetString(AllMaps);
var approving = new Action(() =>
{
@@ -205,9 +205,9 @@ namespace OpenRA.Mods.Common.Widgets.Logic
var remoteMapText = new CachedTransform<(int Searching, int Unavailable), string>(counts =>
{
if (counts.Searching > 0)
return TranslationProvider.GetString(MapSearchingCount, Translation.Arguments("count", counts.Searching));
return FluentProvider.GetString(MapSearchingCount, FluentBundle.Arguments("count", counts.Searching));
return TranslationProvider.GetString(MapUnavailableCount, Translation.Arguments("count", counts.Unavailable));
return FluentProvider.GetString(MapUnavailableCount, FluentBundle.Arguments("count", counts.Unavailable));
});
remoteMapLabel.IsVisible = () => remoteMapPool != null && (remoteSearching > 0 || remoteUnavailable > 0);
@@ -359,7 +359,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
{
var item = categories.FirstOrDefault(m => m.Category == category);
if (item == default((string, int)))
item.Category = TranslationProvider.GetString(NoMatches);
item.Category = FluentProvider.GetString(NoMatches);
return ShowItem(item);
};
@@ -372,14 +372,14 @@ namespace OpenRA.Mods.Common.Widgets.Logic
if (orderByDropdown == null)
return;
var orderByPlayer = TranslationProvider.GetString(OrderMapsByPlayers);
var orderByPlayer = FluentProvider.GetString(OrderMapsByPlayers);
var orderByDict = new Dictionary<string, Func<MapPreview, long>>()
{
{ orderByPlayer, m => m.PlayerCount },
{ TranslationProvider.GetString(OrderMapsByTitle), null },
{ TranslationProvider.GetString(OrderMapsByDate), m => -m.ModifiedDate.Ticks },
{ TranslationProvider.GetString(OrderMapsBySize), m => m.Bounds.Width * m.Bounds.Height },
{ FluentProvider.GetString(OrderMapsByTitle), null },
{ FluentProvider.GetString(OrderMapsByDate), m => -m.ModifiedDate.Ticks },
{ FluentProvider.GetString(OrderMapsBySize), m => m.Bounds.Width * m.Bounds.Height },
};
orderByFunc = orderByDict[orderByPlayer];
@@ -458,23 +458,23 @@ namespace OpenRA.Mods.Common.Widgets.Logic
if (type != null)
details = type + " ";
details += TranslationProvider.GetString(Players, Translation.Arguments("players", preview.PlayerCount));
details += FluentProvider.GetString(Players, FluentBundle.Arguments("players", preview.PlayerCount));
detailsWidget.GetText = () => details;
}
var authorWidget = item.GetOrNull<LabelWithTooltipWidget>("AUTHOR");
if (authorWidget != null && !string.IsNullOrEmpty(preview.Author))
WidgetUtils.TruncateLabelToTooltip(authorWidget, TranslationProvider.GetString(CreatedBy, Translation.Arguments("author", preview.Author)));
WidgetUtils.TruncateLabelToTooltip(authorWidget, FluentProvider.GetString(CreatedBy, FluentBundle.Arguments("author", preview.Author)));
var sizeWidget = item.GetOrNull<LabelWidget>("SIZE");
if (sizeWidget != null)
{
var size = preview.Bounds.Width + "x" + preview.Bounds.Height;
var numberPlayableCells = preview.Bounds.Width * preview.Bounds.Height;
if (numberPlayableCells >= 120 * 120) size += " " + TranslationProvider.GetString(MapSizeHuge);
else if (numberPlayableCells >= 90 * 90) size += " " + TranslationProvider.GetString(MapSizeLarge);
else if (numberPlayableCells >= 60 * 60) size += " " + TranslationProvider.GetString(MapSizeMedium);
else size += " " + TranslationProvider.GetString(MapSizeSmall);
if (numberPlayableCells >= 120 * 120) size += " " + FluentProvider.GetString(MapSizeHuge);
else if (numberPlayableCells >= 90 * 90) size += " " + FluentProvider.GetString(MapSizeLarge);
else if (numberPlayableCells >= 60 * 60) size += " " + FluentProvider.GetString(MapSizeMedium);
else size += " " + FluentProvider.GetString(MapSizeSmall);
sizeWidget.GetText = () => size;
}
@@ -502,7 +502,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
}
catch (Exception ex)
{
TextNotificationsManager.Debug(TranslationProvider.GetString(MapDeletionFailed, Translation.Arguments("map", map)));
TextNotificationsManager.Debug(FluentProvider.GetString(MapDeletionFailed, FluentBundle.Arguments("map", map)));
Log.Write("debug", ex.ToString());
}
@@ -514,7 +514,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
ConfirmationDialogs.ButtonPrompt(modData,
title: DeleteMapTitle,
text: DeleteMapPrompt,
textArguments: Translation.Arguments("title", modData.MapCache[map].Title),
textArguments: FluentBundle.Arguments("title", modData.MapCache[map].Title),
onConfirm: () =>
{
var newUid = DeleteMap(map);

View File

@@ -27,25 +27,25 @@ namespace OpenRA.Mods.Common.Widgets.Logic
enum PlayingVideo { None, Info, Briefing, GameStart }
enum PanelType { MissionInfo, Options }
[TranslationReference]
[FluentReference]
const string NoVideoTitle = "dialog-no-video.title";
[TranslationReference]
[FluentReference]
const string NoVideoPrompt = "dialog-no-video.prompt";
[TranslationReference]
[FluentReference]
const string NoVideoCancel = "dialog-no-video.cancel";
[TranslationReference]
[FluentReference]
const string CantPlayTitle = "dialog-cant-play-video.title";
[TranslationReference]
[FluentReference]
const string CantPlayPrompt = "dialog-cant-play-video.prompt";
[TranslationReference]
[FluentReference]
const string CantPlayCancel = "dialog-cant-play-video.cancel";
[TranslationReference]
[FluentReference]
const string NotAvailable = "label-not-available";
readonly ModData modData;
@@ -386,7 +386,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
if (option.Values.TryGetValue(missionOptions[option.Id], out var value))
return value;
return TranslationProvider.GetString(NotAvailable);
return FluentProvider.GetString(NotAvailable);
};
if (option.Description != null)

View File

@@ -18,10 +18,10 @@ namespace OpenRA.Mods.Common.Widgets.Logic
{
public class MusicPlayerLogic : ChromeLogic
{
[TranslationReference]
[FluentReference]
const string SoundMuted = "label-sound-muted";
[TranslationReference]
[FluentReference]
const string NoSongPlaying = "label-no-song-playing";
readonly ScrollPanelWidget musicList;
@@ -49,7 +49,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
panel.Get<LabelWidget>("MUTE_LABEL").GetText = () =>
{
if (Game.Settings.Sound.Mute)
return TranslationProvider.GetString(SoundMuted);
return FluentProvider.GetString(SoundMuted);
return "";
};
@@ -101,7 +101,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
return $"{minutes:D2}:{seconds:D2} / {totalMinutes:D2}:{totalSeconds:D2}";
};
var noSongPlaying = TranslationProvider.GetString(NoSongPlaying);
var noSongPlaying = FluentProvider.GetString(NoSongPlaying);
var musicTitle = panel.GetOrNull<LabelWidget>("TITLE_LABEL");
if (musicTitle != null)
musicTitle.GetText = () => currentSong != null ? currentSong.Title : noSongPlaying;

View File

@@ -18,10 +18,10 @@ namespace OpenRA.Mods.Common.Widgets.Logic
[ChromeLogicArgsHotkeys("MuteAudioKey")]
public class MuteHotkeyLogic : SingleHotkeyBaseLogic
{
[TranslationReference]
[FluentReference]
const string AudioMuted = "label-audio-muted";
[TranslationReference]
[FluentReference]
const string AudioUnmuted = "label-audio-unmuted";
[ObjectCreator.UseCtor]
@@ -35,12 +35,12 @@ namespace OpenRA.Mods.Common.Widgets.Logic
if (Game.Settings.Sound.Mute)
{
Game.Sound.MuteAudio();
TextNotificationsManager.AddFeedbackLine(TranslationProvider.GetString(AudioMuted));
TextNotificationsManager.AddFeedbackLine(FluentProvider.GetString(AudioMuted));
}
else
{
Game.Sound.UnmuteAudio();
TextNotificationsManager.AddFeedbackLine(TranslationProvider.GetString(AudioUnmuted));
TextNotificationsManager.AddFeedbackLine(FluentProvider.GetString(AudioUnmuted));
}
return true;

View File

@@ -128,10 +128,10 @@ namespace OpenRA.Mods.Common.Widgets.Logic
public class RegisteredProfileTooltipLogic : ChromeLogic
{
[TranslationReference]
[FluentReference]
const string LoadingPlayerProfile = "label-loading-player-profile";
[TranslationReference]
[FluentReference]
const string LoadingPlayerProfileFailed = "label-loading-player-profile-failed";
readonly PlayerDatabase playerDatabase;
@@ -157,7 +157,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
var profileWidth = 0;
var maxProfileWidth = widget.Bounds.Width;
var messageText = TranslationProvider.GetString(LoadingPlayerProfile);
var messageText = FluentProvider.GetString(LoadingPlayerProfile);
var messageWidth = messageFont.Measure(messageText).X + 2 * message.Bounds.Left;
Task.Run(async () =>
@@ -247,7 +247,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
{
if (profile == null)
{
messageText = TranslationProvider.GetString(LoadingPlayerProfileFailed);
messageText = FluentProvider.GetString(LoadingPlayerProfileFailed);
messageWidth = messageFont.Measure(messageText).X + 2 * message.Bounds.Left;
header.Bounds.Width = widget.Bounds.Width = messageWidth;
}
@@ -355,7 +355,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
public class BotTooltipLogic : ChromeLogic
{
[TranslationReference("name")]
[FluentReference("name")]
const string BotManagedBy = "label-bot-managed-by-tooltip";
[ObjectCreator.UseCtor]
@@ -365,7 +365,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
var nameFont = Game.Renderer.Fonts[nameLabel.Font];
var controller = orderManager.LobbyInfo.Clients.FirstOrDefault(c => c.Index == client.BotControllerClientIndex);
if (controller != null)
nameLabel.GetText = () => TranslationProvider.GetString(BotManagedBy, Translation.Arguments("name", controller.Name));
nameLabel.GetText = () => FluentProvider.GetString(BotManagedBy, FluentBundle.Arguments("name", controller.Name));
widget.Bounds.Width = nameFont.Measure(nameLabel.GetText()).X + 2 * nameLabel.Bounds.Left;
}

View File

@@ -26,82 +26,82 @@ namespace OpenRA.Mods.Common.Widgets.Logic
{
public class ReplayBrowserLogic : ChromeLogic
{
[TranslationReference("time")]
[FluentReference("time")]
const string Duration = "label-duration";
[TranslationReference]
[FluentReference]
const string Singleplayer = "options-replay-type.singleplayer";
[TranslationReference]
[FluentReference]
const string Multiplayer = "options-replay-type.multiplayer";
[TranslationReference]
[FluentReference]
const string Today = "options-replay-date.today";
[TranslationReference]
[FluentReference]
const string LastWeek = "options-replay-date.last-week";
[TranslationReference]
[FluentReference]
const string LastFortnight = "options-replay-date.last-fortnight";
[TranslationReference]
[FluentReference]
const string LastMonth = "options-replay-date.last-month";
[TranslationReference]
[FluentReference]
const string ReplayDurationVeryShort = "options-replay-duration.very-short";
[TranslationReference]
[FluentReference]
const string ReplayDurationShort = "options-replay-duration.short";
[TranslationReference]
[FluentReference]
const string ReplayDurationMedium = "options-replay-duration.medium";
[TranslationReference]
[FluentReference]
const string ReplayDurationLong = "options-replay-duration.long";
[TranslationReference]
[FluentReference]
const string RenameReplayTitle = "dialog-rename-replay.title";
[TranslationReference]
[FluentReference]
const string RenameReplayPrompt = "dialog-rename-replay.prompt";
[TranslationReference]
[FluentReference]
const string RenameReplayAccept = "dialog-rename-replay.confirm";
[TranslationReference]
[FluentReference]
const string DeleteReplayTitle = "dialog-delete-replay.title";
[TranslationReference("replay")]
[FluentReference("replay")]
const string DeleteReplayPrompt = "dialog-delete-replay.prompt";
[TranslationReference]
[FluentReference]
const string DeleteReplayAccept = "dialog-delete-replay.confirm";
[TranslationReference]
[FluentReference]
const string DeleteAllReplaysTitle = "dialog-delete-all-replays.title";
[TranslationReference("count")]
[FluentReference("count")]
const string DeleteAllReplaysPrompt = "dialog-delete-all-replays.prompt";
[TranslationReference]
[FluentReference]
const string DeleteAllReplaysAccept = "dialog-delete-all-replays.confirm";
[TranslationReference("file")]
[FluentReference("file")]
const string ReplayDeletionFailed = "notification-replay-deletion-failed";
[TranslationReference]
[FluentReference]
const string Players = "label-players";
[TranslationReference("team")]
[FluentReference("team")]
const string TeamNumber = "label-team-name";
[TranslationReference]
[FluentReference]
const string NoTeam = "label-no-team";
[TranslationReference]
[FluentReference]
const string Victory = "options-winstate.victory";
[TranslationReference]
[FluentReference]
const string Defeat = "options-winstate.defeat";
static Filter filter = new();
@@ -182,7 +182,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
});
var replayDuration = new CachedTransform<ReplayMetadata, string>(r =>
TranslationProvider.GetString(Duration, Translation.Arguments("time", WidgetUtils.FormatTimeSeconds((int)selectedReplay.GameInfo.Duration.TotalSeconds))));
FluentProvider.GetString(Duration, FluentBundle.Arguments("time", WidgetUtils.FormatTimeSeconds((int)selectedReplay.GameInfo.Duration.TotalSeconds))));
panel.Get<LabelWidget>("DURATION").GetText = () => replayDuration.Update(selectedReplay);
SetupFilters();
@@ -234,8 +234,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic
var options = new List<(GameType GameType, string Text)>
{
(GameType.Any, ddb.GetText()),
(GameType.Singleplayer, TranslationProvider.GetString(Singleplayer)),
(GameType.Multiplayer, TranslationProvider.GetString(Multiplayer))
(GameType.Singleplayer, FluentProvider.GetString(Singleplayer)),
(GameType.Multiplayer, FluentProvider.GetString(Multiplayer))
};
var lookup = options.ToDictionary(kvp => kvp.GameType, kvp => kvp.Text);
@@ -267,10 +267,10 @@ namespace OpenRA.Mods.Common.Widgets.Logic
var options = new List<(DateType DateType, string Text)>
{
(DateType.Any, ddb.GetText()),
(DateType.Today, TranslationProvider.GetString(Today)),
(DateType.LastWeek, TranslationProvider.GetString(LastWeek)),
(DateType.LastFortnight, TranslationProvider.GetString(LastFortnight)),
(DateType.LastMonth, TranslationProvider.GetString(LastMonth))
(DateType.Today, FluentProvider.GetString(Today)),
(DateType.LastWeek, FluentProvider.GetString(LastWeek)),
(DateType.LastFortnight, FluentProvider.GetString(LastFortnight)),
(DateType.LastMonth, FluentProvider.GetString(LastMonth))
};
var lookup = options.ToDictionary(kvp => kvp.DateType, kvp => kvp.Text);
@@ -303,10 +303,10 @@ namespace OpenRA.Mods.Common.Widgets.Logic
var options = new List<(DurationType DurationType, string Text)>
{
(DurationType.Any, ddb.GetText()),
(DurationType.VeryShort, TranslationProvider.GetString(ReplayDurationVeryShort)),
(DurationType.Short, TranslationProvider.GetString(ReplayDurationShort)),
(DurationType.Medium, TranslationProvider.GetString(ReplayDurationMedium)),
(DurationType.Long, TranslationProvider.GetString(ReplayDurationLong))
(DurationType.VeryShort, FluentProvider.GetString(ReplayDurationVeryShort)),
(DurationType.Short, FluentProvider.GetString(ReplayDurationShort)),
(DurationType.Medium, FluentProvider.GetString(ReplayDurationMedium)),
(DurationType.Long, FluentProvider.GetString(ReplayDurationLong))
};
var lookup = options.ToDictionary(kvp => kvp.DurationType, kvp => kvp.Text);
@@ -340,8 +340,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic
var options = new List<(WinState WinState, string Text)>
{
(WinState.Undefined, ddb.GetText()),
(WinState.Lost, TranslationProvider.GetString(Defeat)),
(WinState.Won, TranslationProvider.GetString(Victory))
(WinState.Lost, FluentProvider.GetString(Defeat)),
(WinState.Won, FluentProvider.GetString(Victory))
};
var lookup = options.ToDictionary(kvp => kvp.WinState, kvp => kvp.Text);
@@ -446,7 +446,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
options.Insert(0, null); // no filter
var anyText = ddb.GetText();
ddb.GetText = () => string.IsNullOrEmpty(filter.Faction) ? anyText : TranslationProvider.GetString(filter.Faction);
ddb.GetText = () => string.IsNullOrEmpty(filter.Faction) ? anyText : FluentProvider.GetString(filter.Faction);
ddb.OnMouseDown = _ =>
{
ScrollItemWidget SetupItem(string option, ScrollItemWidget tpl)
@@ -455,7 +455,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
tpl,
() => string.Equals(filter.Faction, option, StringComparison.CurrentCultureIgnoreCase),
() => { filter.Faction = option; ApplyFilter(); });
item.Get<LabelWidget>("LABEL").GetText = () => option != null ? TranslationProvider.GetString(option) : anyText;
item.Get<LabelWidget>("LABEL").GetText = () => option != null ? FluentProvider.GetString(option) : anyText;
return item;
}
@@ -507,7 +507,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
ConfirmationDialogs.ButtonPrompt(modData,
title: DeleteReplayTitle,
text: DeleteReplayPrompt,
textArguments: Translation.Arguments("replay", Path.GetFileNameWithoutExtension(r.FilePath)),
textArguments: FluentBundle.Arguments("replay", Path.GetFileNameWithoutExtension(r.FilePath)),
onConfirm: () =>
{
DeleteReplay(r);
@@ -545,7 +545,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
ConfirmationDialogs.ButtonPrompt(modData,
title: DeleteAllReplaysTitle,
text: DeleteAllReplaysPrompt,
textArguments: Translation.Arguments("count", list.Count),
textArguments: FluentBundle.Arguments("count", list.Count),
onConfirm: () =>
{
foreach (var replayMetadata in list)
@@ -584,7 +584,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
}
catch (Exception ex)
{
TextNotificationsManager.Debug(TranslationProvider.GetString(ReplayDeletionFailed, Translation.Arguments("file", replay.FilePath)));
TextNotificationsManager.Debug(FluentProvider.GetString(ReplayDeletionFailed, FluentBundle.Arguments("file", replay.FilePath)));
Log.Write("debug", ex.ToString());
return;
}
@@ -724,9 +724,9 @@ namespace OpenRA.Mods.Common.Widgets.Logic
var noTeams = players.Count == 1;
foreach (var p in players)
{
var label = noTeams ? TranslationProvider.GetString(Players) : p.Key > 0
? TranslationProvider.GetString(TeamNumber, Translation.Arguments("team", p.Key))
: TranslationProvider.GetString(NoTeam);
var label = noTeams ? FluentProvider.GetString(Players) : p.Key > 0
? FluentProvider.GetString(TeamNumber, FluentBundle.Arguments("team", p.Key))
: FluentProvider.GetString(NoTeam);
teams.Add(label, p);
}

View File

@@ -17,28 +17,28 @@ namespace OpenRA.Mods.Common.Widgets.Logic
{
public static class ReplayUtils
{
[TranslationReference]
[FluentReference]
const string IncompatibleReplayTitle = "dialog-incompatible-replay.title";
[TranslationReference]
[FluentReference]
const string IncompatibleReplayPrompt = "dialog-incompatible-replay.prompt";
[TranslationReference]
[FluentReference]
const string IncompatibleReplayAccept = "dialog-incompatible-replay.confirm";
[TranslationReference]
[FluentReference]
const string UnknownVersion = "dialog-incompatible-replay.prompt-unknown-version";
[TranslationReference]
[FluentReference]
const string UnknownMod = "dialog-incompatible-replay.prompt-unknown-mod";
[TranslationReference("mod")]
[FluentReference("mod")]
const string UnvailableMod = "dialog-incompatible-replay.prompt-unavailable-mod";
[TranslationReference("version")]
[FluentReference("version")]
const string IncompatibleVersion = "dialog-incompatible-replay.prompt-incompatible-version";
[TranslationReference("map")]
[FluentReference("map")]
const string UnvailableMap = "dialog-incompatible-replay.prompt-unavailable-map";
static readonly Action DoNothing = () => { };
@@ -59,13 +59,13 @@ namespace OpenRA.Mods.Common.Widgets.Logic
return IncompatibleReplayDialog(UnknownMod, null, modData, onCancel);
if (!Game.Mods.ContainsKey(mod))
return IncompatibleReplayDialog(UnvailableMod, Translation.Arguments("mod", mod), modData, onCancel);
return IncompatibleReplayDialog(UnvailableMod, FluentBundle.Arguments("mod", mod), modData, onCancel);
if (Game.Mods[mod].Metadata.Version != version)
return IncompatibleReplayDialog(IncompatibleVersion, Translation.Arguments("version", version), modData, onCancel);
return IncompatibleReplayDialog(IncompatibleVersion, FluentBundle.Arguments("version", version), modData, onCancel);
if (replayMeta.GameInfo.MapPreview.Status != MapStatus.Available)
return IncompatibleReplayDialog(UnvailableMap, Translation.Arguments("map", replayMeta.GameInfo.MapUid), modData, onCancel);
return IncompatibleReplayDialog(UnvailableMap, FluentBundle.Arguments("map", replayMeta.GameInfo.MapUid), modData, onCancel);
return true;
}

View File

@@ -19,37 +19,37 @@ namespace OpenRA.Mods.Common.Widgets.Logic
{
public class ServerCreationLogic : ChromeLogic
{
[TranslationReference]
[FluentReference]
const string InternetServerNatA = "label-internet-server-nat-A";
[TranslationReference]
[FluentReference]
const string InternetServerNatBenabled = "label-internet-server-nat-B-enabled";
[TranslationReference]
[FluentReference]
const string InternetServerNatBnotSupported = "label-internet-server-nat-B-not-supported";
[TranslationReference]
[FluentReference]
const string InternetServerNatBdisabled = "label-internet-server-nat-B-disabled";
[TranslationReference]
[FluentReference]
const string InternetServerNatC = "label-internet-server-nat-C";
[TranslationReference]
[FluentReference]
const string LocalServer = "label-local-server";
[TranslationReference("port")]
[FluentReference("port")]
const string ServerCreationFailedPrompt = "dialog-server-creation-failed.prompt";
[TranslationReference]
[FluentReference]
const string ServerCreationFailedPortUsed = "dialog-server-creation-failed.prompt-port-used";
[TranslationReference("message", "code")]
[FluentReference("message", "code")]
const string ServerCreationFailedError = "dialog-server-creation-failed.prompt-error";
[TranslationReference]
[FluentReference]
const string ServerCreationFailedTitle = "dialog-server-creation-failed.title";
[TranslationReference]
[FluentReference]
const string ServerCreationFailedCancel = "dialog-server-creation-failed.cancel";
readonly Widget panel;
@@ -170,15 +170,15 @@ namespace OpenRA.Mods.Common.Widgets.Logic
if (advertiseOnline)
{
var noticesLabelAText = TranslationProvider.GetString(InternetServerNatA) + " ";
var noticesLabelAText = FluentProvider.GetString(InternetServerNatA) + " ";
noticesLabelA.GetText = () => noticesLabelAText;
var aWidth = Game.Renderer.Fonts[noticesLabelA.Font].Measure(noticesLabelAText).X;
noticesLabelA.Bounds.Width = aWidth;
var noticesLabelBText =
Nat.Status == NatStatus.Enabled ? TranslationProvider.GetString(InternetServerNatBenabled) :
Nat.Status == NatStatus.NotSupported ? TranslationProvider.GetString(InternetServerNatBnotSupported) :
TranslationProvider.GetString(InternetServerNatBdisabled);
Nat.Status == NatStatus.Enabled ? FluentProvider.GetString(InternetServerNatBenabled) :
Nat.Status == NatStatus.NotSupported ? FluentProvider.GetString(InternetServerNatBnotSupported) :
FluentProvider.GetString(InternetServerNatBdisabled);
noticesLabelB.GetText = () => noticesLabelBText;
noticesLabelB.TextColor =
@@ -191,14 +191,14 @@ namespace OpenRA.Mods.Common.Widgets.Logic
noticesLabelB.Bounds.Width = bWidth;
noticesLabelB.Visible = true;
var noticesLabelCText = TranslationProvider.GetString(InternetServerNatC);
var noticesLabelCText = FluentProvider.GetString(InternetServerNatC);
noticesLabelC.GetText = () => noticesLabelCText;
noticesLabelC.Bounds.X = noticesLabelB.Bounds.Right;
noticesLabelC.Visible = true;
}
else
{
var noticesLabelAText = TranslationProvider.GetString(LocalServer);
var noticesLabelAText = FluentProvider.GetString(LocalServer);
noticesLabelA.GetText = () => noticesLabelAText;
noticesLabelB.Visible = false;
noticesLabelC.Visible = false;
@@ -239,14 +239,14 @@ namespace OpenRA.Mods.Common.Widgets.Logic
}
catch (System.Net.Sockets.SocketException e)
{
var message = TranslationProvider.GetString(ServerCreationFailedPrompt, Translation.Arguments("port", Game.Settings.Server.ListenPort));
var message = FluentProvider.GetString(ServerCreationFailedPrompt, FluentBundle.Arguments("port", Game.Settings.Server.ListenPort));
// AddressAlreadyInUse (WSAEADDRINUSE)
if (e.ErrorCode == 10048)
message += "\n" + TranslationProvider.GetString(ServerCreationFailedPortUsed);
message += "\n" + FluentProvider.GetString(ServerCreationFailedPortUsed);
else
message += "\n" + TranslationProvider.GetString(ServerCreationFailedError,
Translation.Arguments("message", e.Message, "code", e.ErrorCode));
message += "\n" + FluentProvider.GetString(ServerCreationFailedError,
FluentBundle.Arguments("message", e.Message, "code", e.ErrorCode));
ConfirmationDialogs.ButtonPrompt(modData, ServerCreationFailedTitle, message,
onCancel: () => { }, cancelText: ServerCreationFailedCancel);

View File

@@ -25,67 +25,67 @@ namespace OpenRA.Mods.Common.Widgets.Logic
{
public class ServerListLogic : ChromeLogic
{
[TranslationReference]
[FluentReference]
const string SearchStatusFailed = "label-search-status-failed";
[TranslationReference]
[FluentReference]
const string SearchStatusNoGames = "label-search-status-no-games";
[TranslationReference("players")]
[FluentReference("players")]
const string PlayersOnline = "label-players-online-count";
[TranslationReference]
[FluentReference]
const string NoServerSelected = "label-no-server-selected";
[TranslationReference]
[FluentReference]
const string MapStatusSearching = "label-map-status-searching";
[TranslationReference]
[FluentReference]
const string MapClassificationUnknown = "label-map-classification-unknown";
[TranslationReference("players")]
[FluentReference("players")]
const string PlayersLabel = "label-players-count";
[TranslationReference("bots")]
[FluentReference("bots")]
const string BotsLabel = "label-bots-count";
[TranslationReference("spectators")]
[FluentReference("spectators")]
const string SpectatorsLabel = "label-spectators-count";
[TranslationReference]
[FluentReference]
const string Players = "label-players";
[TranslationReference("team")]
[FluentReference("team")]
const string TeamNumber = "label-team-name";
[TranslationReference]
[FluentReference]
const string NoTeam = "label-no-team";
[TranslationReference]
[FluentReference]
const string Spectators = "label-spectators";
[TranslationReference("players")]
[FluentReference("players")]
const string OtherPlayers = "label-other-players-count";
[TranslationReference]
[FluentReference]
const string Playing = "label-playing";
[TranslationReference]
[FluentReference]
const string Waiting = "label-waiting";
[TranslationReference("minutes")]
[FluentReference("minutes")]
const string InProgress = "label-in-progress-for";
[TranslationReference]
[FluentReference]
const string PasswordProtected = "label-password-protected";
[TranslationReference]
[FluentReference]
const string WaitingForPlayers = "label-waiting-for-players";
[TranslationReference]
[FluentReference]
const string ServerShuttingDown = "label-server-shutting-down";
[TranslationReference]
[FluentReference]
const string UnknownServerState = "label-unknown-server-state";
readonly string noServerSelected;
@@ -145,8 +145,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic
{
switch (searchStatus)
{
case SearchStatus.Failed: return TranslationProvider.GetString(SearchStatusFailed);
case SearchStatus.NoGames: return TranslationProvider.GetString(SearchStatusNoGames);
case SearchStatus.Failed: return FluentProvider.GetString(SearchStatusFailed);
case SearchStatus.NoGames: return FluentProvider.GetString(SearchStatusNoGames);
default: return "";
}
}
@@ -157,22 +157,22 @@ namespace OpenRA.Mods.Common.Widgets.Logic
this.modData = modData;
this.onJoin = onJoin;
playing = TranslationProvider.GetString(Playing);
waiting = TranslationProvider.GetString(Waiting);
playing = FluentProvider.GetString(Playing);
waiting = FluentProvider.GetString(Waiting);
noServerSelected = TranslationProvider.GetString(NoServerSelected);
mapStatusSearching = TranslationProvider.GetString(MapStatusSearching);
mapClassificationUnknown = TranslationProvider.GetString(MapClassificationUnknown);
noServerSelected = FluentProvider.GetString(NoServerSelected);
mapStatusSearching = FluentProvider.GetString(MapStatusSearching);
mapClassificationUnknown = FluentProvider.GetString(MapClassificationUnknown);
players = new CachedTransform<int, string>(i => TranslationProvider.GetString(PlayersLabel, Translation.Arguments("players", i)));
bots = new CachedTransform<int, string>(i => TranslationProvider.GetString(BotsLabel, Translation.Arguments("bots", i)));
spectators = new CachedTransform<int, string>(i => TranslationProvider.GetString(SpectatorsLabel, Translation.Arguments("spectators", i)));
players = new CachedTransform<int, string>(i => FluentProvider.GetString(PlayersLabel, FluentBundle.Arguments("players", i)));
bots = new CachedTransform<int, string>(i => FluentProvider.GetString(BotsLabel, FluentBundle.Arguments("bots", i)));
spectators = new CachedTransform<int, string>(i => FluentProvider.GetString(SpectatorsLabel, FluentBundle.Arguments("spectators", i)));
minutes = new CachedTransform<double, string>(i => TranslationProvider.GetString(InProgress, Translation.Arguments("minutes", i)));
passwordProtected = TranslationProvider.GetString(PasswordProtected);
waitingForPlayers = TranslationProvider.GetString(WaitingForPlayers);
serverShuttingDown = TranslationProvider.GetString(ServerShuttingDown);
unknownServerState = TranslationProvider.GetString(UnknownServerState);
minutes = new CachedTransform<double, string>(i => FluentProvider.GetString(InProgress, FluentBundle.Arguments("minutes", i)));
passwordProtected = FluentProvider.GetString(PasswordProtected);
waitingForPlayers = FluentProvider.GetString(WaitingForPlayers);
serverShuttingDown = FluentProvider.GetString(ServerShuttingDown);
unknownServerState = FluentProvider.GetString(UnknownServerState);
services = modData.Manifest.Get<WebServices>();
@@ -318,7 +318,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
var playersLabel = widget.GetOrNull<LabelWidget>("PLAYER_COUNT");
if (playersLabel != null)
{
var playersText = new CachedTransform<int, string>(p => TranslationProvider.GetString(PlayersOnline, Translation.Arguments("players", p)));
var playersText = new CachedTransform<int, string>(p => FluentProvider.GetString(PlayersOnline, FluentBundle.Arguments("players", p)));
playersLabel.IsVisible = () => playerCount != 0;
playersLabel.GetText = () => playersText.Update(playerCount);
}
@@ -581,14 +581,14 @@ namespace OpenRA.Mods.Common.Widgets.Logic
var noTeams = players.Count == 1;
foreach (var p in players)
{
var label = noTeams ? TranslationProvider.GetString(Players) : p.Key > 0
? TranslationProvider.GetString(TeamNumber, Translation.Arguments("team", p.Key))
: TranslationProvider.GetString(NoTeam);
var label = noTeams ? FluentProvider.GetString(Players) : p.Key > 0
? FluentProvider.GetString(TeamNumber, FluentBundle.Arguments("team", p.Key))
: FluentProvider.GetString(NoTeam);
teams.Add(label, p);
}
if (server.Clients.Any(c => c.IsSpectator))
teams.Add(TranslationProvider.GetString(Spectators), server.Clients.Where(c => c.IsSpectator));
teams.Add(FluentProvider.GetString(Spectators), server.Clients.Where(c => c.IsSpectator));
var factionInfo = modData.DefaultRules.Actors[SystemActors.World].TraitInfos<FactionInfo>();
foreach (var kv in teams)
@@ -765,7 +765,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
if (game.Clients.Length > 10)
displayClients = displayClients
.Take(9)
.Append(TranslationProvider.GetString(OtherPlayers, Translation.Arguments("players", game.Clients.Length - 9)));
.Append(FluentProvider.GetString(OtherPlayers, FluentBundle.Arguments("players", game.Clients.Length - 9)));
var tooltip = displayClients.JoinWith("\n");
players.GetTooltipText = () => tooltip;

View File

@@ -23,49 +23,49 @@ namespace OpenRA.Mods.Common.Widgets.Logic
{
public class DisplaySettingsLogic : ChromeLogic
{
[TranslationReference]
[FluentReference]
const string Close = "options-camera.close";
[TranslationReference]
[FluentReference]
const string Medium = "options-camera.medium";
[TranslationReference]
[FluentReference]
const string Far = "options-camera.far";
[TranslationReference]
[FluentReference]
const string Furthest = "options-camera.furthest";
[TranslationReference]
[FluentReference]
const string Windowed = "options-display-mode.windowed";
[TranslationReference]
[FluentReference]
const string LegacyFullscreen = "options-display-mode.legacy-fullscreen";
[TranslationReference]
[FluentReference]
const string Fullscreen = "options-display-mode.fullscreen";
[TranslationReference("number")]
[FluentReference("number")]
const string Display = "label-video-display-index";
[TranslationReference]
[FluentReference]
const string Standard = "options-status-bars.standard";
[TranslationReference]
[FluentReference]
const string ShowOnDamage = "options-status-bars.show-on-damage";
[TranslationReference]
[FluentReference]
const string AlwaysShow = "options-status-bars.always-show";
[TranslationReference]
[FluentReference]
const string Automatic = "options-target-lines.automatic";
[TranslationReference]
[FluentReference]
const string Manual = "options-target-lines.manual";
[TranslationReference]
[FluentReference]
const string Disabled = "options-target-lines.disabled";
[TranslationReference("fps")]
[FluentReference("fps")]
const string FrameLimiter = "checkbox-frame-limiter";
static readonly int OriginalVideoDisplay;
static readonly WindowMode OriginalGraphicsMode;
@@ -106,17 +106,17 @@ namespace OpenRA.Mods.Common.Widgets.Logic
this.modData = modData;
viewportSizes = modData.Manifest.Get<WorldViewportSizes>();
legacyFullscreen = TranslationProvider.GetString(LegacyFullscreen);
fullscreen = TranslationProvider.GetString(Fullscreen);
legacyFullscreen = FluentProvider.GetString(LegacyFullscreen);
fullscreen = FluentProvider.GetString(Fullscreen);
registerPanel(panelID, label, InitPanel, ResetPanel);
showOnDamage = TranslationProvider.GetString(ShowOnDamage);
alwaysShow = TranslationProvider.GetString(AlwaysShow);
showOnDamage = FluentProvider.GetString(ShowOnDamage);
alwaysShow = FluentProvider.GetString(AlwaysShow);
automatic = TranslationProvider.GetString(Automatic);
manual = TranslationProvider.GetString(Manual);
disabled = TranslationProvider.GetString(Disabled);
automatic = FluentProvider.GetString(Automatic);
manual = FluentProvider.GetString(Manual);
disabled = FluentProvider.GetString(Disabled);
}
public static string GetViewportSizeName(ModData modData, WorldViewport worldViewport)
@@ -124,13 +124,13 @@ namespace OpenRA.Mods.Common.Widgets.Logic
switch (worldViewport)
{
case WorldViewport.Close:
return TranslationProvider.GetString(Close);
return FluentProvider.GetString(Close);
case WorldViewport.Medium:
return TranslationProvider.GetString(Medium);
return FluentProvider.GetString(Medium);
case WorldViewport.Far:
return TranslationProvider.GetString(Far);
return FluentProvider.GetString(Far);
case WorldViewport.Native:
return TranslationProvider.GetString(Furthest);
return FluentProvider.GetString(Furthest);
default:
return "";
}
@@ -166,12 +166,12 @@ namespace OpenRA.Mods.Common.Widgets.Logic
var windowModeDropdown = panel.Get<DropDownButtonWidget>("MODE_DROPDOWN");
windowModeDropdown.OnMouseDown = _ => ShowWindowModeDropdown(windowModeDropdown, ds, scrollPanel);
windowModeDropdown.GetText = () => ds.Mode == WindowMode.Windowed
? TranslationProvider.GetString(Windowed)
? FluentProvider.GetString(Windowed)
: ds.Mode == WindowMode.Fullscreen ? legacyFullscreen : fullscreen;
var displaySelectionDropDown = panel.Get<DropDownButtonWidget>("DISPLAY_SELECTION_DROPDOWN");
displaySelectionDropDown.OnMouseDown = _ => ShowDisplaySelectionDropdown(displaySelectionDropDown, ds);
var displaySelectionLabel = new CachedTransform<int, string>(i => TranslationProvider.GetString(Display, Translation.Arguments("number", i + 1)));
var displaySelectionLabel = new CachedTransform<int, string>(i => FluentProvider.GetString(Display, FluentBundle.Arguments("number", i + 1)));
displaySelectionDropDown.GetText = () => displaySelectionLabel.Update(ds.VideoDisplay);
displaySelectionDropDown.IsDisabled = () => Game.Renderer.DisplayCount < 2;
@@ -185,7 +185,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
var statusBarsDropDown = panel.Get<DropDownButtonWidget>("STATUS_BAR_DROPDOWN");
statusBarsDropDown.OnMouseDown = _ => ShowStatusBarsDropdown(statusBarsDropDown, gs);
statusBarsDropDown.GetText = () => gs.StatusBars == StatusBarsType.Standard
? TranslationProvider.GetString(Standard)
? FluentProvider.GetString(Standard)
: gs.StatusBars == StatusBarsType.DamageShow
? showOnDamage
: alwaysShow;
@@ -242,7 +242,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
var frameLimitGamespeedCheckbox = panel.Get<CheckboxWidget>("FRAME_LIMIT_GAMESPEED_CHECKBOX");
var frameLimitCheckbox = panel.Get<CheckboxWidget>("FRAME_LIMIT_CHECKBOX");
var frameLimitLabel = new CachedTransform<int, string>(fps => TranslationProvider.GetString(FrameLimiter, Translation.Arguments("fps", fps)));
var frameLimitLabel = new CachedTransform<int, string>(fps => FluentProvider.GetString(FrameLimiter, FluentBundle.Arguments("fps", fps)));
frameLimitCheckbox.GetText = () => frameLimitLabel.Update(ds.MaxFramerate);
frameLimitCheckbox.IsDisabled = () => ds.CapFramerateToGameFps;
@@ -350,9 +350,9 @@ namespace OpenRA.Mods.Common.Widgets.Logic
{
var options = new Dictionary<string, WindowMode>()
{
{ TranslationProvider.GetString(Fullscreen), WindowMode.PseudoFullscreen },
{ TranslationProvider.GetString(LegacyFullscreen), WindowMode.Fullscreen },
{ TranslationProvider.GetString(Windowed), WindowMode.Windowed },
{ FluentProvider.GetString(Fullscreen), WindowMode.PseudoFullscreen },
{ FluentProvider.GetString(LegacyFullscreen), WindowMode.Fullscreen },
{ FluentProvider.GetString(Windowed), WindowMode.Windowed },
};
ScrollItemWidget SetupItem(string o, ScrollItemWidget itemTemplate)
@@ -399,9 +399,9 @@ namespace OpenRA.Mods.Common.Widgets.Logic
{
var options = new Dictionary<string, StatusBarsType>()
{
{ TranslationProvider.GetString(Standard), StatusBarsType.Standard },
{ TranslationProvider.GetString(ShowOnDamage), StatusBarsType.DamageShow },
{ TranslationProvider.GetString(AlwaysShow), StatusBarsType.AlwaysShow },
{ FluentProvider.GetString(Standard), StatusBarsType.Standard },
{ FluentProvider.GetString(ShowOnDamage), StatusBarsType.DamageShow },
{ FluentProvider.GetString(AlwaysShow), StatusBarsType.AlwaysShow },
};
ScrollItemWidget SetupItem(string o, ScrollItemWidget itemTemplate)
@@ -454,9 +454,9 @@ namespace OpenRA.Mods.Common.Widgets.Logic
{
var options = new Dictionary<string, TargetLinesType>()
{
{ TranslationProvider.GetString(Automatic), TargetLinesType.Automatic },
{ TranslationProvider.GetString(Manual), TargetLinesType.Manual },
{ TranslationProvider.GetString(Disabled), TargetLinesType.Disabled },
{ FluentProvider.GetString(Automatic), TargetLinesType.Automatic },
{ FluentProvider.GetString(Manual), TargetLinesType.Manual },
{ FluentProvider.GetString(Disabled), TargetLinesType.Disabled },
};
ScrollItemWidget SetupItem(string o, ScrollItemWidget itemTemplate)

View File

@@ -19,10 +19,10 @@ namespace OpenRA.Mods.Common.Widgets.Logic
{
public class HotkeysSettingsLogic : ChromeLogic
{
[TranslationReference("key")]
[FluentReference("key")]
const string OriginalNotice = "label-original-notice";
[TranslationReference("key", "context")]
[FluentReference("key", "context")]
const string DuplicateNotice = "label-duplicate-notice";
readonly ModData modData;
@@ -229,7 +229,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
duplicateNotice.IsVisible = () => !isHotkeyValid;
var duplicateNoticeText = new CachedTransform<HotkeyDefinition, string>(hd =>
hd != null ?
TranslationProvider.GetString(DuplicateNotice, Translation.Arguments("key", hd.Description,
FluentProvider.GetString(DuplicateNotice, FluentBundle.Arguments("key", hd.Description,
"context", hd.Contexts.First(c => selectedHotkeyDefinition.Contexts.Contains(c)))) :
"");
duplicateNotice.GetText = () => duplicateNoticeText.Update(duplicateHotkeyDefinition);
@@ -238,7 +238,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
originalNotice.TextColor = ChromeMetrics.Get<Color>("NoticeInfoColor");
originalNotice.IsVisible = () => isHotkeyValid && !isHotkeyDefault;
var originalNoticeText = new CachedTransform<HotkeyDefinition, string>(hd =>
TranslationProvider.GetString(OriginalNotice, Translation.Arguments("key", hd?.Default.DisplayString())));
FluentProvider.GetString(OriginalNotice, FluentBundle.Arguments("key", hd?.Default.DisplayString())));
originalNotice.GetText = () => originalNoticeText.Update(selectedHotkeyDefinition);
var readonlyNotice = panel.Get<LabelWidget>("READONLY_NOTICE");

View File

@@ -18,37 +18,37 @@ namespace OpenRA.Mods.Common.Widgets.Logic
{
public class InputSettingsLogic : ChromeLogic
{
[TranslationReference]
[FluentReference]
const string Classic = "options-control-scheme.classic";
[TranslationReference]
[FluentReference]
const string Modern = "options-control-scheme.modern";
[TranslationReference]
[FluentReference]
const string Disabled = "options-mouse-scroll-type.disabled";
[TranslationReference]
[FluentReference]
const string Standard = "options-mouse-scroll-type.standard";
[TranslationReference]
[FluentReference]
const string Inverted = "options-mouse-scroll-type.inverted";
[TranslationReference]
[FluentReference]
const string Joystick = "options-mouse-scroll-type.joystick";
[TranslationReference]
[FluentReference]
const string Alt = "options-zoom-modifier.alt";
[TranslationReference]
[FluentReference]
const string Ctrl = "options-zoom-modifier.ctrl";
[TranslationReference]
[FluentReference]
const string Meta = "options-zoom-modifier.meta";
[TranslationReference]
[FluentReference]
const string Shift = "options-zoom-modifier.shift";
[TranslationReference]
[FluentReference]
const string None = "options-zoom-modifier.none";
static InputSettingsLogic() { }
@@ -59,8 +59,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic
[ObjectCreator.UseCtor]
public InputSettingsLogic(Action<string, string, Func<Widget, Func<bool>>, Func<Widget, Action>> registerPanel, string panelID, string label)
{
classic = TranslationProvider.GetString(Classic);
modern = TranslationProvider.GetString(Modern);
classic = FluentProvider.GetString(Classic);
modern = FluentProvider.GetString(Modern);
registerPanel(panelID, label, InitPanel, ResetPanel);
}
@@ -163,8 +163,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic
{
var options = new Dictionary<string, bool>()
{
{ TranslationProvider.GetString(Classic), true },
{ TranslationProvider.GetString(Modern), false },
{ FluentProvider.GetString(Classic), true },
{ FluentProvider.GetString(Modern), false },
};
ScrollItemWidget SetupItem(string o, ScrollItemWidget itemTemplate)
@@ -183,10 +183,10 @@ namespace OpenRA.Mods.Common.Widgets.Logic
{
var options = new Dictionary<string, MouseScrollType>()
{
{ TranslationProvider.GetString(Disabled), MouseScrollType.Disabled },
{ TranslationProvider.GetString(Standard), MouseScrollType.Standard },
{ TranslationProvider.GetString(Inverted), MouseScrollType.Inverted },
{ TranslationProvider.GetString(Joystick), MouseScrollType.Joystick },
{ FluentProvider.GetString(Disabled), MouseScrollType.Disabled },
{ FluentProvider.GetString(Standard), MouseScrollType.Standard },
{ FluentProvider.GetString(Inverted), MouseScrollType.Inverted },
{ FluentProvider.GetString(Joystick), MouseScrollType.Joystick },
};
ScrollItemWidget SetupItem(string o, ScrollItemWidget itemTemplate)
@@ -205,11 +205,11 @@ namespace OpenRA.Mods.Common.Widgets.Logic
{
var options = new Dictionary<string, Modifiers>()
{
{ TranslationProvider.GetString(Alt), Modifiers.Alt },
{ TranslationProvider.GetString(Ctrl), Modifiers.Ctrl },
{ TranslationProvider.GetString(Meta), Modifiers.Meta },
{ TranslationProvider.GetString(Shift), Modifiers.Shift },
{ TranslationProvider.GetString(None), Modifiers.None }
{ FluentProvider.GetString(Alt), Modifiers.Alt },
{ FluentProvider.GetString(Ctrl), Modifiers.Ctrl },
{ FluentProvider.GetString(Meta), Modifiers.Meta },
{ FluentProvider.GetString(Shift), Modifiers.Shift },
{ FluentProvider.GetString(None), Modifiers.None }
};
ScrollItemWidget SetupItem(string o, ScrollItemWidget itemTemplate)

View File

@@ -19,37 +19,37 @@ namespace OpenRA.Mods.Common.Widgets.Logic
{
public class SettingsLogic : ChromeLogic
{
[TranslationReference]
[FluentReference]
const string SettingsSaveTitle = "dialog-settings-save.title";
[TranslationReference]
[FluentReference]
const string SettingsSavePrompt = "dialog-settings-save.prompt";
[TranslationReference]
[FluentReference]
const string SettingsSaveCancel = "dialog-settings-save.cancel";
[TranslationReference]
[FluentReference]
const string RestartTitle = "dialog-settings-restart.title";
[TranslationReference]
[FluentReference]
const string RestartPrompt = "dialog-settings-restart.prompt";
[TranslationReference]
[FluentReference]
const string RestartAccept = "dialog-settings-restart.confirm";
[TranslationReference]
[FluentReference]
const string RestartCancel = "dialog-settings-restart.cancel";
[TranslationReference("panel")]
[FluentReference("panel")]
const string ResetTitle = "dialog-settings-reset.title";
[TranslationReference]
[FluentReference]
const string ResetPrompt = "dialog-settings-reset.prompt";
[TranslationReference]
[FluentReference]
const string ResetAccept = "dialog-settings-reset.confirm";
[TranslationReference]
[FluentReference]
const string ResetCancel = "dialog-settings-reset.cancel";
readonly Dictionary<string, Func<bool>> leavePanelActions = new();
@@ -143,7 +143,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
ConfirmationDialogs.ButtonPrompt(modData,
title: ResetTitle,
text: ResetPrompt,
titleArguments: Translation.Arguments("panel", panels[activePanel]),
titleArguments: FluentBundle.Arguments("panel", panels[activePanel]),
onConfirm: Reset,
confirmText: ResetAccept,
onCancel: () => { },

View File

@@ -30,7 +30,7 @@ namespace OpenRA.Mods.Common.Widgets
public SpawnOccupant(Session.Client client)
{
Color = client.Color;
PlayerName = client.IsBot ? TranslationProvider.GetString(client.Name) : client.Name;
PlayerName = client.IsBot ? FluentProvider.GetString(client.Name) : client.Name;
Team = client.Team;
Faction = client.Faction;
SpawnPoint = client.SpawnPoint;
@@ -39,7 +39,7 @@ namespace OpenRA.Mods.Common.Widgets
public SpawnOccupant(GameInformation.Player player)
{
Color = player.Color;
PlayerName = player.IsBot ? TranslationProvider.GetString(player.Name) : player.Name;
PlayerName = player.IsBot ? FluentProvider.GetString(player.Name) : player.Name;
Team = player.Team;
Faction = player.FactionId;
SpawnPoint = player.SpawnPoint;
@@ -48,7 +48,7 @@ namespace OpenRA.Mods.Common.Widgets
public SpawnOccupant(GameClient player, bool suppressFaction)
{
Color = player.Color;
PlayerName = player.IsBot ? TranslationProvider.GetString(player.Name) : player.Name;
PlayerName = player.IsBot ? FluentProvider.GetString(player.Name) : player.Name;
Team = player.Team;
Faction = !suppressFaction ? player.Faction : null;
SpawnPoint = player.SpawnPoint;

View File

@@ -75,10 +75,10 @@ namespace OpenRA.Mods.Common.Widgets
public readonly bool DrawTime = true;
[TranslationReference]
[FluentReference]
public string ReadyText = "";
[TranslationReference]
[FluentReference]
public string HoldText = "";
public readonly string InfiniteSymbol = "\u221E";
@@ -178,9 +178,9 @@ namespace OpenRA.Mods.Common.Widgets
Game.Renderer.Fonts.TryGetValue(SymbolsFont, out symbolFont);
iconOffset = 0.5f * IconSize.ToFloat2() + IconSpriteOffset;
HoldText = TranslationProvider.GetString(HoldText);
HoldText = FluentProvider.GetString(HoldText);
holdOffset = iconOffset - overlayFont.Measure(HoldText) / 2;
ReadyText = TranslationProvider.GetString(ReadyText);
ReadyText = FluentProvider.GetString(ReadyText);
readyOffset = iconOffset - overlayFont.Measure(ReadyText) / 2;
if (ChromeMetrics.TryGet("InfiniteOffset", out infiniteOffset))

View File

@@ -21,7 +21,7 @@ namespace OpenRA.Mods.Common.Widgets
{
public class SupportPowerTimerWidget : Widget
{
[TranslationReference("player", "support-power", "time")]
[FluentReference("player", "support-power", "time")]
const string Format = "support-power-timer";
public readonly string Font = "Bold";
@@ -59,7 +59,7 @@ namespace OpenRA.Mods.Common.Widgets
{
var self = p.Instances[0].Self;
var time = WidgetUtils.FormatTime(p.RemainingTicks, false, self.World.Timestep);
var text = TranslationProvider.GetString(Format, Translation.Arguments("player", self.Owner.ResolvedPlayerName, "support-power", p.Name, "time", time));
var text = FluentProvider.GetString(Format, FluentBundle.Arguments("player", self.Owner.ResolvedPlayerName, "support-power", p.Name, "time", time));
var color = !p.Ready || Game.LocalTick % 50 < 25 ? self.OwnerColor() : Color.White;

View File

@@ -22,10 +22,10 @@ namespace OpenRA.Mods.Common.Widgets
{
public class SupportPowersWidget : Widget
{
[TranslationReference]
[FluentReference]
public string ReadyText = "";
[TranslationReference]
[FluentReference]
public string HoldText = "";
public readonly string OverlayFont = "TinyBold";
@@ -112,9 +112,9 @@ namespace OpenRA.Mods.Common.Widgets
iconOffset = 0.5f * IconSize.ToFloat2() + IconSpriteOffset;
HoldText = TranslationProvider.GetString(HoldText);
HoldText = FluentProvider.GetString(HoldText);
holdOffset = iconOffset - overlayFont.Measure(HoldText) / 2;
ReadyText = TranslationProvider.GetString(ReadyText);
ReadyText = FluentProvider.GetString(ReadyText);
readyOffset = iconOffset - overlayFont.Measure(ReadyText) / 2;
clock = new Animation(worldRenderer.World, ClockAnimation);

View File

@@ -20,13 +20,13 @@ namespace OpenRA.Mods.Common.Widgets
{
public static class WidgetUtils
{
[TranslationReference]
[FluentReference]
const string Gone = "label-client-state-disconnected";
[TranslationReference]
[FluentReference]
const string Won = "label-win-state-won";
[TranslationReference]
[FluentReference]
const string Lost = "label-win-state-lost";
public static string GetStatefulImageName(
@@ -339,12 +339,12 @@ namespace OpenRA.Mods.Common.Widgets
var suffix = "";
if (c.WinState == WinState.Won)
suffix = $" ({TranslationProvider.GetString(Won)})";
suffix = $" ({FluentProvider.GetString(Won)})";
else if (c.WinState == WinState.Lost)
suffix = $" ({TranslationProvider.GetString(Lost)})";
suffix = $" ({FluentProvider.GetString(Lost)})";
if (client.State == Session.ClientState.Disconnected)
suffix = $" ({TranslationProvider.GetString(Gone)})";
suffix = $" ({FluentProvider.GetString(Gone)})";
text += suffix;