Extract translation strings.
This commit is contained in:
committed by
Gustas
parent
dfd5a960ed
commit
0b67b5bfae
@@ -33,6 +33,45 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
readonly string defaultSaveFilename;
|
||||
string selectedSave;
|
||||
|
||||
[TranslationReference]
|
||||
static readonly string RenameSaveTitle = "rename-save-title";
|
||||
|
||||
[TranslationReference]
|
||||
static readonly string RenameSavePrompt = "rename-save-prompt";
|
||||
|
||||
[TranslationReference]
|
||||
static readonly string RenameSaveAccept = "rename-save-accept";
|
||||
|
||||
[TranslationReference]
|
||||
static readonly string DeleteSaveTitle = "delete-save-title";
|
||||
|
||||
[TranslationReference("save")]
|
||||
static readonly string DeleteSavePrompt = "delete-save-prompt";
|
||||
|
||||
[TranslationReference]
|
||||
static readonly string DeleteSaveAccept = "delete-save-accept";
|
||||
|
||||
[TranslationReference]
|
||||
static readonly string DeleteAllSavesTitle = "delete-all-saves-title";
|
||||
|
||||
[TranslationReference("count")]
|
||||
static readonly string DeleteAllSavesPrompt = "delete-all-saves-prompt";
|
||||
|
||||
[TranslationReference]
|
||||
static readonly string DeleteAllSavesAccept = "delete-all-saves-accept";
|
||||
|
||||
[TranslationReference("savePath")]
|
||||
static readonly string SaveDeletionFailed = "save-deletion-failed";
|
||||
|
||||
[TranslationReference]
|
||||
static readonly string OverwriteSaveTitle = "overwrite-save-title";
|
||||
|
||||
[TranslationReference("file")]
|
||||
static readonly string OverwriteSavePrompt = "overwrite-save-prompt";
|
||||
|
||||
[TranslationReference]
|
||||
static readonly string OverwriteSaveAccpet = "overwrite-save-accept";
|
||||
|
||||
[ObjectCreator.UseCtor]
|
||||
public GameSaveBrowserLogic(Widget widget, ModData modData, Action onExit, Action onStart, bool isSavePanel, World world)
|
||||
{
|
||||
@@ -100,13 +139,13 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
var initialName = Path.GetFileNameWithoutExtension(selectedSave);
|
||||
var invalidChars = Path.GetInvalidFileNameChars();
|
||||
|
||||
ConfirmationDialogs.TextInputPrompt(
|
||||
"Rename Save",
|
||||
"Enter a new file name:",
|
||||
ConfirmationDialogs.TextInputPrompt(modData,
|
||||
RenameSaveTitle,
|
||||
RenameSavePrompt,
|
||||
initialName,
|
||||
onAccept: newName => Rename(initialName, newName),
|
||||
onCancel: null,
|
||||
acceptText: "Rename",
|
||||
acceptText: RenameSaveAccept,
|
||||
cancelText: null,
|
||||
inputValidator: newName =>
|
||||
{
|
||||
@@ -130,9 +169,10 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
deleteButton.IsDisabled = () => selectedSave == null;
|
||||
deleteButton.OnClick = () =>
|
||||
{
|
||||
ConfirmationDialogs.ButtonPrompt(
|
||||
title: "Delete selected game save?",
|
||||
text: $"Delete '{Path.GetFileNameWithoutExtension(selectedSave)}'?",
|
||||
ConfirmationDialogs.ButtonPrompt(modData,
|
||||
title: DeleteSaveTitle,
|
||||
text: DeleteSavePrompt,
|
||||
textArguments: Translation.Arguments("save", Path.GetFileNameWithoutExtension(selectedSave)),
|
||||
onConfirm: () =>
|
||||
{
|
||||
Delete(selectedSave);
|
||||
@@ -145,7 +185,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
else
|
||||
SelectFirstVisible();
|
||||
},
|
||||
confirmText: "Delete",
|
||||
confirmText: DeleteSaveAccept,
|
||||
onCancel: () => { });
|
||||
};
|
||||
|
||||
@@ -153,9 +193,10 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
deleteAllButton.IsDisabled = () => games.Count == 0;
|
||||
deleteAllButton.OnClick = () =>
|
||||
{
|
||||
ConfirmationDialogs.ButtonPrompt(
|
||||
title: "Delete all game saves?",
|
||||
text: $"Delete {games.Count} game saves?",
|
||||
ConfirmationDialogs.ButtonPrompt(modData,
|
||||
title: DeleteAllSavesTitle,
|
||||
text: DeleteAllSavesPrompt,
|
||||
textArguments: Translation.Arguments("count", games.Count),
|
||||
onConfirm: () =>
|
||||
{
|
||||
foreach (var s in games.ToList())
|
||||
@@ -164,7 +205,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
Ui.CloseWindow();
|
||||
onExit();
|
||||
},
|
||||
confirmText: "Delete All",
|
||||
confirmText: DeleteAllSavesAccept,
|
||||
onCancel: () => { });
|
||||
};
|
||||
|
||||
@@ -251,7 +292,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
TextNotificationsManager.Debug("Failed to delete save file '{0}'. See the logs for details.", savePath);
|
||||
TextNotificationsManager.Debug(modData.Translation.GetString(SaveDeletionFailed, Translation.Arguments("savePath", savePath)));
|
||||
Log.Write("debug", ex.ToString());
|
||||
return;
|
||||
}
|
||||
@@ -319,11 +360,12 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
|
||||
if (selectedSave != null || File.Exists(testPath))
|
||||
{
|
||||
ConfirmationDialogs.ButtonPrompt(
|
||||
title: "Overwrite save game?",
|
||||
text: $"Overwrite {saveTextField.Text}?",
|
||||
ConfirmationDialogs.ButtonPrompt(modData,
|
||||
title: OverwriteSaveTitle,
|
||||
text: OverwriteSavePrompt,
|
||||
textArguments: Translation.Arguments("file", saveTextField.Text),
|
||||
onConfirm: inner,
|
||||
confirmText: "Overwrite",
|
||||
confirmText: OverwriteSaveAccpet,
|
||||
onCancel: () => { });
|
||||
}
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user