规范类名及命名空间名称

This commit is contained in:
李伟
2026-04-13 14:35:37 +08:00
parent c430ec229b
commit ace1c70ddf
217 changed files with 1271 additions and 1384 deletions
@@ -0,0 +1,50 @@
using System.Globalization;
using System.Resources;
namespace XP.ImageProcessing.CfgControl;
/// <summary>
/// 本地化辅助类,用于管理多语言资源
/// ?ImageProcessing 主项目的语言设置同步
/// </summary>
public static class LocalizationHelper
{
private static ResourceManager? _resourceManager;
/// <summary>
/// 资源管理?
/// </summary>
private static ResourceManager ResourceManager
{
get
{
if (_resourceManager == null)
{
_resourceManager = new ResourceManager(
"XP.ImageProcessing.CfgControl.Resources.Resources",
typeof(LocalizationHelper).Assembly);
}
return _resourceManager;
}
}
/// <summary>
/// 获取本地化字符串
/// 使用当前 UI 文化(与主项目同步)
/// </summary>
/// <param name="key">资源?/param>
/// <returns>本地化字符串</returns>
public static string GetString(string key)
{
try
{
// 使用 CultureInfo.CurrentUICulture,这会自动与主项目的语言设置同步
var value = ResourceManager.GetString(key, CultureInfo.CurrentUICulture);
return value ?? key;
}
catch
{
return key;
}
}
}