+ ITranslate:增加多语翻译接口

This commit is contained in:
Sunny 2021-07-23 23:42:06 +08:00
parent e9946fd631
commit f28138c318
12 changed files with 194 additions and 135 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -30,7 +30,7 @@ using System.Windows.Forms;
namespace Sunny.UI
{
public class UIPagination : UIPanel
public class UIPagination : UIPanel, ITranslate
{
public delegate void OnPageChangeEventHandler(object sender, object pagingSource, int pageIndex, int count);
@ -111,6 +111,15 @@ namespace Sunny.UI
buttons[i].MouseLeave += UIDataGridPage_MouseLeave;
buttons[i].Click += UIDataGridPage_Click;
}
Translate();
}
public void Translate()
{
b0.Text = UILocalize.Prev;
b16.Text = UILocalize.Next;
btnSelect.Text = UILocalize.SelectTitle;
}
private int buttonInterval = 4;
@ -313,13 +322,14 @@ namespace Sunny.UI
this.cb1 = new Sunny.UI.UIComboBox();
this.p1.SuspendLayout();
this.SuspendLayout();
//
//
// b0
//
//
this.b0.Cursor = System.Windows.Forms.Cursors.Hand;
this.b0.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.b0.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.b0.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.b0.Location = new System.Drawing.Point(3, 3);
this.b0.MinimumSize = new System.Drawing.Size(1, 1);
this.b0.Name = "b0";
this.b0.Padding = new System.Windows.Forms.Padding(5, 0, 5, 0);
this.b0.RadiusSides = ((Sunny.UI.UICornerRadiusSides)((Sunny.UI.UICornerRadiusSides.LeftTop | Sunny.UI.UICornerRadiusSides.LeftBottom)));
@ -330,193 +340,209 @@ namespace Sunny.UI
this.b0.TagString = "<";
this.b0.Text = "上一页";
this.b0.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
//
// b1
//
//
this.b1.Cursor = System.Windows.Forms.Cursors.Hand;
this.b1.Font = new System.Drawing.Font("微软雅黑", 12F);
this.b1.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.b1.Location = new System.Drawing.Point(81, 3);
this.b1.MinimumSize = new System.Drawing.Size(1, 1);
this.b1.Name = "b1";
this.b1.RadiusSides = Sunny.UI.UICornerRadiusSides.None;
this.b1.Size = new System.Drawing.Size(29, 29);
this.b1.Symbol = 0;
this.b1.TabIndex = 1;
this.b1.Text = "0";
//
//
// b3
//
//
this.b3.Cursor = System.Windows.Forms.Cursors.Hand;
this.b3.Font = new System.Drawing.Font("微软雅黑", 12F);
this.b3.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.b3.Location = new System.Drawing.Point(145, 3);
this.b3.MinimumSize = new System.Drawing.Size(1, 1);
this.b3.Name = "b3";
this.b3.RadiusSides = Sunny.UI.UICornerRadiusSides.None;
this.b3.Size = new System.Drawing.Size(29, 29);
this.b3.Symbol = 0;
this.b3.TabIndex = 3;
this.b3.Text = "0";
//
//
// b2
//
//
this.b2.Cursor = System.Windows.Forms.Cursors.Hand;
this.b2.Font = new System.Drawing.Font("微软雅黑", 12F);
this.b2.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.b2.Location = new System.Drawing.Point(113, 3);
this.b2.MinimumSize = new System.Drawing.Size(1, 1);
this.b2.Name = "b2";
this.b2.RadiusSides = Sunny.UI.UICornerRadiusSides.None;
this.b2.Size = new System.Drawing.Size(29, 29);
this.b2.Symbol = 0;
this.b2.TabIndex = 2;
this.b2.Text = "0";
//
//
// b7
//
//
this.b7.Cursor = System.Windows.Forms.Cursors.Hand;
this.b7.Font = new System.Drawing.Font("微软雅黑", 12F);
this.b7.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.b7.Location = new System.Drawing.Point(273, 3);
this.b7.MinimumSize = new System.Drawing.Size(1, 1);
this.b7.Name = "b7";
this.b7.RadiusSides = Sunny.UI.UICornerRadiusSides.None;
this.b7.Size = new System.Drawing.Size(29, 29);
this.b7.Symbol = 0;
this.b7.TabIndex = 7;
this.b7.Text = "0";
//
//
// b6
//
//
this.b6.Cursor = System.Windows.Forms.Cursors.Hand;
this.b6.Font = new System.Drawing.Font("微软雅黑", 12F);
this.b6.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.b6.Location = new System.Drawing.Point(241, 3);
this.b6.MinimumSize = new System.Drawing.Size(1, 1);
this.b6.Name = "b6";
this.b6.RadiusSides = Sunny.UI.UICornerRadiusSides.None;
this.b6.Size = new System.Drawing.Size(29, 29);
this.b6.Symbol = 0;
this.b6.TabIndex = 6;
this.b6.Text = "0";
//
//
// b5
//
//
this.b5.Cursor = System.Windows.Forms.Cursors.Hand;
this.b5.Font = new System.Drawing.Font("微软雅黑", 12F);
this.b5.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.b5.Location = new System.Drawing.Point(209, 3);
this.b5.MinimumSize = new System.Drawing.Size(1, 1);
this.b5.Name = "b5";
this.b5.RadiusSides = Sunny.UI.UICornerRadiusSides.None;
this.b5.Size = new System.Drawing.Size(29, 29);
this.b5.Symbol = 0;
this.b5.TabIndex = 5;
this.b5.Text = "0";
//
//
// b4
//
//
this.b4.Cursor = System.Windows.Forms.Cursors.Hand;
this.b4.Font = new System.Drawing.Font("微软雅黑", 12F);
this.b4.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.b4.Location = new System.Drawing.Point(177, 3);
this.b4.MinimumSize = new System.Drawing.Size(1, 1);
this.b4.Name = "b4";
this.b4.RadiusSides = Sunny.UI.UICornerRadiusSides.None;
this.b4.Size = new System.Drawing.Size(29, 29);
this.b4.Symbol = 0;
this.b4.TabIndex = 4;
this.b4.Text = "0";
//
//
// b15
//
//
this.b15.Cursor = System.Windows.Forms.Cursors.Hand;
this.b15.Font = new System.Drawing.Font("微软雅黑", 12F);
this.b15.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.b15.Location = new System.Drawing.Point(529, 3);
this.b15.MinimumSize = new System.Drawing.Size(1, 1);
this.b15.Name = "b15";
this.b15.RadiusSides = Sunny.UI.UICornerRadiusSides.None;
this.b15.Size = new System.Drawing.Size(29, 29);
this.b15.Symbol = 0;
this.b15.TabIndex = 15;
this.b15.Text = "0";
//
//
// b14
//
//
this.b14.Cursor = System.Windows.Forms.Cursors.Hand;
this.b14.Font = new System.Drawing.Font("微软雅黑", 12F);
this.b14.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.b14.Location = new System.Drawing.Point(497, 3);
this.b14.MinimumSize = new System.Drawing.Size(1, 1);
this.b14.Name = "b14";
this.b14.RadiusSides = Sunny.UI.UICornerRadiusSides.None;
this.b14.Size = new System.Drawing.Size(29, 29);
this.b14.Symbol = 0;
this.b14.TabIndex = 14;
this.b14.Text = "0";
//
//
// b13
//
//
this.b13.Cursor = System.Windows.Forms.Cursors.Hand;
this.b13.Font = new System.Drawing.Font("微软雅黑", 12F);
this.b13.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.b13.Location = new System.Drawing.Point(465, 3);
this.b13.MinimumSize = new System.Drawing.Size(1, 1);
this.b13.Name = "b13";
this.b13.RadiusSides = Sunny.UI.UICornerRadiusSides.None;
this.b13.Size = new System.Drawing.Size(29, 29);
this.b13.Symbol = 0;
this.b13.TabIndex = 13;
this.b13.Text = "0";
//
//
// b12
//
//
this.b12.Cursor = System.Windows.Forms.Cursors.Hand;
this.b12.Font = new System.Drawing.Font("微软雅黑", 12F);
this.b12.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.b12.Location = new System.Drawing.Point(433, 3);
this.b12.MinimumSize = new System.Drawing.Size(1, 1);
this.b12.Name = "b12";
this.b12.RadiusSides = Sunny.UI.UICornerRadiusSides.None;
this.b12.Size = new System.Drawing.Size(29, 29);
this.b12.Symbol = 0;
this.b12.TabIndex = 12;
this.b12.Text = "0";
//
//
// b11
//
//
this.b11.Cursor = System.Windows.Forms.Cursors.Hand;
this.b11.Font = new System.Drawing.Font("微软雅黑", 12F);
this.b11.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.b11.Location = new System.Drawing.Point(401, 3);
this.b11.MinimumSize = new System.Drawing.Size(1, 1);
this.b11.Name = "b11";
this.b11.RadiusSides = Sunny.UI.UICornerRadiusSides.None;
this.b11.Size = new System.Drawing.Size(29, 29);
this.b11.Symbol = 0;
this.b11.TabIndex = 11;
this.b11.Text = "0";
//
//
// b10
//
//
this.b10.Cursor = System.Windows.Forms.Cursors.Hand;
this.b10.Font = new System.Drawing.Font("微软雅黑", 12F);
this.b10.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.b10.Location = new System.Drawing.Point(369, 3);
this.b10.MinimumSize = new System.Drawing.Size(1, 1);
this.b10.Name = "b10";
this.b10.RadiusSides = Sunny.UI.UICornerRadiusSides.None;
this.b10.Size = new System.Drawing.Size(29, 29);
this.b10.Symbol = 0;
this.b10.TabIndex = 10;
this.b10.Text = "0";
//
//
// b9
//
//
this.b9.Cursor = System.Windows.Forms.Cursors.Hand;
this.b9.Font = new System.Drawing.Font("微软雅黑", 12F);
this.b9.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.b9.Location = new System.Drawing.Point(337, 3);
this.b9.MinimumSize = new System.Drawing.Size(1, 1);
this.b9.Name = "b9";
this.b9.RadiusSides = Sunny.UI.UICornerRadiusSides.None;
this.b9.Size = new System.Drawing.Size(29, 29);
this.b9.Symbol = 0;
this.b9.TabIndex = 9;
this.b9.Text = "0";
//
//
// b8
//
//
this.b8.Cursor = System.Windows.Forms.Cursors.Hand;
this.b8.Font = new System.Drawing.Font("微软雅黑", 12F);
this.b8.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.b8.Location = new System.Drawing.Point(305, 3);
this.b8.MinimumSize = new System.Drawing.Size(1, 1);
this.b8.Name = "b8";
this.b8.RadiusSides = Sunny.UI.UICornerRadiusSides.None;
this.b8.Size = new System.Drawing.Size(29, 29);
this.b8.Symbol = 0;
this.b8.TabIndex = 8;
this.b8.Text = "0";
//
//
// b16
//
//
this.b16.Cursor = System.Windows.Forms.Cursors.Hand;
this.b16.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.b16.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.b16.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
this.b16.Location = new System.Drawing.Point(561, 3);
this.b16.MinimumSize = new System.Drawing.Size(1, 1);
this.b16.Name = "b16";
this.b16.Padding = new System.Windows.Forms.Padding(5, 0, 5, 0);
this.b16.RadiusSides = ((Sunny.UI.UICornerRadiusSides)((Sunny.UI.UICornerRadiusSides.RightTop | Sunny.UI.UICornerRadiusSides.RightBottom)));
@ -528,35 +554,39 @@ namespace Sunny.UI
this.b16.Text = "下一页";
this.b16.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.b16.LocationChanged += new System.EventHandler(this.b16_LocationChanged);
//
//
// p1
//
//
this.p1.Controls.Add(this.edtPage);
this.p1.Controls.Add(this.btnSelect);
this.p1.Controls.Add(this.uiLabel2);
this.p1.Controls.Add(this.uiLabel1);
this.p1.Font = new System.Drawing.Font("微软雅黑", 12F);
this.p1.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.p1.Location = new System.Drawing.Point(727, 3);
this.p1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.p1.MinimumSize = new System.Drawing.Size(1, 1);
this.p1.Name = "p1";
this.p1.RectSides = System.Windows.Forms.ToolStripStatusLabelBorderSides.None;
this.p1.Size = new System.Drawing.Size(176, 29);
this.p1.TabIndex = 17;
this.p1.Text = null;
this.p1.TextAlignment = System.Drawing.ContentAlignment.MiddleCenter;
this.p1.LocationChanged += new System.EventHandler(this.p1_LocationChanged);
//
//
// edtPage
//
//
this.edtPage.Cursor = System.Windows.Forms.Cursors.IBeam;
this.edtPage.DoubleValue = 10D;
this.edtPage.FillColor = System.Drawing.Color.White;
this.edtPage.Font = new System.Drawing.Font("微软雅黑", 12F);
this.edtPage.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.edtPage.HasMinimum = true;
this.edtPage.IntValue = 10;
this.edtPage.Location = new System.Drawing.Point(28, 0);
this.edtPage.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.edtPage.Maximum = 2147483647D;
this.edtPage.Minimum = 1D;
this.edtPage.MinimumEnabled = true;
this.edtPage.MinimumSize = new System.Drawing.Size(1, 1);
this.edtPage.Name = "edtPage";
this.edtPage.Padding = new System.Windows.Forms.Padding(5);
this.edtPage.Size = new System.Drawing.Size(53, 29);
@ -564,48 +594,50 @@ namespace Sunny.UI
this.edtPage.Text = "10";
this.edtPage.TextAlignment = System.Drawing.ContentAlignment.BottomCenter;
this.edtPage.Type = Sunny.UI.UITextBox.UIEditType.Integer;
//
//
// btnSelect
//
//
this.btnSelect.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnSelect.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnSelect.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.btnSelect.Location = new System.Drawing.Point(111, 0);
this.btnSelect.MinimumSize = new System.Drawing.Size(1, 1);
this.btnSelect.Name = "btnSelect";
this.btnSelect.Size = new System.Drawing.Size(61, 29);
this.btnSelect.Symbol = 0;
this.btnSelect.TabIndex = 3;
this.btnSelect.Text = "确定";
this.btnSelect.Click += new System.EventHandler(this.btnSelect_Click);
//
//
// uiLabel2
//
//
this.uiLabel2.AutoSize = true;
this.uiLabel2.BackColor = System.Drawing.Color.Transparent;
this.uiLabel2.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.uiLabel2.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.uiLabel2.Location = new System.Drawing.Point(81, 4);
this.uiLabel2.Name = "uiLabel2";
this.uiLabel2.Size = new System.Drawing.Size(23, 20);
this.uiLabel2.TabIndex = 2;
this.uiLabel2.Text = "页";
this.uiLabel2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
//
// uiLabel1
//
//
this.uiLabel1.AutoSize = true;
this.uiLabel1.BackColor = System.Drawing.Color.Transparent;
this.uiLabel1.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.uiLabel1.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.uiLabel1.Location = new System.Drawing.Point(5, 4);
this.uiLabel1.Name = "uiLabel1";
this.uiLabel1.Size = new System.Drawing.Size(23, 20);
this.uiLabel1.TabIndex = 0;
this.uiLabel1.Text = "第";
this.uiLabel1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
//
// cb1
//
//
this.cb1.DataSource = null;
this.cb1.DropDownStyle = Sunny.UI.UIDropDownStyle.DropDownList;
this.cb1.FillColor = System.Drawing.Color.White;
this.cb1.Font = new System.Drawing.Font("微软雅黑", 12F);
this.cb1.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.cb1.Items.AddRange(new object[] {
"20条/页",
"50条/页",
@ -615,14 +647,14 @@ namespace Sunny.UI
this.cb1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.cb1.MinimumSize = new System.Drawing.Size(63, 0);
this.cb1.Name = "cb1";
this.cb1.Padding = new System.Windows.Forms.Padding(0, 0, 30, 0);
this.cb1.Padding = new System.Windows.Forms.Padding(0, 0, 30, 2);
this.cb1.Size = new System.Drawing.Size(103, 29);
this.cb1.TabIndex = 19;
this.cb1.TextAlignment = System.Drawing.ContentAlignment.MiddleLeft;
this.cb1.Visible = false;
//
//
// UIPagination
//
//
this.Controls.Add(this.cb1);
this.Controls.Add(this.p1);
this.Controls.Add(this.b16);
@ -648,6 +680,7 @@ namespace Sunny.UI
this.p1.ResumeLayout(false);
this.p1.PerformLayout();
this.ResumeLayout(false);
}
#endregion InitializeComponent

View File

@ -1,64 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<root>
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">

View File

@ -36,7 +36,7 @@ using System.Windows.Forms;
namespace Sunny.UI
{
public partial class UIForm : Form, IStyleInterface
public partial class UIForm : Form, IStyleInterface, ITranslate
{
private readonly UIButton btn = new UIButton();
@ -67,6 +67,18 @@ namespace Sunny.UI
showTitleIcon = false;
}
public void Translate()
{
List<Control> controls = this.GetTranslateControls("ITranslate");
foreach (var control in controls)
{
if (control is ITranslate item)
{
item.Translate();
}
}
}
[DefaultValue(false)]
[Description("允许在标题栏放置控件"), Category("SunnyUI")]
public bool AllowAddControlOnTitle

View File

@ -505,6 +505,14 @@ namespace Sunny.UI
page.Style = style;
}
}
public static void Translate()
{
foreach (var form in Forms.Values)
{
form.Translate();
}
}
}
/// <summary>
@ -798,6 +806,26 @@ namespace Sunny.UI
return values;
}
public static List<Control> GetTranslateControls(this Control ctrl, string interfaceName)
{
List<Control> values = new List<Control>();
foreach (Control obj in ctrl.Controls)
{
if (obj.GetType().GetInterface(interfaceName) != null)
{
values.Add(obj);
}
if (obj.Controls.Count > 0)
{
values.AddRange(obj.GetTranslateControls(interfaceName));
}
}
return values;
}
public static void SetRawControlStyle(ControlEventArgs e, UIStyle style)
{
if (e.Control is TableLayoutPanel)

View File

@ -43,6 +43,8 @@
<None Remove="Font\fa-regular-400.ttf" />
<None Remove="Font\fa-solid-900.ttf" />
<None Remove="Font\FontAwesome.ttf" />
<None Remove="Forms\UIForm.cs~RF43da5c.TMP" />
<None Remove="Forms\UIForm.cs~RF485c3b.TMP" />
<None Remove="Style\UIStyleColor.cs~RF1472b803.TMP" />
<None Remove="Style\UIStyleColor.cs~RF22754f9d.TMP" />
<None Include="..\LICENSE">

View File

@ -92,6 +92,17 @@ namespace Sunny.UI
/// "系统正在处理中,请稍候..."
/// </summary>
public static string SystemProcessing = "系统正在处理中,请稍候...";
public static string Monday = "一";
public static string Tuesday = "二";
public static string Wednesday = "三";
public static string Thursday = "四";
public static string Friday = "五";
public static string Saturday = "六";
public static string Sunday = "日";
public static string Prev = "上一页";
public static string Next = "下一页";
}
public static class UILocalizeHelper
@ -112,6 +123,19 @@ namespace Sunny.UI
UILocalize.GridDataLoading = "Data loading, please wait...";
UILocalize.GridDataSourceException = "The data source must be DataTable or List";
UILocalize.SystemProcessing = "The system is processing, please wait...";
UILocalize.Monday = "Mon";
UILocalize.Tuesday = "Tue";
UILocalize.Wednesday = "Wed";
UILocalize.Thursday = "Thur";
UILocalize.Friday = "Fri";
UILocalize.Saturday = "Sat";
UILocalize.Sunday = "Sun";
UILocalize.Prev = "Prev";
UILocalize.Next = "Next";
UIStyles.Translate();
}
public static void SetCH()
@ -130,6 +154,19 @@ namespace Sunny.UI
UILocalize.GridDataLoading = "数据加载中,请稍候...";
UILocalize.GridDataSourceException = "数据源必须为DataTable或者List";
UILocalize.SystemProcessing = "系统正在处理中,请稍候...";
UILocalize.Monday = "一";
UILocalize.Tuesday = "二";
UILocalize.Wednesday = "三";
UILocalize.Thursday = "四";
UILocalize.Friday = "五";
UILocalize.Saturday = "六";
UILocalize.Sunday = "日";
UILocalize.Prev = "上一页";
UILocalize.Next = "下一页";
UIStyles.Translate();
}
}
}

View File

@ -0,0 +1,7 @@
namespace Sunny.UI
{
public interface ITranslate
{
void Translate();
}
}