www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - DlangUI translations

reply stunaep <admin pea2nuts.com> writes:
I am wondering how to use other languages and how to NOT use 
other languages. I have all of the UI of my program translated to 
Russian, and I have the languages loading from the resource 
files, but I have no idea how to switch the language to Russian. 
Also, when adding file names to a StringListWidget, it shows 
"UNTRANSLATED: " before every file name, which needs to be 
removed.
Apr 23 2016
parent reply thedeemon <dlang thedeemon.com> writes:
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.
Apr 23 2016
parent reply stunaep <admin pea2nuts.com> writes:
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.
Apr 24 2016
parent Vadim Lopatin <coolreader.org gmail.com> writes:
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
Apr 25 2016