in

InfoPath Dev

How To Localize Your InfoPath with QdCatalogBase

Downloads: 34 File Size: 377.5kB
Posted By: ErnestoM Views: 73
Date Added: 08-20-2008

To ensure global compatibility, QdCatalogBase uses a mechanism for providing localized strings for all labels and other static text in the form¬¬. To edit the values that already exist, you must open the underlying XML and change the text there.

As seen in Figure 1, double-clicking any of the expression boxes on the form will show you where the value is pulled from at run-time.   The value of this node changes dynamically based on what language is selected.


Figure 1. Changing the <Form Name> value.

The first thing you will want to do when creating a new form based off of QdCatalogBase is change the <Form Name> value to the name of the form you are developing.
 
Modify the <Form Name> node

1. From your DBXL installation, download the latest version of the XSN for the QdCatalogBase Document Type to your local drive.
2. Right-click the XSN and select Design to open it in InfoPath.
3. In the Edit view, add three text fields for the following fields: First name, Last name and Telephone, as shown in Figure 2.
 

Figure 2
 
4. From the File menu, select Save as Source Files (or Extract Form Files for InfoPath 2003), and then choose a directory to save the source files to. Close InfoPath.
5. Open the QdLanguageSource.xml file with the text editor of your choice and find the node specified by the XPath on the expression box.  In our example, this would be the /LanguageSource/cv_form_name node.
6. Edit the value of all instances of this node, making sure to translate the new value into each of the respective languages.
7. Save and close the file.
8. From the folder with all of the source files, right-click the manifest.xsf file and select Design.
9. From the File menu, select Publish and publish a new version of the XSN to your local hard drive. Save the file and close InfoPath.
10. In DAT, add a new configuration and attach the new XSN. When you open this configuration, the form will show the form name you entered. Save the configuration as SampleDocType.

Add Localized Text in QdCatalogBase

To add custom values you must edit the XSD file to add the node, and then correspondingly add the node and value to the XML file.

1. Edit the QdCurrentLanguage.xsd and QdLanguageSource.xsd files to specify the new nodes, as seen in Figure 3 for QdCurrentLanguage.xsd.


Figure 3

2. Add the new nodes with a blank value to the QdCurrentLanguage.xml file.  Be sure to place the nodes in the correct location, as specified by the schema changes in step 2. For our sample form, we have added the nodes seen in Figure 4.
 

Figure 4

3. Add a copy of the new nodes to each of the defined Language elements in the QdLanguageSource.xml file, as seen in Figure 5.

 
Figure 5

4. Save all files and open manifest.xsf in Design mode.
5. Add an expression box pointing to the new nodes that were added to QdCurrentLanguage.xml, as seen in Figure 6.
6. Preview the form to make sure everything is working correctly.

 
Figure 6

7. Publish a new XSN, and upload this into the configuration SampleDocType.

Add Multi-language support

With a few modifications in these language files, we can add multi-language support to our forms.

1. Using a text editor, open QdLanguageSource.xml. The third line of the file contains the beginning of the node: <Language locale="en-US" displayName="English">. By copying this entire node, we can create a second locale. Copy the whole node, until the ending </Language> tag, and paste it immediately below.
2. In this example, we will localize the form to Spanish. Change the locale to “es-AR” and the displayName to Español.
3. In a real world situation, you would have to translate the content of each of the nodes contained within the <Language> node. For the purposes of this example, we will only translate the four that were modified earlier in this form. Change the content of the <cv_form_name> node to Información, as well as the contents of the <cv_firstname>, <cv_lastname> and <cv_telephone>, as seen in Figure 7. Save and close the file.

 
Figure 7

4. From the folder with all of the source files, right-click the manifest.xsf file and select Design.
5. From the File menu, select Publish and publish a new version of the XSN to your local hard drive. Save the file.
6. From DAT, add a new configuration and upload the new XSN.
7. Save the configuration as SampleDocType.
8. Open the configuration and select Español from the language dropdown, as seen in Figure 8.
9. Click on Add Document.

 
Figure 8

10. When the Edit View opens, you will see the title as well as the three fields displayed in Spanish.

 
Figure 9

Filed under:

Comments

No comments exist for this file.
Copyright © 2003-2007 Qdabra Software. All rights reserved.
View our Terms of Use.