You can use macros marked by $(macrotext) in translation, where macrotext is any C# or code (methods must return string). For example:

(MainForm)Text = Application: $(Application.ProductName) version $(Application.ProductVersion) (C) You

Will change form title after translation to this:

You can use namespaces in code, for example:

(MainForm)Text = Major version: $(new System.Version(Application.ProductVersion).Major.ToString())

Or:

using System
(MainForm)Text = Major version: $(new Version(Application.ProductVersion).Major.ToString())

Will display:

You can use strings manipulation:

(MainForm)Text = Major version: $(Application.ProductVersion.ToString().Split('.')[0])

Or:

(MainForm)Text = $("Major version:" + " " + Application.ProductVersion.ToString().Split('.')[0])

Will display:

You can use static properties in code, for example:

!(Messages)HelloWorld = Hello world!
(MainForm)Text = Title is $(Messages.HelloWorld)

Display of current culture in title:

(MainForm)Text = Current culture name: $(Application.CurrentCulture.EnglishName)

Last edited Sep 2, 2011 at 2:43 PM by KAP, version 17

Comments

No comments yet.