07-09-2011 07:48 PM
Greetings from Colorado...
My application needs to be switchable between English and Russian. Future languages to add are Spanish and Chinese. The user selects a language
from a control before starting the program and then the program changes the Captions, Boolean Texts, Graph Labels, and Enum Type Strings to the
chosen language. For Russian, this requires a different set of characters. I have made substantial progress by:
Control Panels>Region and Language>Keyboards and Languages>Change Keyboards added Russian>Keyboard>Russian on my development
computer.
In the LabVIEW.ini file, I added UseUnicode=TRUE (thanks to a suggestion found in this forum)
Made property nodes for controls and used properties such as Interpret As Unicode (True for Russian, False for English), Text, Font Name, Font Size, etc.
I have used fonts Arial and Arial CYR for Russian and MS Sans Serif for English
Set the keyboard for Russian and enter Cyrillic characters into text constants that are set for Arial or Arial CYR font. Sometimes one works and
sometimes the other works. As long as I set the font name in the property node the same way the text went into the text constant, it generally
works. I wish I could understand why one works sometimes and the other works other times!
I have had trouble with the Boolean Text going off-center when changing fonts and languages and it seems that by setting the Lock Text In Center
property to False and then True again, it seems to work. Often changing Boolean texts between short and long texts causes some of the long text
to be non-displayed; I have remedied this by explicitly setting the width of the Boolean text in a property node.
Often, the Russian text appears as gibberish with strange right-angle characters, :s, =s, and tiny numbers. I have been able to remedy this on my
development computer by ensuring that the text constant on the block diagram has the same size as the caption is supposed to have. This
is not necessary for normal programming in English, but it seems to help here. But it doesn't always solve the problem.
Sometimes the English text appears as Chinese gibberish in an Enum Type selection list or in a graph label. On my development computer,
it seems that making the text the last property to change helps here.
By changing the sequences of assignments to a single property node with a long list of properties, I have been able to make some of these
controls to switch between languages without gibberish showing up.
A few hours ago, I had the Russian strings in the Enum Type control working, except that when selecting from the available items, only the first
word of the Russian string was displayed. Two of the items start with the same word, so the user can't distinguish them.
At that time the English strings were appearing as Chinese gibberish while the list during the selection process displayed in English. As soon
as I changed the selection, future attempts to change the selection gave Chinese gibberish during the selection process, too. But this was only
a problem in the executable version; the source-code version worked fine.
In an attempt to get rid of the Chinese gibberish, I made new constants and retyped the items into them. This worked! But then, the Russian
stopped working and gave gibberish angles and tiny numbers, even though I didn't touch any of the code that sets the properties in Russian mode.
After trying a few sequences of setting the properties for the graph X label on page 2 of my tab control, this label started working correctly for both
languages. But the text of that label comes through on page 1 of the tab control, partly obscured by other controls on that page. After the
program runs a few more seconds, these shadows disappear.
Most times I restart LabVIEW, I get an error message saying there was a crash due to fontmgr.cpp, line 7494. But there actually wasn't a crash.
My computer has Windows 7 64-bit. Deployment Computer has Windows 7 32-bit. LabVIEW version is 8.5.
I have probably 50 or 100 more controls and indicators to change to language programmability and figuring out all this stuff for each one is
terribly time-consuming and there is no assurance that all of them will ever work.
At this point, I'm hoping that I am on an entirely wrong path and someone will send me a clue to get me on a path that is more predictable.
Thanks in advance to all who post ideas!
Cheers
Halden
07-11-2011 12:51 PM
Hi there,
It looks like you've made some great progress so far getting this to work. Have you taken a look at the following article yet? How Can I Publish My VI or Application in Multiple Languages?
Does that message about a "crash" come up every time labview boots?
07-15-2011 02:10 PM
Hi Scott
Thanks for the referral to that article; I had not seen it. It looks like I was on the right track
to change the captions. But I also want to change the boolean text (good success so far, though I
have to also set properties to recenter the boolean text, etc.) and the strings array in the Enum Type
control. Still, either the English corrupts to Chinese gibberish or the Cyrillic corrupts to tiny numbers
and angles. Since I want each copy of the software to be the same, importing/exporting the captions
list doesn't solve it. But I do plan to make such a list and programmatically import/export it. Since
that list will have Unicode strings in it, is there something special I have to do to read it to put the
unicode strings into the captions?
Cheers
Halden
07-15-2011 02:24 PM
Hi Scott,
Nevermind my last question; I just searched Unicode on the forum and found something that
looks useful: https://decibel.ni.com/content/docs/DOC-10153
Halden
07-16-2011 05:03 PM
More on this project...
Replace Enum Type in my prior posts in this thread above with Menu Ring. I didn't realize which control type it actually was. It turns out that the strings in an Enum Type cannot be changed. The translated strings in my Menu Rings were working for a while, but then corrupted as soon as I compiled the code. What happens on compile to the strings?
How can I change the language of the names of the tabs in a tab control, both the tabs and the page labels?
Thanks to all who write in!
Halden
07-18-2011 02:31 PM
I haven't seen applications doing changing the language of the names of the tabs but you can change the values of the names of the tabs using
07-26-2011 10:23 PM
Hi Scott
Your post got truncated. Did you have a workaround for changing the text in the tabs?
Halden
08-01-2011 03:18 PM
Yikes, I forget what I was saying there. I'll try to remember and post it below.
08-04-2011 09:57 AM
Hi All,
I've made a lot of progress on this translation, but it's been really hard. There are lots of weird things going on that must be logical because they're in a computer, but I can't figure out what the logic is. When changing a font on a caption using the front panel, it sometimes changes the font on the caption and sometimes doesn't although the indicator always indicates the new font. Removing the first character of the unicode font string being sent to the caption seems to help...huh? Anyway, tabs still can't change language programmatically, and niether can ring controls (some kinds will take the new list of strings, but when selecting, they only display the first word of the string!). Boolean text can be reprogrammed, but only if the boolean text is set to be the same for both true and false states. When reprogramming captions on a non-displayed page of a multi-page tab-controlled user interface, the new text appears on the current page until I change pages back and forth. What a pain!
Sooo, NI....does LabVIEW 2011 have support for unicode fonts? Or, is there anything else in the new control style that will support programmatic language changing?
Halden