From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Change language at runtime

Hi all
 
I'm currently doing some tests concerning multilanguage user interfaces in LV. I recently made a simple library to change some values at runtime - but as I said - just some values.
 
Ok - I know export/import strings, but the problem is, that this function is not usable at runtime and I want to enable a language change at runtime, so that the user can select the language when the program (which will be run as an exe) is running.
 
Is there at least one way to do this using LV-integrated tools? Or is there another tool which could fulfill my needs?
 
Thomas
Using LV8.0
--------------------------------------------------------------------
Don't be afraid to rate a good answer... 😉
--------------------------------------------------------------------
0 Kudos
Message 1 of 13
(4,046 Views)

The quickest way would probably be to recursively go over the FP and get\set all the captions yourself (for example, with something like the attached) to an ini or xml file. This will of course require saving by control label, which means if you change the label, you have to change it in the file as well, but it should allow you to maintain two seperate files.

Another thing you might try to look at is the property saver toolkit. I didn't actually see anything which will help you with this, but you might find something. I think it will probably be faster to do this yourself.

BTW, talking more about the export\import option, you can see it outputs an XML string, so you can try cracking that to get the data. Another option is to use it. The documentation for the Import method suggests that it is available in the RTE and the only limitation is that the VI needs to be idle. In that case, all you need to do is dynamically call the VI, import the strings and then run it.


___________________
Try to take over the world!
0 Kudos
Message 2 of 13
(4,042 Views)
Sorry, here's the attachment. Note that it doesn't return references for tabs and clusters and that it will probably need to be altered to support 8.0.

___________________
Try to take over the world!
0 Kudos
Message 3 of 13
(4,035 Views)
Hi tst 
 

The quickest way would probably be to recursively go over the FP and get\set all the captions yourself (for example, with something like the attached) to an ini or xml file. This will of course require saving by control label, which means if you change the label, you have to change it in the file as well, but it should allow you to maintain two seperate files.

This is exactly what I did. Problem: you really have to take care about the different types of controls (for instance a graph: there one obviously wants to change the scale labels or the plot names to - so lots of dynamic checking. Ok this is possible to do on my own - but why do if something already exists ;)).


Another thing you might try to look at is the property saver toolkit. I didn't actually see anything which will help you with this, but you might find something. I think it will probably be faster to do this yourself.

I just had a brief look at this, but this tool seems to store also other properties and as I just want to store language-related properties, it is not really what I'm looking for.


The documentation for the Import method suggests that it is available in the RTE and the only limitation is that the VI needs to be idle. In that case, all you need to do is dynamically call the VI, import the strings and then run it.
Ok - sounds nice but calling all vis before loading them - hmm - I don't know. In addition to that - dynamically called vis will obviously be left if I don't handle them directly.

The tool I implemented is (up to know and as long as there is no better solution) used in each vi. I call an init-vi, which creates a default file, if the translationfile does not exist yet, or it loads the specified language into the FP.

But thanks anyway.

Thomas

Using LV8.0
--------------------------------------------------------------------
Don't be afraid to rate a good answer... 😉
--------------------------------------------------------------------
0 Kudos
Message 4 of 13
(4,033 Views)
 Hi,

tst wrote:
The documentation for the Import method suggests that it is available in the RTE and the only limitation is that the VI needs to be idle. In that case, all you need to do is dynamically call the VI, import the strings and then run it.

Does it mean that, we can use import method at runtime? If the answer is yes, how can I use it?

 

Thanks.

0 Kudos
Message 5 of 13
(3,407 Views)

Like I said in an earlier reply, you load the VI dynamically (using Open VI Reference), then call the method and then call the Run VI method. I never did this myself, so this is based on the documentation which says the method requires the VI to be idle. This will also require you to explicitly include the VIs in the build.

 

If you're looking to translate a front panel dynamically, there are also other ways, such as the ones already mentioned in this thread or things like this. (05/03/2017 - Admin Note - Content has been removed from ni.com - Karina Barles) 


___________________
Try to take over the world!
0 Kudos
Message 6 of 13
(3,376 Views)

tst wrote:

Like I said in an earlier reply, you load the VI dynamically (using Open VI Reference), then call the method and then call the Run VI method. I never did this myself, so this is based on the documentation which says the method requires the VI to be idle. This will also require you to explicitly include the VIs in the build.


Where can I find the documentation?

0 Kudos
Message 7 of 13
(3,366 Views)

In the Help menu.

Or by right clicking the method and selecting Help for...

Or by searching online.


___________________
Try to take over the world!
0 Kudos
Message 8 of 13
(3,355 Views)

tst wrote:

In the Help menu.

Or by right clicking the method and selecting Help for...

Or by searching online.


Import String is only a menu item(tools-advanced-Import Strings). I could't find that method on function palette. How can I use this method on my code? 

0 Kudos
Message 9 of 13
(3,329 Views)

Help menu.

Search.

"import strings".

Look through the results.


___________________
Try to take over the world!
0 Kudos
Message 10 of 13
(3,322 Views)