Refactor translation files

- Add prefixes to all message keys to provide context
- Use messages with attributes for some UI elements (dropdowns, dialogs, checkboxes, menus)
- Rename some class fields for consistency with translation keys
This commit is contained in:
Ivaylo Draganov
2022-11-10 13:46:51 +02:00
committed by Paul Chote
parent 46caa2d889
commit a0f17b15ec
89 changed files with 1095 additions and 1053 deletions

View File

@@ -17,7 +17,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
class KickClientLogic : ChromeLogic
{
[TranslationReference("player")]
const string KickClient = "kick-client";
const string KickClient = "dialog-kick-client.prompt";
[ObjectCreator.UseCtor]
public KickClientLogic(ModData modData, Widget widget, string clientName, Action<bool> okPressed, Action cancelPressed)

View File

@@ -17,7 +17,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
class KickSpectatorsLogic : ChromeLogic
{
[TranslationReference("count")]
const string KickSpectators = "kick-spectators";
const string KickSpectators = "dialog-kick-spectators.prompt";
[ObjectCreator.UseCtor]
public KickSpectatorsLogic(ModData modData, Widget widget, int clientCount, Action okPressed, Action cancelPressed)

View File

@@ -23,40 +23,40 @@ namespace OpenRA.Mods.Common.Widgets.Logic
public class LobbyLogic : ChromeLogic, INotificationHandler<TextNotification>
{
[TranslationReference]
const string Add = "add";
const string Add = "options-slot-admin.add-bots";
[TranslationReference]
const string Remove = "remove";
const string Remove = "options-slot-admin.remove-bots";
[TranslationReference]
const string ConfigureBots = "configure-bots";
const string ConfigureBots = "options-slot-admin.configure-bots";
[TranslationReference("count")]
const string NumberTeams = "n-teams";
const string NumberTeams = "options-slot-admin.teams-count";
[TranslationReference]
const string HumanVsBots = "humans-vs-bots";
const string HumanVsBots = "options-slot-admin.humans-vs-bots";
[TranslationReference]
const string FreeForAll = "free-for-all";
const string FreeForAll = "options-slot-admin.free-for-all";
[TranslationReference]
const string ConfigureTeams = "configure-teams";
const string ConfigureTeams = "options-slot-admin.configure-teams";
[TranslationReference]
const string Back = "back";
const string Back = "button-back";
[TranslationReference]
const string Team = "team";
const string TeamChat = "button-team-chat";
[TranslationReference]
const string All = "all";
const string GeneralChat = "button-general-chat";
[TranslationReference("seconds")]
const string ChatAvailability = "chat-availability";
const string ChatAvailability = "label-chat-availability";
[TranslationReference]
const string ChatDisabled = "chat-disabled";
const string ChatDisabled = "label-chat-disabled";
static readonly Action DoNothing = () => { };
@@ -454,8 +454,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic
}
var chatMode = lobby.Get<ButtonWidget>("CHAT_MODE");
var team = modData.Translation.GetString(Team);
var all = modData.Translation.GetString(All);
var team = modData.Translation.GetString(TeamChat);
var all = modData.Translation.GetString(GeneralChat);
chatMode.GetText = () => teamChat ? team : all;
chatMode.OnClick = () => teamChat ^= true;
chatMode.IsDisabled = () => disableTeamChat || !chatEnabled;

View File

@@ -21,7 +21,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
public class LobbyOptionsLogic : ChromeLogic
{
[TranslationReference]
const string NotAvailable = "not-available";
const string NotAvailable = "label-not-available";
readonly ModData modData;
readonly ScrollPanelWidget panel;

View File

@@ -24,19 +24,19 @@ namespace OpenRA.Mods.Common.Widgets.Logic
public static class LobbyUtils
{
[TranslationReference]
const string Open = "open";
const string Open = "options-lobby-slot.open";
[TranslationReference]
const string Closed = "closed";
const string Closed = "options-lobby-slot.closed";
[TranslationReference]
const string Bots = "bots";
const string Bots = "options-lobby-slot.bots";
[TranslationReference]
const string BotsDisabled = "bots-disabled";
const string BotsDisabled = "options-lobby-slot.bots-disabled";
[TranslationReference]
const string Slot = "slot";
const string Slot = "options-lobby-slot.slot";
class SlotDropDownOption
{

View File

@@ -20,22 +20,22 @@ namespace OpenRA.Mods.Common.Widgets.Logic
public class MapPreviewLogic : ChromeLogic
{
[TranslationReference]
const string Connecting = "connecting";
const string Connecting = "label-connecting";
[TranslationReference("size")]
const string Downloading = "downloading-map";
const string Downloading = "label-downloading-map";
[TranslationReference("size", "progress")]
const string DownloadingPercentage = "downloading-map-progress";
const string DownloadingPercentage = "label-downloading-map-progress";
[TranslationReference]
const string RetryInstall = "retry-install";
const string RetryInstall = "button-retry-install";
[TranslationReference]
const string RetrySearch = "retry-search";
const string RetrySearch = "button-retry-search";
[TranslationReference("author")]
const string CreatedBy = "created-by";
const string CreatedBy = "label-created-by";
readonly int blinkTickLength = 10;
bool installHighlighted;

View File

@@ -18,13 +18,13 @@ namespace OpenRA.Mods.Common.Widgets.Logic
public class SpawnSelectorTooltipLogic : ChromeLogic
{
[TranslationReference]
const string DisabledSpawn = "disabled-spawn";
const string DisabledSpawn = "label-disabled-spawn";
[TranslationReference]
const string AvailableSpawn = "available-spawn";
const string AvailableSpawn = "label-available-spawn";
[TranslationReference("team")]
const string TeamNumber = "team-number";
const string TeamNumber = "label-team-name";
readonly CachedTransform<int, string> teamMessage;