Creating and Shipping a Localized Application Using LabWindows/CVI
Table of Contents
This document describes how to use LabWindows/CVI to create and ship a localized application. For more information about creating localized applications, refer to the sample program located in the \samples\apps\localui directory of the LabWindows/CVI installation directory. For more information about the LabWindows/CVI features described in this document, refer to the LabWindows/CVI Help.
Install Fonts and Character Sets
Complete the following steps to ensure that the proper fonts and character sets are on your development computer. (Note: These directions assume you are running Windows XP.)
- Open the operating system Control Panel and select Regional and Language Options.
- Click the Advanced tab. In the Language for non-Unicode programs section of the Advanced tab, select the language you want to translate your application to.
- Click the Languages tab and then click the Details button to open the Text Services and Input Languages dialog box.
- In the Text Services and Input Languages dialog box, click the Add button to open the Add Input language dialog box.
- In the Add Input language dialog box, select the language you want to translate your application to from the Input language drop-down list.
Create a Language Resource File
Complete the following steps to create a language resource (.lwl) file, use the .lwl file in a LabWindows/CVI project, and create an installer application for that project.
- In LabWindows/CVI, select Tools»User Interface Localizer to launch the CVI GUI Localization Utility.
- With the utility open, select <Alt-Shift> to cycle through the languages available on your computer and select the language you want to translate your application to. By default, the languages appear in your desktop toolbar. If you are using a multibyte language, you also must select <Alt-`> to open the Input Method Editor (IME).
- In the utility, select File»Load GUI to load the .uir file you want to translate.
- For each user interface item, enter a local language string in the Local Language control.
- Select File»Export Language to export the .lwl file.
- Add the exported .lwl file to your LabWindows/CVI project.
- In your source code, call LocalizePanel, which is available in \toolslib\localui\localui.fp. Insert this function after LoadPanel and before DisplayPanel.
- Select Build»Create Distribution Kit to open the Create Distribution Kit dialog box. In the File Groups section of the dialog box, select the default file group and then click the Edit Group button to view the contents of the file group. Verify that the Selected Files list includes the .lwl file you created in the previous steps.
Translate the Run-Time Message File
You must translate the run-time message file if you want run-time dialog boxes, such as the File Open dialog box, to be translated. Complete the following steps to translate the run-time message file and update the installer application to use the localized message file.
- Create a copy of the msgrte.txt file that is located in the \bin directory of the run-time engine installation directory. (The run-time engine installation directory is typically C:\WINDOWS\SYSTEM32\cvirte). Name this copy using a language-specific name, such as msgrte_russian.txt. (Note: The remainder of this procedure will use msgrte_russian.txt to refer to the new file.)
- Use a text editor to modify msgrte_russian.txt. Translate only the text that is inside quotation marks. Do not add or delete any message numbers.
- Use the following commands to run countmsg.exe, which encodes msgrte_russian.txt for use with the run-time engine and renames the new message file. countmsg.exe is located in the \bin directory of the LabWindows/CVI installation directory. (The LabWindows/CVI installation directory is typically C:\Program Files\National Instruments\CVInn.)
countmsg msgrte_russian.txt msgrte.new
del msgrte_russian.txt
ren msgrte.new msgrte_russian.txt
- Write a batch file that replaces the non-localized message file with the localized message file. An example batch file follows:
REM The first two lines handle the difference between the system dirs in Win9x and WinNT/2000/XP
SET systemname=system32
IF EXIST %WINDIR%\win.com SET systemname=system
COPY /Y %WINDIR%\%systemname%\cvirte\bin\msgrte_russian.txt
%WINDIR%\%systemname%\cvirte\bin\msgrte.txt - Open the Create Distribution Kit dialog box in LabWindows/CVI. In the File Groups section of the dialog box, click the Add Group button. Name the new file group and add msgrte_russian.txt and the batch file you created in step 4 to the file group.
- In the Create Distribution Kit dialog box, select None in the Create Shortcuts control, select Windows System Directory in the Group Destination control, enable the Relative Path control, and set the Relative Path to cvirte\bin.
- In the Create Distribution Kit dialog box, click the Advanced button and select the batch file you created in step 4 as the Executable Filename to run after setup.
You can now build the distribution kit for your localized application.
Additional Resources
- LabWindows/CVI Developer Newsletter
View the latest tutorials, tips, and tricks, suggest upcoming topics, and subscribe to the quarterly newsletter.
Reader Comments | Submit a comment »
Legal
This tutorial (this "tutorial") was developed by National Instruments ("NI"). Although technical support of this tutorial may be made available by National Instruments, the content in this tutorial may not be completely tested and verified, and NI does not guarantee its quality in any way or that NI will continue to support this content with each new revision of related products and drivers. THIS TUTORIAL IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND AND SUBJECT TO CERTAIN RESTRICTIONS AS MORE SPECIFICALLY SET FORTH IN NI.COM'S TERMS OF USE (http://ni.com/legal/termsofuse/unitedstates/us/).
