DlangUI translations

Vadim Lopatin via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Apr 25 01:07:54 PDT 2016


On Sunday, 24 April 2016 at 23:32:38 UTC, stunaep wrote:
> On Sunday, 24 April 2016 at 04:49:36 UTC, thedeemon wrote:
>> On Saturday, 23 April 2016 at 15:44:22 UTC, stunaep wrote:
>>> I am wondering how to use other languages and how to NOT use 
>>> other languages.
>>
>> Did you see example1 from examples folder in dlangui? It has 
>> two languages and allows switching at runtime via menu.
>
> But I don't know how to change the language for ui components 
> such as buttons and text. And the most important thing is 
> removing "UNTRANSLATED: " from items in my list.

Are you really see it on example1? It looks like you selected 
Russian language in "View"/"Interface Language" menu. Select 
English (in russian translation, it's first item of third main 
menu item -- "Вид"/"Язык интерфейса").

UNTRANSLATED: prefix is being added to all string resources not 
found in translation files.

For widgets, usually both plain unicode dstring values and string 
resource ids can be used.
E.g.
`label.text = "exit"c;` assigns string resource id 
(views/res/i18n/your_language_code.ini should contain line 
"exit=SOME_TRANSLATION_HERE", otherwise "UNTRANSLATED: exit" will 
be shown. Strings specified by resource ids will be automatically 
translated when language is changed.


`label.text = "exit"d; assigns plain unicode string value. Such 
strings remain unchanged when application language is changed.

In DML, when you assign string property as identifier (w/o 
quotes), it's considered as resource id. When "string in quotes" 
is assigned, it's plain string.

TextWidget { text: RESOURCE_ID } // translation must exist in 
res/i18n/*.ini files
TextWidget { text: "plain text" } // just plain text value




More information about the Digitalmars-d-learn mailing list