[original] [open source] SunnyUI.Net internationalization

SunnyUI.Net Based on C ා net WinForm open source control library, tool class library, extended class library and multi page development framework

internationalization

SunnyUI control uses Chinese by default. If you want to use other languages, you need to set multi languages.

Commonly used buttons, titles, prompts and other text have been set as static string variables, stored in ULocalize.cs File.

    public static class UILocalize
    {
        public static string InfoTitle = "Tips";
        public static string SuccessTitle = "correct";
        public static string WarningTitle = "warning";
        public static string ErrorTitle = "error";
        public static string AskTitle = "Tips";
        public static string InputTitle = "input";
        public static string CloseAll = "close all";
        public static string OK = "determine";
        public static string Cancel = "cancel";
        public static string GridNoData = "[ No data ]";
        public static string GridDataLoading = "Data loading ......";
        public static string GridDataSourceException = "Data source must be DataTable perhaps List";
    }

 

You can override the static variable value of the UILocalize class to change the language.

The UILocalizeHelper class already contains default configuration functions in Chinese and English:
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 = "Tips";
            UILocalize.SuccessTitle = "correct";
            UILocalize.WarningTitle = "warning";
            UILocalize.ErrorTitle = "error";
            UILocalize.AskTitle = "Tips";
            UILocalize.InputTitle = "input";
            UILocalize.CloseAll = "close all";
            UILocalize.OK = "determine";
            UILocalize.Cancel = "cancel";
            UILocalize.GridNoData = "[ No data ]";
            UILocalize.GridDataLoading = "Data loading ......";
            UILocalize.GridDataSourceException = "Data source must be DataTable perhaps List";
        }
    }
If you need other languages, you can write functions in your own programs to update the static variable values of the UILocalize class.
The display effect is as follows:
chinese:
 
english:
 
 

Original article, reprint please keep the link Sunny's blog

Tags: C# github

Posted on Tue, 26 May 2020 11:05:45 -0400 by bobob