MikeLV Posted March 12, 2020 Report Share Posted March 12, 2020 I need to be able to display any languages on my GUI for the controls. It doesn't need to be switchable on the fly, but only when the program starts. The test program I wrote just reads a .txt file, line by line and fill in the controls (I use the captions). If my text is English, no problem. But if I use French for example, all the characters are displayed exept the characters with an accent. (replaced by é for example). I already read some documentation on the NI site, but they focus on the export function, which is not usefull for me. Can someone direct me toward a document, or tell me why the accents are not displayed. (I will also need to do other languages). Thanks. Quote Link to comment
Francois Normandin Posted March 12, 2020 Report Share Posted March 12, 2020 (edited) First thing, you need to add an INI token to LabVIEW.ini file, so you can display Unicode in LabVIEW. https://knowledge.ni.com/KnowledgeArticleDetails?id=kA00Z000000kJRNSA2&l=en-CA That allows to at least display the characters when copied on the front panel or block diagram (instead of showing up as a "?"). However it does not work with the caption text unless your OS environment supports the language pack. As you can see below, my OS has French and English installed, but not Chinese or Cyrillic characters. I can display the unicodes when I paste directly from a source, so you can try it on a virtual machine with the proper regional settings, and that should work. ** Edit: there is probably another step missing, because I can't get it to show up on my VM with a Russian keyboard installed... ** Edit #2: OK, it works. Turns out that the cyrillic character I had copied from google was not part of the Russian keyboard. I have no way to tell :-). But now it works with another character generated from the russian keyboard itself: "ф". Edited March 12, 2020 by Francois Normandin 1 Quote Link to comment
Zou Posted March 13, 2020 Report Share Posted March 13, 2020 I did an English/Russian project last year based on NI Unicode tool: https://forums.ni.com/t5/Reference-Design-Content/LabVIEW-Unicode-Programming-Tools/ta-p/3493021?profile.language=en 1 Quote Link to comment
MikeLV Posted March 17, 2020 Author Report Share Posted March 17, 2020 On 3/12/2020 at 7:10 PM, Francois Normandin said: First thing, you need to add an INI token to LabVIEW.ini file, so you can display Unicode in LabVIEW. https://knowledge.ni.com/KnowledgeArticleDetails?id=kA00Z000000kJRNSA2&l=en-CA That allows to at least display the characters when copied on the front panel or block diagram (instead of showing up as a "?"). However it does not work with the caption text unless your OS environment supports the language pack. As you can see below, my OS has French and English installed, but not Chinese or Cyrillic characters. I can display the unicodes when I paste directly from a source, so you can try it on a virtual machine with the proper regional settings, and that should work. ** Edit: there is probably another step missing, because I can't get it to show up on my VM with a Russian keyboard installed... ** Edit #2: OK, it works. Turns out that the cyrillic character I had copied from google was not part of the Russian keyboard. I have no way to tell :-). But now it works with another character generated from the russian keyboard itself: "ф". Thanks Francois for the reply. The way you do it is also working on my side. What I have problem with, is reading the french (or other languages) from a text file and display it to a caption. Can you try to see if reading a french text file works on your side. Thanks. Quote Link to comment
Francois Normandin Posted March 18, 2020 Report Share Posted March 18, 2020 When I write the file manually in a text editor and I open it, I get "Démarrer", but if I specifically change the encoding of the file to be "ISO 8859-15", I can read it correctly in LabVIEW. Alternatively, any file saved by LabVIEW'S Write to File method can be read correctly as well. I don't know if it works for other languages. My OS is french, so at least that's working for me. Quote Link to comment
Zou Posted March 19, 2020 Report Share Posted March 19, 2020 Use the NI Tool. One property node is not enough. Quote Link to comment
MikeLV Posted August 20, 2020 Author Report Share Posted August 20, 2020 Thank you Francois and Zou for helping me. I've been off this project due to Covid and when back to work, other things had to be done, so, now I'm back on this project. Here is my progress so far: - I set the Unicode=True in the Labview.ini file - I downloaded the tools and installed them in LV - I installed russian ans arab languages in my linguistic preferences in windows - When I save my .txt file, I use the option: UTF-16LE So, now I am able to read a .txt file containing french caracters with accents and displaying them in the caption of a control. This is by reading the file in Unicode, then convert it to ASCII with the tool vi. My program uses the search string vi to separate lines and send them to the correct caption. This is where I have a problem. Searching a files with regular caracters works fine, even with french accents, but when I use special caracters like in Russian, Arab, Mandarin, the LV search function doesn't work. I am able to read from a file and displaying the whole file (russian caracters) in a string (forced Unicode), but cannot use a LV search function. Is the problem coming from the Windows environment language? That means I have to setup a VM in Russian etc to test my code? or it is simpler than that?? Thank you. Mike. Quote Link to comment
JKSH Posted August 21, 2020 Report Share Posted August 21, 2020 7 hours ago, MikeLV said: This is by reading the file in Unicode, then convert it to ASCII with the tool vi.... Is the problem coming from the Windows environment language? That means I have to setup a VM in Russian etc to test my code? Unicode has the ability to store text from multiple languages at the same time. For example, a Unicode file (or Unicode string) can contain French, Russian, Arabic, and Chinese texts simultaneously. However, when you "convert to ASCII"*, you lose that ability. The converter can only output text that matches your Windows locale. So, if your computer is set to a French locale, you cannot convert Russian text. You need a Russian VM to successfully convert Russian text. (*ASCII is not the correct name here, but I digress) Anyway, what version of LabVIEW are you using? If you have LabVIEW 2017 or newer, then your license also gives you access to LabVIEW NXG. NXG has proper, built-in support for Unicode so you don't need to force, interpret, or convert anything. Quote Link to comment
Porter Posted August 21, 2020 Report Share Posted August 21, 2020 If you only require language switching during edit-time you can give this tool a try: You will need to startup a Russian VM to view the translated VIs though. This tool pulls all of the UI strings out of a project and stores them in UTF16-LE format, then converts them back to the desired code page when applying a particular language to the project. From my experience, it is never a good idea to try to use unicode text on VI front panels. Quote Link to comment
Zou Posted August 21, 2020 Report Share Posted August 21, 2020 It's the "space" character problem. Build your own search function: 1. Change your unicode string display mode to Hex to find out the "space" character in Hex 2. Use it to convert your string to an array using the spreadsheet to array function 3. Use search 1D array to find matching word Quote Link to comment
Zou Posted August 21, 2020 Report Share Posted August 21, 2020 Demo VI attached.Search Unicode String.vi 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.