Localizing Your LabVIEW Application to Different Languages

Updated Nov 16, 2023

Environment

Software

  • LabVIEW

 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


This document describes the four steps for easily localizing any LabVIEW application into a different language.

You do not need to have a specific language version of LabVIEW, such as French, German, or Japanese, to be able to enter display text in that language. LabVIEW supports single- and double-byte characters, but it does not support bidirectional scripts (such as Arabic or Hebrew).

If you want to display text in multi-byte character sets (such as Japanese, Chinese, or Korean) in LabVIEW, you only need an operating system of the appropriate language or an MBCS-enabled operating system with an Input Method Editor (IME) for the corresponding language. Also, there are several commercially available language kits that you can add on to the operating system.
 
 

Localize the Front Panel (User Interface) Strings

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.
 

Internationalize your code

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.
 

Extract the VI strings into a text file

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.
 

Translate this text file

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.

With this text file, you can localize the following:

  • VI window titles and descriptions
  • Front panel object captions and descriptions
  • Free labels
  • Default data (for various controls/indicators, including strings, tables, path names, and array default data)
  • Private data (list box item names, table row and column headers, graph plot names, and graph cursor names)
 

Import the localized VI strings into the VI

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:

  1. The width of the label or caption before translation is narrower than the width of the front panel object itself.
  2. The label is not aligned to its default position (for example, the position of the label when you first lay down a control or indicator on the front panel).
  3. The translated string, when imported, is wider than the width of the front panel object itself.


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.

 

Localize Run-Time Menus (if applicable)

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:

  • You can build all your menus dynamically, using the Application Control>>Menus functions. You will need to store your strings in a front panel control, such as an array of strings, in order to export them easily.
  • You can create separate .rtm files for each language. When you Export Strings from a VI, one of the pieces of information that is exported is the name of the .rtm file associated with the VI. Therefore, if you have several exported string files, each can refer to the appropriate .rtm file for that language.

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.

 

Use Localized Bitmaps (if applicable)

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.
 

Use a Localized LabVIEW Environment or Run-Time Engine

To have localized menus and LabVIEW resources for your application, you can either:

  • Get a localized version of LabVIEW (English, French, German, or Japanese) and run your application (.LLB) under the localized LabVIEW environment, or
  • Create an executable and use different language versions of the Run-Time Engine. Localized versions of the Run-Time Engine exist in French, German, and Japanese. Starting with LabVIEW version 5.1, the LabVIEW Run-Time Engine (LVRT.DLL) is separated from the executable program itself.


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.