Localise text notifications.
This commit is contained in:
committed by
abcdefg30
parent
c041ea7d39
commit
44aaf4dd07
@@ -571,6 +571,9 @@ namespace OpenRA
|
|||||||
public static void RunAfterTick(Action a) { delayedActions.Add(a, RunTime); }
|
public static void RunAfterTick(Action a) { delayedActions.Add(a, RunTime); }
|
||||||
public static void RunAfterDelay(int delayMilliseconds, Action a) { delayedActions.Add(a, RunTime + delayMilliseconds); }
|
public static void RunAfterDelay(int delayMilliseconds, Action a) { delayedActions.Add(a, RunTime + delayMilliseconds); }
|
||||||
|
|
||||||
|
[TranslationReference("filename")]
|
||||||
|
static readonly string SavedScreenshot = "saved-screenshot";
|
||||||
|
|
||||||
static void TakeScreenshotInner()
|
static void TakeScreenshotInner()
|
||||||
{
|
{
|
||||||
using (new PerfTimer("Renderer.SaveScreenshot"))
|
using (new PerfTimer("Renderer.SaveScreenshot"))
|
||||||
@@ -584,7 +587,7 @@ namespace OpenRA
|
|||||||
Log.Write("debug", "Taking screenshot " + path);
|
Log.Write("debug", "Taking screenshot " + path);
|
||||||
|
|
||||||
Renderer.SaveScreenshot(path);
|
Renderer.SaveScreenshot(path);
|
||||||
TextNotificationsManager.Debug("Saved screenshot " + filename);
|
TextNotificationsManager.Debug(ModData.Translation.GetString(SavedScreenshot, Translation.Arguments("filename", filename)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,6 +24,9 @@ namespace OpenRA.Mods.Common.Commands
|
|||||||
{
|
{
|
||||||
public Dictionary<string, IChatCommand> Commands { get; }
|
public Dictionary<string, IChatCommand> Commands { get; }
|
||||||
|
|
||||||
|
[TranslationReference("name")]
|
||||||
|
static readonly string InvalidCommand = "invalid-command";
|
||||||
|
|
||||||
public ChatCommands()
|
public ChatCommands()
|
||||||
{
|
{
|
||||||
Commands = new Dictionary<string, IChatCommand>();
|
Commands = new Dictionary<string, IChatCommand>();
|
||||||
@@ -39,7 +42,7 @@ namespace OpenRA.Mods.Common.Commands
|
|||||||
if (command.Value != null)
|
if (command.Value != null)
|
||||||
command.Value.InvokeCommand(name.ToLowerInvariant(), message.Substring(1 + name.Length).Trim());
|
command.Value.InvokeCommand(name.ToLowerInvariant(), message.Substring(1 + name.Length).Trim());
|
||||||
else
|
else
|
||||||
TextNotificationsManager.Debug("{0} is not a valid command.", name);
|
TextNotificationsManager.Debug(Game.ModData.Translation.GetString(InvalidCommand, Translation.Arguments("name", name)));
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,6 +24,12 @@ namespace OpenRA.Mods.Common.Commands
|
|||||||
|
|
||||||
public class DevCommands : IChatCommand, IWorldLoaded
|
public class DevCommands : IChatCommand, IWorldLoaded
|
||||||
{
|
{
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string CheatsDisabled = "cheats-disabled";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string InvalidCashAmount = "invalid-cash-amount";
|
||||||
|
|
||||||
readonly IDictionary<string, (string Description, Action<string, World> Handler)> commandHandlers = new Dictionary<string, (string, Action<string, World>)>
|
readonly IDictionary<string, (string Description, Action<string, World> Handler)> commandHandlers = new Dictionary<string, (string, Action<string, World>)>
|
||||||
{
|
{
|
||||||
{ "visibility", ("toggles visibility checks and minimap.", Visibility) },
|
{ "visibility", ("toggles visibility checks and minimap.", Visibility) },
|
||||||
@@ -70,7 +76,7 @@ namespace OpenRA.Mods.Common.Commands
|
|||||||
|
|
||||||
if (!developerMode.Enabled)
|
if (!developerMode.Enabled)
|
||||||
{
|
{
|
||||||
TextNotificationsManager.Debug("Cheats are disabled.");
|
TextNotificationsManager.Debug(Game.ModData.Translation.GetString(CheatsDisabled));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -98,7 +104,7 @@ namespace OpenRA.Mods.Common.Commands
|
|||||||
giveCashOrder.ExtraData = (uint)cash;
|
giveCashOrder.ExtraData = (uint)cash;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
TextNotificationsManager.Debug("Invalid amount of cash.");
|
TextNotificationsManager.Debug(Game.ModData.Translation.GetString(InvalidCashAmount));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -23,6 +23,12 @@ namespace OpenRA.Mods.Common.Commands
|
|||||||
{
|
{
|
||||||
readonly Dictionary<string, string> helpDescriptions;
|
readonly Dictionary<string, string> helpDescriptions;
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string AvailableCommands = "available-commands";
|
||||||
|
|
||||||
|
[TranslationReference]
|
||||||
|
static readonly string NoDescription = "no-description";
|
||||||
|
|
||||||
World world;
|
World world;
|
||||||
ChatCommands console;
|
ChatCommands console;
|
||||||
|
|
||||||
@@ -42,14 +48,14 @@ namespace OpenRA.Mods.Common.Commands
|
|||||||
|
|
||||||
public void InvokeCommand(string name, string arg)
|
public void InvokeCommand(string name, string arg)
|
||||||
{
|
{
|
||||||
TextNotificationsManager.Debug("Here are the available commands:");
|
TextNotificationsManager.Debug(Game.ModData.Translation.GetString(AvailableCommands));
|
||||||
|
|
||||||
foreach (var key in console.Commands.Keys)
|
foreach (var key in console.Commands.Keys)
|
||||||
{
|
{
|
||||||
if (!helpDescriptions.TryGetValue(key, out var description))
|
if (!helpDescriptions.TryGetValue(key, out var description))
|
||||||
description = "no description available.";
|
description = Game.ModData.Translation.GetString(NoDescription);
|
||||||
|
|
||||||
TextNotificationsManager.Debug("{0}: {1}", key, description);
|
TextNotificationsManager.Debug($"{key}: {description}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -106,6 +106,9 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
|
|
||||||
bool enableAll;
|
bool enableAll;
|
||||||
|
|
||||||
|
[TranslationReference("cheat", "player", "suffix")]
|
||||||
|
static readonly string CheatUsed = "cheat-used";
|
||||||
|
|
||||||
public DeveloperMode(DeveloperModeInfo info)
|
public DeveloperMode(DeveloperModeInfo info)
|
||||||
{
|
{
|
||||||
this.info = info;
|
this.info = info;
|
||||||
@@ -273,7 +276,8 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
TextNotificationsManager.Debug("Cheat used: {0} by {1}{2}", order.OrderString, self.Owner.PlayerName, debugSuffix);
|
var arguments = Translation.Arguments("cheat", order.OrderString, "player", self.Owner.PlayerName, "suffix", debugSuffix);
|
||||||
|
TextNotificationsManager.Debug(Game.ModData.Translation.GetString(CheatUsed, arguments));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IUnlocksRenderPlayer.RenderPlayerUnlocked => Enabled;
|
bool IUnlocksRenderPlayer.RenderPlayerUnlocked => Enabled;
|
||||||
|
|||||||
@@ -590,3 +590,20 @@ password-protected = Password protected
|
|||||||
waiting-for-players = Waiting for players
|
waiting-for-players = Waiting for players
|
||||||
server-shutting-down = Server shutting down
|
server-shutting-down = Server shutting down
|
||||||
unknown-server-state = Unknown server state
|
unknown-server-state = Unknown server state
|
||||||
|
|
||||||
|
## Game
|
||||||
|
saved-screenshot = Saved screenshot { $filename }
|
||||||
|
|
||||||
|
## ChatCommands
|
||||||
|
invalid-command = { $name } is not a valid command.
|
||||||
|
|
||||||
|
## DevCommands
|
||||||
|
cheats-disabled = Cheats are disabled.
|
||||||
|
invalid-cash-amount = Invalid amount of cash.
|
||||||
|
|
||||||
|
## HelpCommands
|
||||||
|
available-commands = Here are the available commands:
|
||||||
|
no-description = no description available.
|
||||||
|
|
||||||
|
## DeveloperMode
|
||||||
|
cheat-used = Cheat used: { $cheat } by { $player }{ $suffix }
|
||||||
|
|||||||
Reference in New Issue
Block a user