Jump to content

Multi languages GUI


Recommended Posts

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.

 

 

Link to post
Share on other sites

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: "ф".

image.png.f586743c96d36aaf9cca8fca0f7161d0.png

image.png

Edited by Francois Normandin
  • Like 1
Link to post
Share on other sites
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: "ф".

image.png.f586743c96d36aaf9cca8fca0f7161d0.png

image.png

 

 

 

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.

 

 

capture1.PNG

Capture2.PNG

Link to post
Share on other sites

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. 

image.png.cc16aa53ecaddd76c5db107e1d97f05e.png

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.

Link to post
Share on other sites
  • 5 months later...

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.

 

 

 

 

 

Link to post
Share on other sites
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.

Link to post
Share on other sites

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.

Link to post
Share on other sites

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

 

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.