feat: messagebox title localize

This commit is contained in:
Myssal
2025-04-27 22:06:45 +07:00
parent ca7a40044c
commit 7635adf637
13 changed files with 67 additions and 22 deletions

View File

@@ -224,7 +224,7 @@ namespace SpineViewer.Controls
{
if (validPaths.Count > 100)
{
if (MessagePopup.Quest($"{Properties.Resources.loadAllSkeletonPrefix}{validPaths.Count}{Properties.Resources.loadAllSkeletonSuffix}") == DialogResult.Cancel)
if (MessagePopup.Quest($"{Properties.Resources.loadAllSkeletonPrefix}{validPaths.Count}{Properties.Resources.loadAllSkeletonSuffix}", Properties.Resources.msgBoxQuest) == DialogResult.Cancel)
return;
}
BatchAdd(new Dialogs.BatchOpenSpineDialogResult(SpineVersion.Auto, validPaths.ToArray()));
@@ -413,7 +413,7 @@ namespace SpineViewer.Controls
if (listView.SelectedIndices.Count > 1)
{
if (MessagePopup.Quest($"{Properties.Resources.removeItemConfirmPrefix} {listView.SelectedIndices.Count} {Properties.Resources.removeItemConfirmSuffix}") != DialogResult.OK)
if (MessagePopup.Quest($"{Properties.Resources.removeItemConfirmPrefix} {listView.SelectedIndices.Count} {Properties.Resources.removeItemConfirmSuffix}", Properties.Resources.msgBoxQuest) != DialogResult.OK)
return;
}
@@ -513,7 +513,7 @@ namespace SpineViewer.Controls
if (listView.Items.Count <= 0)
return;
if (MessagePopup.Quest($"{Properties.Resources.removeAllItemPrefix} {listView.Items.Count} {Properties.Resources.removeItemConfirmSuffix}") != DialogResult.OK)
if (MessagePopup.Quest($"{Properties.Resources.removeAllItemPrefix} {listView.Items.Count} {Properties.Resources.removeItemConfirmSuffix}", Properties.Resources.msgBoxQuest) != DialogResult.OK)
return;
listView.Items.Clear();

View File

@@ -494,7 +494,7 @@ namespace SpineViewer.Controls
{
logger.Fatal(ex.ToString());
logger.Fatal("Render task stopped");
MessagePopup.Error(ex.ToString(), "预览画面已停止渲染");
MessagePopup.Error(ex.ToString(), "预览画面已停止渲染", Properties.Resources.msgBoxError);
}
finally
{

View File

@@ -36,7 +36,7 @@ namespace SpineViewer.Dialogs
if (items.Count <= 0)
{
MessagePopup.Info("未选择任何文件");
MessagePopup.Info("未选择任何文件", Properties.Resources.msgBoxInfo);
return;
}
@@ -44,14 +44,14 @@ namespace SpineViewer.Dialogs
{
if (!File.Exists(p))
{
MessagePopup.Info($"{p}", "skel文件不存在");
MessagePopup.Info($"{p}", Properties.Resources.skelNotExist);
return;
}
}
if (version != SpineVersion.Auto && !Spine.SpineObject.HasImplementation(version))
{
MessagePopup.Info($"{version.GetName()} 版本尚未实现(咕咕咕~");
MessagePopup.Info($"{version.GetName()} 版本尚未实现(咕咕咕~", Properties.Resources.msgBoxInfo);
return;
}

View File

@@ -59,7 +59,7 @@ namespace SpineViewer.Dialogs
if (items.Count <= 0)
{
MessagePopup.Info("未选择任何文件");
MessagePopup.Info("未选择任何文件", Properties.Resources.msgBoxInfo);
return;
}
@@ -72,7 +72,7 @@ namespace SpineViewer.Dialogs
outputDir = Path.GetFullPath(outputDir);
if (!Directory.Exists(outputDir))
{
if (MessagePopup.Quest("输出文件夹不存在,是否创建?") == DialogResult.OK)
if (MessagePopup.Quest("输出文件夹不存在,是否创建?", Properties.Resources.msgBoxQuest) == DialogResult.OK)
{
try
{
@@ -82,7 +82,7 @@ namespace SpineViewer.Dialogs
{
logger.Error(ex.ToString());
logger.Error("Failed to create output dir {}", outputDir);
MessagePopup.Error(ex.ToString());
MessagePopup.Error(ex.ToString(), Properties.Resources.msgBoxError);
return;
}
}
@@ -97,20 +97,20 @@ namespace SpineViewer.Dialogs
{
if (!File.Exists(p))
{
MessagePopup.Info($"{p}", "skel文件不存在");
MessagePopup.Info($"{p}", Properties.Resources.skelNotExist);
return;
}
}
if (sourceVersion != SpineVersion.Auto && !SkeletonConverter.HasImplementation(sourceVersion))
{
MessagePopup.Info($"{sourceVersion.GetName()} 版本尚未实现(咕咕咕~");
MessagePopup.Info($"{sourceVersion.GetName()} 版本尚未实现(咕咕咕~", Properties.Resources.msgBoxInfo);
return;
}
if (!SkeletonConverter.HasImplementation(targetVersion))
{
MessagePopup.Info($"{targetVersion.GetName()} 版本尚未实现(咕咕咕~");
MessagePopup.Info($"{targetVersion.GetName()} 版本尚未实现(咕咕咕~", Properties.Resources.msgBoxInfo);
return;
}

View File

@@ -93,7 +93,7 @@ namespace SpineViewer.Dialogs
var properties = selectedObject.GetType().GetProperties();
var result = string.Join(Environment.NewLine, properties.Select(p => $"{p.Name}\t{p.GetValue(selectedObject)?.ToString()}"));
Clipboard.SetText(result);
MessagePopup.Info("已复制");
MessagePopup.Info("已复制", Properties.Resources.msgBoxInfo);
}
}
}

View File

@@ -65,7 +65,7 @@ namespace SpineViewer.Dialogs
{
if (wrapper.Exporter.Validate() is string error)
{
MessagePopup.Info(error, "参数错误");
MessagePopup.Info(error, Properties.Resources.parameterError);
return;
}
DialogResult = DialogResult.OK;

View File

@@ -58,7 +58,7 @@ namespace SpineViewer.Dialogs
if (!File.Exists(skelPath))
{
MessagePopup.Info($"{skelPath}", "skel文件不存在");
MessagePopup.Info($"{skelPath}", Properties.Resources.skelNotExist);
return;
}
else
@@ -72,7 +72,7 @@ namespace SpineViewer.Dialogs
}
else if (!File.Exists(atlasPath))
{
MessagePopup.Info($"{atlasPath}", "atlas文件不存在");
MessagePopup.Info($"{atlasPath}", Properties.Resources.atlasNotExist);
return;
}
else
@@ -82,7 +82,7 @@ namespace SpineViewer.Dialogs
if (version != SpineVersion.Auto && !Spine.SpineObject.HasImplementation(version))
{
MessagePopup.Info($"{version.GetName()} 版本尚未实现(咕咕咕~");
MessagePopup.Info($"{version.GetName()} 版本尚未实现(咕咕咕~", Properties.Resources.msgBoxInfo);
return;
}

View File

@@ -52,7 +52,7 @@ namespace SpineViewer.Dialogs
if (e.Error != null)
{
logger.Error(e.Error.ToString());
MessagePopup.Error(e.Error.ToString(), "执行出错");
MessagePopup.Error(e.Error.ToString(), "执行出错", Properties.Resources.msgBoxError);
DialogResult = DialogResult.Abort;
}
else if (e.Cancelled)

View File

@@ -30,7 +30,7 @@ namespace SpineViewer
{
logger.Error(ex.ToString());
logger.Error("Failed to load fragment shader");
MessagePopup.Warn("Fragment shader 加载失败预乘Alpha通道属性失效");
MessagePopup.Warn("Fragment shader 加载失败预乘Alpha通道属性失效", Properties.Resources.msgBoxWarning);
}
#if DEBUG
@@ -103,7 +103,7 @@ namespace SpineViewer
private void toolStripMenuItem_ExportFrame_Click(object sender, EventArgs e)
{
if (spinePreviewPanel.IsUpdating && MessagePopup.Quest("画面仍在更新,建议手动暂停画面后导出固定的一帧,是否继续?") != DialogResult.OK)
if (spinePreviewPanel.IsUpdating && MessagePopup.Quest("画面仍在更新,建议手动暂停画面后导出固定的一帧,是否继续?", Properties.Resources.msgBoxQuest) != DialogResult.OK)
return;
var k = nameof(toolStripMenuItem_ExportFrame);

View File

@@ -59,7 +59,7 @@ namespace SpineViewer
catch (Exception ex)
{
logger.Fatal(ex.ToString());
MessagePopup.Error(ex.ToString(), "程序已崩溃");
MessagePopup.Error(ex.ToString(), "程序已崩溃", Properties.Resources.msgBoxError);
}
}

View File

@@ -69,6 +69,15 @@ namespace SpineViewer.Properties {
}
}
/// <summary>
/// Looks up a localized string similar to atlas文件不存在.
/// </summary>
internal static string atlasNotExist {
get {
return ResourceManager.GetString("atlasNotExist", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to 自定义.
/// </summary>
@@ -330,6 +339,15 @@ namespace SpineViewer.Properties {
}
}
/// <summary>
/// Looks up a localized string similar to 参数错误.
/// </summary>
internal static string parameterError {
get {
return ResourceManager.GetString("parameterError", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to 已处理 .
/// </summary>
@@ -383,5 +401,14 @@ namespace SpineViewer.Properties {
return ResourceManager.GetString("restartTitle", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to skel文件不存在.
/// </summary>
internal static string skelNotExist {
get {
return ResourceManager.GetString("skelNotExist", resourceCulture);
}
}
}
}

View File

@@ -120,6 +120,9 @@
<data name="about" xml:space="preserve">
<value>About</value>
</data>
<data name="atlasNotExist" xml:space="preserve">
<value>Atlas file doesn't exist.</value>
</data>
<data name="categoryCustom" xml:space="preserve">
<value>Custom</value>
</data>
@@ -207,6 +210,9 @@
<data name="notifyCopyGithubLink" xml:space="preserve">
<value>Link copied to clipboard. Please open it in browser</value>
</data>
<data name="parameterError" xml:space="preserve">
<value>Invalid Parameters</value>
</data>
<data name="process" xml:space="preserve">
<value>Processed </value>
</data>
@@ -225,4 +231,7 @@
<data name="restartTitle" xml:space="preserve">
<value>Application restart required!</value>
</data>
<data name="skelNotExist" xml:space="preserve">
<value>Skel file doesn't exist.</value>
</data>
</root>

View File

@@ -120,6 +120,9 @@
<data name="about" xml:space="preserve">
<value>关于 </value>
</data>
<data name="atlasNotExist" xml:space="preserve">
<value>atlas文件不存在</value>
</data>
<data name="categoryCustom" xml:space="preserve">
<value>自定义</value>
</data>
@@ -207,6 +210,9 @@
<data name="notifyCopyGithubLink" xml:space="preserve">
<value>链接已复制到剪贴板,请前往浏览器进行访问</value>
</data>
<data name="parameterError" xml:space="preserve">
<value>参数错误</value>
</data>
<data name="process" xml:space="preserve">
<value>已处理 </value>
</data>
@@ -225,4 +231,7 @@
<data name="restartTitle" xml:space="preserve">
<value>需要重新启动应用程序!</value>
</data>
<data name="skelNotExist" xml:space="preserve">
<value>skel文件不存在</value>
</data>
</root>