Multilangugae User Interface of VI
#1
Posted 19 September 2009 - 10:04 AM
Is anybody have experience to create MUI(multilanguage User Interface) in LabVIEW? Can you please share?
#2
Posted 19 September 2009 - 11:48 AM
We use some vis that enable dynamically changing between certain languages like english, French, German etc. I canot share the code because they are owned by the company but (as I wrote them) I can tell you how they work. There may be others who are not restricted to share. The key is really not to "hard-code" strrings into the diagrams and takes a little bit more thought but is fairly easy to do. don't talk to me about Japanese or Chinese however...lol.Hi,
Is anybody have experience to create MUI(multilanguage User Interface) in LabVIEW? Can you please share?
They take advantage of labels and captions for controls and indicators. The Label is used as the "tag" and the Caption is what is displayed to the user. Display strings are a bit more complicated, but not much.
A create language file vi is used to iterate through all labels in the app and save them to a" bar" separated spreadsheet file. We use the bar "|" symbol because it then allows the use of commas, semicolons etc in the text. This file is then sent off to the translators and they add the words (or phrases) for the other languages on the same line for each language (first column English, second French, third German....etc).
A change language file vi is used to load the file and iterate through all the labels changing the captions to the specific language. You have to check the control type as for things like boolean indicators, its not the caption the user sees. Job done for controls and indicators. This can be invoked at any time and the current language is saved to a config file so that the software starts up in the last used language.
Display strings in the code are always preceded with a get language file vi that takes a string as an arguement (the tag as described above) and outputs the corresponding word/phrase in whatever language is chosen to be active. I've been meaning to get around to including a digram search for these tags so they can automagically be added with the create language file vi, but I've more important fish to fry.
Thats basically it. It shouldn't take you very long to write something yourself, or I suspect others on this forum have similar tools that they can share.
Edited by ShaunR, 19 September 2009 - 12:10 PM.
Founder and general mischief maker on www.labview-tools.com.
SQlite aficionado and websocket zealot.
If it 'aint in LabVIEW, then you 'aint got a clue!
#3
Posted 19 September 2009 - 12:27 PM
Your option is exactly what I thought before.
I try to use the captions of controls and indicators to show different language to user, while use the labels to identify them.
But how can I iterate through all labels in a vi? this puzzeled me for days and I belive this is last step for me to finalize my application.
#4
Posted 19 September 2009 - 01:00 PM
To get a list of yer controls:
- Connect a property node to a refernece of the VI and select "Panel"
- Take the "Panel" ref out to a second property node and select "Controls"
- Now you can use the "Controls" refs to read the label and set the caption.
Some things to consider.
- Do you have controls inside controls? - Clusters, Tabs
- Do you want to display a caption for each control? - Tab Conrol?
- Do you have enough area to display the translated text?
- Will your text grow in the correct direction?
Control Refs.vi 16.7K
197 downloads
Edited by gleichman, 19 September 2009 - 01:27 PM.
#5
Posted 19 September 2009 - 04:05 PM
Hi,
Is anybody have experience to create MUI(multilanguage User Interface) in LabVIEW? Can you please share?
I modified Get All Controls reference.vi (http://zone.ni.com/d...a/epd/p/id/2902) to obtain the references in the pane.
Jean-Marc
Attached Files
#6
Posted 20 September 2009 - 12:55 AM
It has been proved that the option is a good one.
I had create a very simple vi try to indicate the idea( gleichman and Jean-Marc, I haven't use your great code in the example yet, but it will support the real develope later:).
In the example:
1) when if case is true, the vi will create a "test.ini" to save all label and its caption, while the label is a tag;
2) after translate the "test.ini" to other language(even Chinese and Japanese:), shift the if case to false to load the language.
as gleichman mentioned, when creating a complicated application which include cluster, array etc ,then the iterate function need to be optimized.
mul.vi 23.08K
245 downloads
#7
Posted 20 September 2009 - 03:09 PM
Thanks Mates,
It has been proved that the option is a good one.
I had create a very simple vi try to indicate the idea( gleichman and Jean-Marc, I haven't use your great code in the example yet, but it will support the real develope later:).
In the example:
1) when if case is true, the vi will create a "test.ini" to save all label and its caption, while the label is a tag;
2) after translate the "test.ini" to other language(even Chinese and Japanese:), shift the if case to false to load the language.
as gleichman mentioned, when creating a complicated application which include cluster, array etc ,then the iterate function need to be optimized.mul.vi 23.08K 245 downloads
I function much like ShaunR. I have a text file translation (spreadsheet): the first column corresponds to tags (full names in my case), the second column is the Language 1 (French), the third column is the language 2 (English), etc.. When the main VI starts, it reads this text file and the default language (first line of the spreadsheet file). The file is transfered in a 3D array. The cell "i,0,0" contains a tag associated with a particular VI (a VI who needs translation).
When I call a VI, if translation is needed, I send to him the corresponding 2D array.
This part is not included in the attachment.
For all VIS who need translation, I read the references of the controls (visible in the pane). I search in the 2D array to find the tag and I write the text in the proper caption, ring text, tab caption, XY Graph axes, etc.
This second part is included in the attachment.
Jean-Marc
Attached Files
#8
Posted 20 September 2009 - 10:52 PM
This makes life a lot easier for the translators, but means you have to coordinate updates to multiple files.
Founder and general mischief maker on www.labview-tools.com.
SQlite aficionado and websocket zealot.
If it 'aint in LabVIEW, then you 'aint got a clue!
#9
Posted 21 September 2009 - 03:22 AM
English <tab> French <tab> Spanish <cr+lf>
Where is the toilet? <tab> Ou sont les toilettes? <tab> ¿Dónde está el baño? <cr+lf>
I like eggs <tab> J'aime les oeufs <tab> Me gustan los huevos <cr+lf>
Do not press this button <tab> Ne pas appuyer sur ce bouton <tab> No presione este botón
Attached Files

#10
Posted 01 October 2009 - 01:37 PM
Thanks
Jean-Marc
#11
Posted 01 October 2009 - 02:07 PM
If ya'll think it's worthwhile enough, I'm happy for someone to toss it into the LAVA Code Repository.I saw that a few people have downloaded the files. Do you have any comments or suggestions to improve them?

#12
Posted 01 October 2009 - 02:39 PM
http://zone.ni.com/d...a/epd/p/id/6257
It helps you to create/edit a resource file with all your translations. Then there is a library that helps you pull the information from the resource file into your application. Its all open source if you want to give it a try.
#13
Posted 01 October 2009 - 03:04 PM
"Maybe Hoovah is really Crelf's alter-ego, which he uses to irk people?" - Gary Rubin
"Seemingly minor changes....can mean the difference between a working app and a quivering heap of unresponsive code." - David Boyd
#14
Posted 01 October 2009 - 04:58 PM
Looks like your doing it the hard wayI made a Localization Configuration Editor and for NI week this year.
http://zone.ni.com/d...a/epd/p/id/6257
It helps you to create/edit a resource file with all your translations. Then there is a library that helps you pull the information from the resource file into your application. Its all open source if you want to give it a try.
Founder and general mischief maker on www.labview-tools.com.
SQlite aficionado and websocket zealot.
If it 'aint in LabVIEW, then you 'aint got a clue!
#15
Posted 01 October 2009 - 06:39 PM
Looks like your doing it the hard way
It certainly took some effort to make the editor. Hopefully it gets some use. The nice thing about a single file is transportability. Also grouping translations into resources helps with accessing data if you want to change the language setting at run-time. Plus the editor helps you organize resources into folders, so all the controls for a single VI can go into folder. Just makes it pretty.
#16
Posted 01 October 2009 - 07:13 PM
Indeed. From the usage point of view it look on the face of it to be nice and easy to access from within the code and you certainly have created a sleek interface.It certainly took some effort to make the editor. Hopefully it gets some use. The nice thing about a single file is transportability. Also grouping translations into resources helps with accessing data if you want to change the language setting at run-time. Plus the editor helps you organize resources into folders, so all the controls for a single VI can go into folder. Just makes it pretty.
I'm not sure how time consuming it would be to create 5 translations for 300-400 controls though. Also, what if (as in my case) the developer is not the translator?
Founder and general mischief maker on www.labview-tools.com.
SQlite aficionado and websocket zealot.
If it 'aint in LabVIEW, then you 'aint got a clue!
#17
Posted 01 October 2009 - 07:21 PM
I'm not sure how time consuming it would be to create 5 translations for 300-400 controls though. Also, what if (as in my case) the developer is not the translator?
Well, it is not really translations of controls, so much as resources. Naming the resource and control the same thing makes it easier on the developer though. Looking at the article would probably clear that up. The translator and the developer can be different people, as long as they have agreed upon the resource naming convention. I assume that's how most applications provide run-time translations.
#18
Posted 01 October 2009 - 08:38 PM
The last job I did that required translations had a bunch of them, and the file format our translation code uses was compatible with the output we got from the translation services (they would give us an Excel file, we would save it as tab-delimited ASCII and we were done).I'm not sure how time consuming it would be to create 5 translations for 300-400 controls though. Also, what if (as in my case) the developer is not the translator?

#19
Posted 01 October 2009 - 09:05 PM
Same here.The last job I did that required translations had a bunch of them, and the file format our translation code uses was compatible with the output we got from the translation services (they would give us an Excel file, we would save it as tab-delimited ASCII and we were done).
Watch this space.
Edited by ShaunR, 01 October 2009 - 09:09 PM.
Founder and general mischief maker on www.labview-tools.com.
SQlite aficionado and websocket zealot.
If it 'aint in LabVIEW, then you 'aint got a clue!
#20
Posted 03 October 2009 - 09:40 PM
Founder and general mischief maker on www.labview-tools.com.
SQlite aficionado and websocket zealot.
If it 'aint in LabVIEW, then you 'aint got a clue!













