惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

V
Visual Studio Blog
爱范儿
爱范儿
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
雷峰网
雷峰网
V
V2EX
博客园_首页
Engineering at Meta
Engineering at Meta
博客园 - 聂微东
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Apple Machine Learning Research
Apple Machine Learning Research
GbyAI
GbyAI
H
Help Net Security
A
About on SuperTechFans
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Blog — PlanetScale
Blog — PlanetScale
W
WeLiveSecurity
云风的 BLOG
云风的 BLOG
D
Docker
Security Archives - TechRepublic
Security Archives - TechRepublic
Help Net Security
Help Net Security
N
News and Events Feed by Topic
Simon Willison's Weblog
Simon Willison's Weblog
G
Google Developers Blog
A
Arctic Wolf
T
The Blog of Author Tim Ferriss
博客园 - 叶小钗
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Google DeepMind News
Google DeepMind News
博客园 - 三生石上(FineUI控件)
aimingoo的专栏
aimingoo的专栏
Hacker News: Ask HN
Hacker News: Ask HN
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
博客园 - 司徒正美
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
P
Privacy International News Feed
T
Troy Hunt's Blog
T
Tenable Blog
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
Recent Commits to openclaw:main
Recent Commits to openclaw:main
Recorded Future
Recorded Future
F
Fortinet All Blogs
D
DataBreaches.Net
B
Blog
T
Threat Research - Cisco Blogs
MyScale Blog
MyScale Blog
Hacker News - Newest:
Hacker News - Newest: "LLM"
The GitHub Blog
The GitHub Blog
Security Latest
Security Latest
M
MIT News - Artificial intelligence

博客园 - yhuse

MiniMax 权益码 Token Plan 套餐 9 折优惠,Token Plan 共建邀请计划 至2026.7.31 MiniMax 权益码 Token Plan 套餐 9 折优惠,Token Plan 共建邀请计划 至2026.7.31 MiniMax 权益码 Token Plan 套餐 9 折优惠,Token Plan 共建邀请计划 至2026.7.31 MiniMax 权益码 Token Plan 套餐 9 折优惠,至2026.6.30 MiniMax 权益码 Token Plan 套餐 9 折优惠,至2026.6.30 MiniMax 权益码 Token Plan 套餐 9 折优惠 MiniMax 权益码 Token Plan 套餐 9 折优惠 MiniMax 权益码 Token Plan 套餐 9 折优惠 WinForms 内置的公共系统级别编辑器 科技衰退,CodeProject.com 关闭了 DataView RowFilter Syntax [C#] [原创][开源]C# Winform DPI自适应方案,SunnyUI三步搞定 .NET Standard 对 .NET 的每个实现的支持 NuGet 包版本引用 | Microsoft Docs C# Winform窗体继承过程中,TableLayoutPanel是不支持继承的 VS2022安装.NetFramework4.0目标包的方法 VS2022禁用全局using,禁用GlobalUsings.g.cs Ubuntu下libpcap安装步骤 Ubuntu 18.04 安装.net 5 .Net Framework各版本微软技术支持及到期日期 TargetFrameworks输出多版本类库,SDK 样式项目中的目标框架 [原创][开源] SunnyUI.Net 常见问题答疑 [原创][开源] SunnyUI.Net 开发日志:UIBarChart 坐标轴刻度取值算法 [原创][开源] SunnyUI.Net 主题 [原创][开源] SunnyUI.Net 字体图标 [原创][开源] SunnyUI.Net 安装 [原创][开源] SunnyUI.Net 开发日志:UIListBox 增加跟随鼠标滑过高亮
[原创][开源] SunnyUI.Net 国际化
yhuse · 2020-05-25 · via 博客园 - yhuse

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:C# .Net WinForm开源控件库、工具类库、扩展类库、多页面开发框架;Sunny's blog:https://www.cnblogs.com/yhuse