SunnyUI.Net, 基於 C# .Net WinForm 開源控制項庫、工具類庫、擴展類庫、多頁面開發框架 Blog: https://www.cnblogs.com/yhuse Gitee: https://gitee.com/yhuse/SunnyUI GitHub: https://git ...
SunnyUI.Net, 基於 C# .Net WinForm 開源控制項庫、工具類庫、擴展類庫、多頁面開發框架
國際化
SunnyUI控制項內部預設使用中文,若希望使用其他語言,則需要進行多語言設置。
public static class UILocalize { public static string InfoTitle = "提示"; public static string SuccessTitle = "正確"; public static string WarningTitle = "警告"; public static string ErrorTitle = "錯誤"; public static string AskTitle = "提示"; public static string InputTitle = "輸入"; public static string CloseAll = "全部關閉"; public static string OK = "確定"; public static string Cancel = "取消"; public static string GridNoData = "[ 無數據 ]"; public static string GridDataLoading = "數據載入中 ......"; public static string GridDataSourceException = "數據源必須為DataTable或者List"; }
可以重寫UILocalize類靜態變數值來改變語言。
UILocalizeHelper類已經包含中文和英文的預設配置函數:public static class UILocalizeHelper { public static void SetEN() { UILocalize.InfoTitle = "Info"; UILocalize.SuccessTitle = "Success"; UILocalize.WarningTitle = "Warning"; UILocalize.ErrorTitle = "Error"; UILocalize.AskTitle = "Query"; UILocalize.InputTitle = "Input"; UILocalize.CloseAll = "Close all"; UILocalize.OK = "OK"; UILocalize.Cancel = "Cancel"; UILocalize.GridNoData = "[ No data ]"; UILocalize.GridDataLoading = "Data loading ......"; UILocalize.GridDataSourceException = "The data source must be DataTable or List"; } public static void SetCH() { UILocalize.InfoTitle = "提示"; UILocalize.SuccessTitle = "正確"; UILocalize.WarningTitle = "警告"; UILocalize.ErrorTitle = "錯誤"; UILocalize.AskTitle = "提示"; UILocalize.InputTitle = "輸入"; UILocalize.CloseAll = "全部關閉"; UILocalize.OK = "確定"; UILocalize.Cancel = "取消"; UILocalize.GridNoData = "[ 無數據 ]"; UILocalize.GridDataLoading = "數據載入中 ......"; UILocalize.GridDataSourceException = "數據源必須為DataTable或者List"; } }如需要其他語言,則在自己程式里寫函數更新UILocalize類靜態變數值即可。 顯示效果如下: 中文: 英文: