MViControl Posted September 19, 2009 Report Share Posted September 19, 2009 Hi, Is anybody have experience to create MUI(multilanguage User Interface) in LabVIEW? Can you please share? Quote Link to comment
ShaunR Posted September 19, 2009 Report Share Posted September 19, 2009 (edited) Hi, Is anybody have experience to create MUI(multilanguage User Interface) in LabVIEW? Can you please share? 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. 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 September 19, 2009 by ShaunR Quote Link to comment
MViControl Posted September 19, 2009 Author Report Share Posted September 19, 2009 Hi ShaunR, 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. Quote Link to comment
gleichman Posted September 19, 2009 Report Share Posted September 19, 2009 (edited) Argh! Are ye wantn' to convert yer language to Pirate? Today is the official talk like a pirate day! 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 Edited September 19, 2009 by gleichman Quote Link to comment
Jean-Marc Posted September 19, 2009 Report Share Posted September 19, 2009 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/devzone/cda/epd/p/id/2902) to obtain the references in the pane. Jean-Marc LV8.6.1.zip Quote Link to comment
MViControl Posted September 20, 2009 Author Report Share Posted September 20, 2009 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 Quote Link to comment
Jean-Marc Posted September 20, 2009 Report Share Posted September 20, 2009 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 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 TraductionLV86.zip Quote Link to comment
ShaunR Posted September 20, 2009 Report Share Posted September 20, 2009 The other way of course is to have one file for each language and your software just switches between files. This makes life a lot easier for the translators, but means you have to coordinate updates to multiple files. Quote Link to comment
crelf Posted September 21, 2009 Report Share Posted September 21, 2009 Here's some pretty old stuff that I did that should do what you want. I used the same method (get a ref to the UI element, get the label, look up the label in a file, change the caption of the UI element to the new language). One thing is missing though - I don't see the language file. I'm pretty sure it was a tab-delimited text file with a header that had "English" as the first item then each language named as the columns, then each line was a translation with the English as the first column. eg: 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 Programming.Dialog_&_User_Interface.Translate.zip Quote Link to comment
Jean-Marc Posted October 1, 2009 Report Share Posted October 1, 2009 I saw that a few people have downloaded the files. Do you have any comments or suggestions to improve them? Thanks Jean-Marc Quote Link to comment
crelf Posted October 1, 2009 Report Share Posted October 1, 2009 I saw that a few people have downloaded the files. Do you have any comments or suggestions to improve them? If ya'll think it's worthwhile enough, I'm happy for someone to toss it into the LAVA Code Repository. Quote Link to comment
GoGators Posted October 1, 2009 Report Share Posted October 1, 2009 I made a Localization Configuration Editor and for NI week this year. http://zone.ni.com/devzone/cda/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. Quote Link to comment
hooovahh Posted October 1, 2009 Report Share Posted October 1, 2009 Very cool, I know internally we had a multilingual tool but it was only used once or twice, it isn't often we need to write interfaces. This looks much more refined. Quote Link to comment
ShaunR Posted October 1, 2009 Report Share Posted October 1, 2009 I 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. Looks like your doing it the hard way Quote Link to comment
GoGators Posted October 1, 2009 Report Share Posted October 1, 2009 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. Quote Link to comment
ShaunR Posted October 1, 2009 Report Share Posted October 1, 2009 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. 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. 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? Quote Link to comment
GoGators Posted October 1, 2009 Report Share Posted October 1, 2009 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. Quote Link to comment
crelf Posted October 1, 2009 Report Share Posted October 1, 2009 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? 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). Quote Link to comment
ShaunR Posted October 1, 2009 Report Share Posted October 1, 2009 (edited) 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). Same here. Watch this space. Edited October 1, 2009 by ShaunR Quote Link to comment
ShaunR Posted October 3, 2009 Report Share Posted October 3, 2009 Same here. Watch this space. Watch this space insted. PassaMak Quote Link to comment
PaulG. Posted October 4, 2009 Report Share Posted October 4, 2009 (edited) Watch this space insted. PassaMak Link is borken. Edited October 4, 2009 by PaulG. Quote Link to comment
ShaunR Posted October 4, 2009 Report Share Posted October 4, 2009 (edited) Link is borken. I think it needs to be approved or something. It doesn't appear in my file list but I can see it in the repository and edit/download etc (and its a different colour to the others). If I click on the link its there, so must be just the uploader until its approved. Edited October 4, 2009 by ShaunR Quote Link to comment
crelf Posted October 4, 2009 Report Share Posted October 4, 2009 I think it needs to be approved or something. It doesn't appear in my file list but I can see it in the repository and edit/download etc (and its a different colour to the others). If I click on the link its there, so must be just the uploader until its approved. That's right - your submission has to be reviewed and approved by a "LAVA Certified" team member. It's one of the strengths of the LAVAcr over other forum reposotories - we only let code in that meets the LAVAcr standards. Quote Link to comment
ShaunR Posted October 4, 2009 Report Share Posted October 4, 2009 That's right - your submission has to be reviewed and approved by a "LAVA Certified" team member. It's one of the strengths of the LAVAcr over other forum reposotories - we only let code in that meets the LAVAcr standards. And these " LAVAcr standards" are documented where? Quote Link to comment
crelf Posted October 4, 2009 Report Share Posted October 4, 2009 And these " LAVAcr standards" are documented where? I'm glad you asked - they're right here. Sumission instructions are here. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.