Jump to content

Multilingual, export captions, export strings, Front Panel Control


Recommended Posts

Hi All,

I've read a bazillion posts, and help pages in the last two days and noone has directly answered the question on how to traverse through a front panels controls and save them to a text file for translation in a multi-lingual app. There's a BEAUTIFUL commercial toolkit (translate.vi) offered for 290 Euros at www.rofa.at, and another "toolkit" from another company for $4000 that does on the fly import and export, but i'd like to do something open source. Using the rofa idea, that's the direction i'd like to go in.

There aren't alot of descriptive help docs on NI for dealing with generic references surprisingly and the best/only way to learn it is to see an example... Thanks to Stefan K. over on the NI forums for this little nugget http://forums.ni.com/ni/board/message?boar...d=266695#M74953

It was kinda the final brick in the wall...

Attached is a rough working sample of the direction i think this vi has to go in... and with my feeble LV skills, maybe you guys can help point me in the right direction. This vi is only the front end, which will collect the refnums using the 'TRef Get All FP References.vi' and sort through the returned array of refnums using a huge case statement selected by 'ClassId' (please advise on this). Once we get the captions, (or text values in the cases of boolean ctrls), parsed out to a tab delineated text file, you'll have to do the manual translation.

The import is going to be reading the text file strings and doing alot of string compares with the FP refnum caption/text properties. We'll worry about that once we get the front done. i'm thinking 'Read from spreadsheet.vi'.

Have a look and see what i'm missing, or if i'm off track...

Link to comment

Your example is missing the translate subVI.

Also, you probably want to specify the format of the file better.

I haven't done something like this myself, but I would try a tab delimeted text file for each language with the following columns:

Label,Class ID, Caption, Strings...

The key here is that the strings section changes based on the control class, as you've shown in your example. There is also a need to decide how much you keep (e.g. do you keep the strings in trees, listboxes and combo boxes?) as that may require a more complex architecture for saving.

Also, note that I suggested using the label (for a lookup). This is safer than just using the order as you did, but can still break if the user changes the control label.

Then, you need to decide how to translate the captions. If you have a tab delimited text file, you can simply let the user edit it manually, but that has potential for errors. You could write a GUI for this which would basically have a listbox and a subpanel with the list of controls. Then, selecting a control loads an appropriate VI into the subpanel for editing the strings for that control. If you want, you can use LVOOP for this which would simplify some of the saving and loading issues.

Link to comment

Try this out - it's from one of our old internal reuse libraries. The dat file is "=" delimited text-based. It's not something we've done much work on in a long time and I know it's not feature complete, but it might help you find the direction you're looking for. It just searches through FP nodes for English labels and then replaces their respective captions with the corresponding selected language's equivalent. As with all the code I upload here: all care, no responssibility, so use it at your own risk.

Link to comment

QUOTE (crelf @ Apr 5 2009, 12:59 PM)

Try this out - it's from one of our old internal reuse libraries. The dat file is "=" delimited text-based. It's not something we've done much work on in a long time and I know it's not feature complete, but it might help you find the direction you're looking for. It just searches through FP nodes for English labels and then replaces their respective captions with the corresponding selected language's equivalent. As with all the code I upload here: all care, no responssibility, so use it at your own risk.

Thanks Guys,

I knew ONE of the Maestros would give me a response! But Two, wow, my lucky day. :worship:

This is a neat app Crelf, it's awesome how you had this "lying" around. I'll tell you now that i can see pilfering some of this code later... Using the Panel.Controls[] array in Translate GUI Elements.vi won't get you the refnums of nested controls like Tab Controls without setting up your own handler. The app that i've inherited is one big tab control.

Using the traverseref.llb -> TRef Get All FP References.vi will get you everything. (Got that from a Jim Kring reference in one of those bazillion posts mentioned above). But then you have to deal with generic obj references.

Link to comment

QUOTE (Yair @ Apr 5 2009, 12:17 PM)

:shifty:

Link to comment

QUOTE (loserboy @ Apr 7 2009, 08:48 AM)

This is a neat app Crelf, it's awesome how you had this "lying" around. I'll tell you now that i can see pilfering some of this code later... Using the Panel.Controls[] array in Translate GUI Elements.vi won't get you the refnums of nested controls like Tab Controls without setting up your own handler. The app that i've inherited is one big tab control.

No worries - anytime. It should be pretty straightforward to expand it to include traversing tab control containers.

Link to comment

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.