This article is part of a series on software engineering practices and tools for large application development in LabVIEW. Click here to view the list of other articles
To localize your front panel, you need to internationalize your code, extract the VI strings into a text file, translate this text file, and import the localized VI strings into the VI.
First, you need to internationalize your code (diagrams). While LabVIEW already provides several locale-sensitive features (including time/date formats, currency symbols, decimal separators, and so on), you may need to internationalize other parts of your code.In general, you need to transform any hard-coded string constants in the diagram into string controls (with default values) on the front panel. Another useful technique is to move all your string constants (that need to be localized) into global variables. This step should ideally be part of your development process, but you can easily retrofit your application if necessary.If you are using bitmaps, you should consider using the picture control to load the bitmaps dynamically. This makes it easier to maintain the VI, because you won't have to copy and paste the localized bitmaps each time you modify your application.Note: You can localize most of the user interface controls and indicators except for enum controls, because the strings that make up the enum list strictly define its data type. Whenever an enum control is not necessary, use a ring control instead.Note: Pay attention to case structures with a string selector. They can make the internationalization of your application more difficult.
From the front panel of the VI from which you want to export strings, select the menu item Project>>Export VI Strings. This will generate a text file containing all the VI strings. In LabVIEW 5.x, this text file contains only front panel strings.
The text file that you export has a structure close to XML. (LabVIEW currently doesn't provide a parser that would allow you to extract only the translatable strings. This would be useful for automated dictionary lookups.)When you export your strings, LabVIEW automatically generates captions for each front panel control and indicator. Captions, as opposed to labels, provide only a textual name for a front panel object, and allow you to localize your user interface. The labels are propagated in the diagram through the wires, and are used when referring to a specific terminal in a VI. Therefore, you should not localize the labels.For more information regarding the structure of the exported text file, please see the related link G Programming Reference Manual.With this text file, you can localize the following:
Once you have translated the text file, from the front panel of the VI to which you want to import strings, select the menu item Project>>Import VI Strings. This operation imports the localized strings into your VIs and displays captions instead of labels on all front panel objects. Remember that if you modify the VI later, the exported strings may also change. Importing an old exported text file on a modified VI can result in errors. The process of importing strings creates a log file with a list of any errors that occurred during the operation.When you import strings, the alignment of the owned labels with respect to their corresponding front panel objects also affects the resulting position of the caption. If ALL of the following conditions are met, the resulting position of the caption is undetermined after importing strings:
Condition 3 occurs commonly when you translate strings from English to French or German. German strings can be anywhere from 50% to 100% longer than English strings. The remedy is to make sure that you align the labels or captions for your controls and indicators to their default positions.Also, make sure you leave enough room for expansion of captions. As mentioned above, foreign language strings can be longer than the English strings. If you do not account for this, you may see captions overlapping with other objects and captions as a result of importing strings. This could make the captions difficult to read.
The LabVIEW Export Strings feature does not export strings in run-time menu files, but you can change the association between a VI and its run-time menu (.rtm) file.To localize an application that uses run-time menus, you can do either of the following:
Note: You cannot change the names of LabVIEW's built-in menus. For example, you can't change the name of File>>Open to something else. In the Japanese version of LabVIEW, the application menu items will automatically use the localized names of those built-in menu items. However, this does cause a problem if you want to make Spanish menus. You must either use English menus, or create user menu items (which you can translate) and use the VI Server methods to invoke particular operations in LabVIEW.
If you need to localize bitmaps, you might consider using the picture control to dynamically load the appropriate bitmap at run-time. If not, you will have to paste the localized bitmaps each time you want to modify your original VIs.
To have localized menus and LabVIEW resources for your application, you can either:
Note: In LabVIEW 8.2 and later, the LabVIEW Run-Time Engine is multilingual, so you do not have to include multiple versions of it with an application, shared library, or installer in order to use localized text.To switch from an English to a French interface, replace the English LVRT.DLL with the LVRT.DLL for the corresponding language. To create stand-alone application executables, you do not need to buy a specific language version of the LabVIEW Application Builder. You can build your executable with the English version of the LabVIEW Application Builder and install your executable on a French OS machine with the French Run-Time Engine.Note: For standard dialog boxes, LabVIEW uses strings (such as Open, Close, Save, and so on) that are specific to the operating system. Some dialogs contain LabVIEW specific strings (for example, Select Cur Dir), which LabVIEW displays in French, German, or Japanese, according to the operating system's regional settings, and in English for other countries.Note: Strings in menus (such as File, Edit, Project, Help, and so on) and pop-up menus depend upon the version of the LabVIEW Run-Time Engine you are using with the executable. If you use the English Run-Time Engine, the menus always appear in English, regardless of the language of your operating system. Localized versions of the Run-Time Engine are available in French, German and Japanese, from the NI Support site.
Collaborate with other users in our discussion forums
A valid service agreement may be required, and support options vary by country.