码迷,mamicode.com
首页 > Web开发 > 详细

[原创][开源] SunnyUI.Net 国际化

时间:2020-05-25 23:42:51      阅读:136      评论:0      收藏:0      [点我收藏+]

标签:git   data   cond   配置   nbsp   grid   inpu   alt   uil   

SunnyUI.Net, 基于 C# .Net WinForm 开源控件库、工具类库、扩展类库、多页面开发框架

技术图片

国际化

SunnyUI控件内部默认使用中文,若希望使用其他语言,则需要进行多语言设置。

常用的按钮、标题、提示等文字已经设置为静态字符串变量,存于ULocalize.cs文件中。

    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类静态变量值即可。
显示效果如下:
中文:
技术图片 技术图片
英文:
技术图片 技术图片
 

原创文章,转载请保留链接 Sunny‘s blog

[原创][开源] SunnyUI.Net 国际化

标签:git   data   cond   配置   nbsp   grid   inpu   alt   uil   

原文地址:https://www.cnblogs.com/yhuse/p/12961718.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!