Localizing VIs

You can localize a VI by exporting the VI strings into a tagged file, translating the file, and importing it back into the VI. Localized versions of LabVIEW use the same executable as the U.S. version. Therefore, localized versions are compatible with the U.S. version.

The tagged text file, also known as a VI string file, contains information to localize the VI title, description, control captions, control descriptions, and other private data of controls. Because you cannot localize control labels, a control also has a caption. By exporting the VI strings into a text file, LabVIEW creates a caption for each control and substitutes the label with a caption on the front panel.

Besides translating strings on the front panel, you can use localized decimal separators when converting numbers to strings. Use the Format Date/Time String function to specify how to display the date and time.

You can localize the following VI strings:

Note��Localizing block diagram string constants might cause VIs to break. Breaking VIs is especially likely when block diagram string constants contain multibyte characters.

Syntax of the VI String File

The format of the VI string file is much like an HTML file. The system marks every element with a start tag and an end tag. A start tag begins with < and ends with >. An end tag starts with </ and ends with >. LabVIEW ignores white space characters except within text. Because the character < indicates the beginning of a tag, LabVIEW uses << for the less than character in text. For the > character, LabVIEW uses >> for the greater than character. LabVIEW replaces the double quotation mark with "". Also, LabVIEW denotes end-of-line characters as <CR>, <CRLF>, or <LF>, which are treated as a carriage return, a carriage return followed by a line feed, and a line feed, respectively. The format of the VI string file is intended to be machine readable. Do not be concerned if you find it difficult to read. Each line of an export file contains no more than two tags for private or default data. LabVIEW also indents items once for each nesting level. If you change or delete tags, LabVIEW issues errors when it imports the file into the VI. Refer to the Example of Exported VI Strings topic for an example text file containing exported VI strings.

The following table lists the VI tag types and the corresponding VI tag syntax.

VI Tag Type VI Tag Syntax

[VI string file].

<VI [vi attributes] > [vi info] </VI>

[VI attributes].

syntaxVersion=5 LVversion=nnn revision=nnn name="text"

[VI info].

[vi title] [description] [content] [bdcontent]

[VI title].

<TITLE>text</TITLE> | .<TITLE><NO_TITLE></TITLE>.

[description].

<DESC>text</DESC>.

[content].

<CONTENT>[grouper] [objects]</CONTENT>

[bd content].

<BDCONTENT>[bd objects] </BDCONTENT>

A space separates VI attributes. No space is permitted between the attribute name and the following equal sign and between the equal sign and the attribute value.

For example:

<VI syntaxVersion=5 LVversion=4502007 revision=10 name="AO Generate Waveform.vi">

<TITLE>AO Generate Waveform.vi</TITLE>

<DESC>This VI generates a timed, simple-buffered waveform for the given output channel at the specified update rate.</DESC>

<CONTENT>

........

</CONTENT>

</VI>

The following table lists the tags that describe the content of the front panel (free and object-owned labels, caption labels, attributes) and the corresponding tag syntax.

Content Tag Type Content Tag Syntax

[content]

<CONTENT>[grouper] [objects]</CONTENT>

[grouper]

<GROUPER>[parts]</GROUPER>

[objects]

([control] | [label]) *

[control]

<CONTROL [control attributes]> [control info] </CONTROL>

[label]

<LABEL>[style text] </LABEL>

[style text]

<STEXT>text with font information </STEXT>

Between <STEXT> and </STEXT>, you can type font specifications. LabVIEW encodes font information using the following format: <FONT name="font name" size='3' style='BIUSO' color=00ff00>. You can list the font attributes in any order. Font specification is different from other elements because it has no end tag. For example, you can describe a caption with the text "Boldlabel" as follows:

<LABEL><STEXT><FONT name="times new roman" size=12 style='B'>Bold <FONT style='I'>label</STEXT></LABEL>

You can define fonts as predef to specify one of the predefined fonts�Application font, System font, or Dialog font.

The <GROUPER></GROUPER> tags enclose front panel objects that you grouped together. These tags also enclose each pane you configure with splitter bars. Because the front panel always contains at least one pane, the VI string file always contains at least one set of <GROUPER></GROUPER> tags. Clusters also contain panes.

The following table lists the tags that describe the objects that contain data and the corresponding tag syntax.

Content Tag Type Content Tag Syntax

[control]

<CONTROL [control attributes]> [control info] </CONTROL>

[control attributes]

ID=xxx type="Boolean" name="switch"

[control info]

[description] [tip strip] [parts] [privData section] [defData section] [content]

[tip strip]

<TIP>text</TIP>

[parts]

<PARTS> [part]*</PARTS>

[part]

<PART [part attributes]> [part info] </PART>

[part attributes]

partID=nnn partOrder=nnn

[part info]

[control] | [label] | [multiLabel]

The following is an example of a ring control description with a caption of "Ring" and options Load, Unload, Open, and Close.

<CONTROL ID=87 type="Ring" name="RINGcontrol">

<DESC>ring control</DESC>

<PARTS>

<PART ID=12 order=0

type="Ring � Text"><MLABEL><STRINGS><STRING>Load</STRING><STRING>Unload</STRING><STRING>Open</STRING><STRING>Close</STRING></STRINGS></MLABEL></PART>

<PART ID=82 order=0 type="Caption"><LABEL><STEXT><FONT color=FF0033 size=12>Ring</STEXT></LABEL></PART>

</PARTS>

</CONTROL>

