diff --git a/SunnyUI/Common/ULocalize.cs b/SunnyUI/Style/UBuiltInResources.cs
similarity index 84%
rename from SunnyUI/Common/ULocalize.cs
rename to SunnyUI/Style/UBuiltInResources.cs
index 69c6e209..f07acb79 100644
--- a/SunnyUI/Common/ULocalize.cs
+++ b/SunnyUI/Style/UBuiltInResources.cs
@@ -24,69 +24,6 @@ using System.Globalization;
namespace Sunny.UI
{
- public static class CultureInfos
- {
- //语言文件对应ID网址
- //https://docs.microsoft.com/en-us/previous-versions/windows/embedded/ms912047(v=winembedded.10)?redirectedfrom=MSDN
- //ID语言 ID语言
- //1025 阿拉伯语
- //1041 日语
- //1028 繁体中文
- //1042 朝鲜语
- //1029 捷克语
- //1043 荷兰语
- //1030 丹麦语
- //1044 挪威语
- //1031 德语
- //1045 波兰语
- //1032 希腊语
- //1046 葡萄牙语 - 巴西
- //1033 英语
- //1049 俄语
- //1034 西班牙语
- //1053 瑞典语
- //1035 芬兰语
- //1054 泰语
- //1036 法语
- //1055 土耳其语
- //1037 希伯来语
- //2052 简体中文
- //1038 匈牙利语
- //2070 葡萄牙语
- //1040 意大利语
- //3076 汉语 - 香港
-
- ///
- /// 2052 简体中文
- ///
- public const int LCID_zh_CN = 2052;
-
- ///
- /// 1028 繁体中文
- ///
- public const int LCID_zh_TW = 1028;
-
- ///
- /// 1033 英语
- ///
- public const int LCID_en_US = 1033;
-
- ///
- /// 2052 简体中文
- ///
- public static readonly CultureInfo zh_CN = CultureInfo.GetCultureInfo(LCID_zh_CN);
-
- ///
- /// 1028 繁体中文
- ///
- public static readonly CultureInfo zh_TW = CultureInfo.GetCultureInfo(LCID_zh_TW);
-
- ///
- /// 1033 英语
- ///
- public static readonly CultureInfo en_US = CultureInfo.GetCultureInfo(LCID_en_US);
- }
-
public class zh_CN_Resources : UIBuiltInResources
{
public override CultureInfo CultureInfo => CultureInfos.zh_CN;
diff --git a/SunnyUI/Style/UCultureInfo.cs b/SunnyUI/Style/UCultureInfo.cs
new file mode 100644
index 00000000..e8b6b3ca
--- /dev/null
+++ b/SunnyUI/Style/UCultureInfo.cs
@@ -0,0 +1,67 @@
+using System.Globalization;
+
+namespace Sunny.UI
+{
+ public static class CultureInfos
+ {
+ //语言文件对应ID网址
+ //https://docs.microsoft.com/en-us/previous-versions/windows/embedded/ms912047(v=winembedded.10)?redirectedfrom=MSDN
+ //ID语言 ID语言
+ //1025 阿拉伯语
+ //1041 日语
+ //1028 繁体中文
+ //1042 朝鲜语
+ //1029 捷克语
+ //1043 荷兰语
+ //1030 丹麦语
+ //1044 挪威语
+ //1031 德语
+ //1045 波兰语
+ //1032 希腊语
+ //1046 葡萄牙语 - 巴西
+ //1033 英语
+ //1049 俄语
+ //1034 西班牙语
+ //1053 瑞典语
+ //1035 芬兰语
+ //1054 泰语
+ //1036 法语
+ //1055 土耳其语
+ //1037 希伯来语
+ //2052 简体中文
+ //1038 匈牙利语
+ //2070 葡萄牙语
+ //1040 意大利语
+ //3076 汉语 - 香港
+
+ ///
+ /// 2052 简体中文
+ ///
+ public const int LCID_zh_CN = 2052;
+
+ ///
+ /// 1028 繁体中文
+ ///
+ public const int LCID_zh_TW = 1028;
+
+ ///
+ /// 1033 英语
+ ///
+ public const int LCID_en_US = 1033;
+
+ ///
+ /// 2052 简体中文
+ ///
+ public static readonly CultureInfo zh_CN = CultureInfo.GetCultureInfo(LCID_zh_CN);
+
+ ///
+ /// 1028 繁体中文
+ ///
+ public static readonly CultureInfo zh_TW = CultureInfo.GetCultureInfo(LCID_zh_TW);
+
+ ///
+ /// 1033 英语
+ ///
+ public static readonly CultureInfo en_US = CultureInfo.GetCultureInfo(LCID_en_US);
+ }
+}
diff --git a/SunnyUI/Style/UTranslate.cs b/SunnyUI/Style/UTranslate.cs
index f74532e8..61c8c703 100644
--- a/SunnyUI/Style/UTranslate.cs
+++ b/SunnyUI/Style/UTranslate.cs
@@ -54,16 +54,74 @@ namespace Sunny.UI
public static class TranslateHelper
{
- private static List Ingores =
+ private static List Ignores =
[
"UIContextMenuStrip",
"UIStyleManager",
"UILogo",
"UIPagination",
- "UIMiniPagination"
+ "UIMiniPagination",
+ "UIAnalogMeter",
+ "UIBattery",
+ "UICalendar",
+ "UIColorPicker",
+ "UIComboBox",
+ "UIComboDataGridView",
+ "UIComboTreeView",
+ "UIDataGridViewFooter",
+ "UIDatePicker",
+ "UIDateTimePicker",
+ "UIDigitalLabel",
+ "UIDoubleUpDown",
+ "UIEdit",
+ "UIFlowLayoutPanel",
+ "UIGifAvatar",
+ "UIHorScrollBar",
+ "UIHorScrollBarEx",
+ "UIImageListBox",
+ "UIIntegerUpDown",
+ "UIIPTextBox",
+ "UILedBulb",
+ "UILedStopwatch",
+ "UILight",
+ "UIListBox",
+ "UIListBoxEx",
+ "UIMillisecondTimer",
+ "UINavMenu",
+ "UINumPadTextBox",
+ "UIPipe",
+ "UIProgressIndicator",
+ "UIProcessBar",
+ "UIRichTextBox",
+ "UIRoundMeter",
+ "UIRoundProcess",
+ "UIRuler",
+ "UIScrollBar",
+ "UISignal",
+ "UISplitContainer",
+ "UITabControl",
+ "UITabControlMenu",
+ "UITableLayoutPanel",
+ "UITextBox",
+ "UIThermometer",
+ "UITimePicker",
+ "UIToolTip",
+ "UITrackBar",
+ "UITransfer",
+ "UITransparentPanel",
+ "UITreeView",
+ "UIValve",
+ "UIVerificationCode",
+ "UIVerScrollBarEx",
+ "UIWaitingBar",
+ "UIBarChart",
+ "UIChart",
+ "UIDoughnutChart",
+ "UILineChart",
+ "UIPieChart"
];
- private static List Needs =
+ private static List Includes =
[
"System.Windows.Forms.ToolStripMenuItem"
];
@@ -134,9 +192,9 @@ namespace Sunny.UI
string name = items[2].Replace(";", "");
string classname = items[1];
- if (Ingores.Contains(classname)) continue;
+ if (Ignores.Contains(classname)) continue;
- if (classname.SplitLast(".").StartsWith("UI") || Needs.Contains(classname))
+ if (classname.SplitLast(".").StartsWith("UI") || Includes.Contains(classname))
{
ctrladds.TryGetValue("this." + name, out string parent);
if (parent.IsValid())
@@ -279,12 +337,14 @@ namespace Sunny.UI
{
}
+ public static void Load(Form form) => Current.LoadResources(form);
+
///
/// 实体对象
///
private static TConfig current;
- public void Load(Form form)
+ private void LoadResources(Form form)
{
if (!UIStyles.MultiLanguageSupport) return;
if (!(form is UIBaseForm || form is UIPage)) return;
@@ -339,7 +399,7 @@ namespace Sunny.UI
}
}
- private static ConcurrentDictionary InitIdents(T config)
+ private ConcurrentDictionary InitIdents(T config)
{
ConcurrentDictionary concurrentDictionary = new ConcurrentDictionary();
foreach (PropertyInfo needProperty in config.GetType().GetNeedProperties())
@@ -381,7 +441,7 @@ namespace Sunny.UI
return concurrentDictionary;
}
- private static void LoadConfigValue(T config, ConcurrentDictionary idents)
+ private void LoadConfigValue(T config, ConcurrentDictionary idents)
{
foreach (PropertyInfo needProperty in config.GetType().GetNeedProperties())
{