LabVIEW uses the MLABEL (multilabel) tag above to designate the option string on a ring control or the strings on Boolean buttons, a string for each of the four states. The following is a generic description of the MLABEL tag syntax:

[multiLabel]<MLABEL> [mlabel info] </MLABEL>

[mlabel info][font][strings]

The following table lists the tags that describe the default data for strings, tables, arrays, and paths and the corresponding tag syntax.

Content Tag Type Content Tag Syntax

[defData section]

<DEFAULT> [defData] </DEFAULT>

[defData]

[str def] | [table def] | [arr data] | [path data]

[str def]

[string] | <SAME_AS_TEXT>

[table def]

[strings]

[arr data]

<ARRAY nElems=n> [arr element data] </ARRAY>

[arr element data]

[clust data] | [str data] | [non-str data]

[str data]

[string]

[non-str data]

<NON_STRING>

[clust data]

<CLUSTER nElems=n> [clust element data] </CLUSTER>

[clust element data]

[clust data] | [str data] | [non-str data] | [arr data] | [path data]

[path data]

<PATH type ="absolute"> a<SEP> system </PATH>

For [arr data], n [arr element data] must follow the <ARRAY> tag. Likewise, for [clust data], n [clust element data] must follow the <CLUSTER> tag.

For the string control default data [str def], use a special tag, <SAME_AS_LABEL>, which indicates the string default data is the same as the text label on the string parts list. When you use <SAME_AS_LABEL>, it is unnecessary to type the same text for both the text label and the string default data.

For path control default data [path data], the <PATH> start tag can have an attribute that specifies the path type. The possible attribute values are "absolute", "relative", "not-a-path", and "unc". A <SEP> tag separates the path segments that come between the <PATH> and </PATH> tags. For example, on the Windows platform, an absolute path c:\windows\temp\temp.txt is written as follows:

<PATH�type="absolute">c<SEP>windows<SEP>temp<SEP>temp.txt</PATH>

The following tables list the tags that describe private data and the corresponding tag syntax.

Content Tag Type Content Tag Syntax

[privData section]

<PRIV> [privData]* </PRIV>

[privData]

([strings] | [col header] | [row header] | [cell fonts] | [plots] | [cursors] | [path privData] | [tab control privData])

[strings]

<STRINGS> [string]* </STRINGS>

[string]

<STRING> text </STRING>

[col header]

<COL_HEADER> [string]* </COL_HEADER>

[row header]

<ROW_HEADER> [string]* </ROW_HEADER>

[cell fonts]

<CELL_FONTS> [cell font]* </CELL_FONTS>

[plots]

<PLOTS> [string]* </PLOTS>

[cursors]

<CURSORS> [string]* </CURSORS>

[cell font]

[row# col#][font]

[font]

<FONT name="font name" size='x' style='BIUSO' color=000000>

[path privData]

<PROMPT>text</PROMPT>

<MTCH_PTN>TEXT</MTCH_PTN>

<STRT_PTH>[path data]</STRT_PTH>

[tab control privData]

<PAGE_CAPTIONS>[string]*</PAGE_CAPTIONS>

[tab control page]

<PAGE> [description] [tip strip] [objects] </PAGE>

Content Tag Type Content Tag Syntax

[bd content]

<BDCONTENT> [bdobjects]</BDCONTENT>

[bd objects]

([control] | [label] | [node])*

[node]

<NODE [node attributes]>[node info]</NODE>

[node attributes]

ID=xxx type="Sequence"

[node info]

[description] [bd content]

Editing VI Window Titles

You can customize the VI window title to make it more descriptive than the VI filename, which is important for localized VIs. You can localize the VI window title, which is not governed by file-system naming constraints and is still recognized by the VIs that might call it because the calling VI references the subVI by its filename, not its title. Use the export/import tools to localize the window title, or use the Window Appearance page of the VI Properties dialog box to manually change the VI window title while you edit a VI. You also can use the VI Server to change the VI window title programmatically.

Period and Comma Decimal Separators

By default, LabVIEW adapts to use the appropriate decimal separator on your operating system preferences, which affects the display of numbers within controls and the operation of functions that convert between numbers and strings. This causes problems when passing numbers as strings to instruments or parsing instrument output strings.

Note��(MathScript RT Module) When using LabVIEW MathScript, you cannot use a comma as a decimal separator. You must use a period as a decimal separator.

The following functions use the operating system settings by default. To use a period, you must wire a False value to the Boolean input called Use System Decimal Point (+).

For the functions that take a format string, the %x; format code, where x represents the separator character, can be used to specify the decimal separator for that specific call. These functions include:

Select Tools�Options, select Front Panel from the Category list, and place a checkmark in the Use localized decimal point checkbox to specify whether to use the system settings (locale) for the decimal separator or a period.

Displaying Date and Time Values as Strings

You can set the display format of date and time for strings by using the Format Date/Time String function by default. LabVIEW reads the operating system settings and displays the date/time representation appropriate for the current locale. LabVIEW returns abbreviated weekday and month names as numeric values for systems that do not support abbreviated names, such as Chinese and Korean. You can customize the display by selecting Display Format from the shortcut menu.

Time and Date Format for Controls

Use the time stamp control to use, view, and store absolute time with high precision. You can select a custom-fixed format or use a system (locale-specific) format by selecting Display Format from the shortcut menu and configuring the Display Format page. You also can use a numeric control to display time stamp values, but the numeric control holds a relative quantity. The time stamp control holds an absolute quantity.