Altova StyleVision 2024 Professional Edition

Example: Multiple Languages

Home Prev Top Next

Very often, documents and Authentic Forms will need to contain content in multiple languages or will require the user to choose a preferred language. StyleVision offers a range of features that can be used to achieve these goals. Given below are some possibilities, all of which which are demonstrated in the Multiple Language examples in the Examples project delivered with StyleVision. (The Examples project should load automatically by default when you first start StyleVision. It can also be loaded by selecting the menu command Project | Open, and then browsing for the Examples.svp file in the folder: C:\Documents and Settings\<username>\My Documents\Altova\StyleVision2024\StyleVisionExamples.)

 

Using variables and conditions

The user's preferred language is entered in an editable variable. A condition with multiple branches maps each language to the correct language content. The user's language choice is used to select the correct conditional branch.

 

ExMultiLangCond01

 

In the screenshot above, notice that the user's choice is entered as the value of the editable variable. The conditions in the table have two branches for the two language choices and test for the value of the editable variable. The Authentic View output is as in the screenshot below.

 

ExMultiLangCond02

 

The above strategy is well-suited for forms in which the user selects the required language. For details, see the file, MultiLangByCondition.sps, which is in the Examples project.

 

Using parameters and Auto-Calculations

Another scenario would be one in which the same data is required to be output in different languages. A possible strategy for this requirement would be to use a parameter, the value of which triggers the required language output. The appropriate language output can be determined, for example, by means of an Auto-Calculation. The Auto-Calculation could output the appropriate content according to the value of the parameter.

 

ExMultiLangAutoCalc01

 

In the screenshot above, the Auto-Calcs have XPath expressions of the form:

 

 if ( \$Language = 'E' ) then 'First' else

 if ( \$Language = 'G' ) then 'Vorname' else ''

 

The value of the \$Language global parameter can be modified in the SPS design or can be supplied via the command line at runtime. Multiple transformation runs can be made to output the same data in multiple languages.

 

For details, see the file, MultiLangByAutoCalcs.sps, which is in the Examples project.

 

Example files

For more examples, open the Examples project file, Examples.svp, which is in the folder: C:\Documents and Settings\<username>\My Documents\Altova\StyleVision2024\StyleVisionExamples.

 

© 2017-2023 Altova GmbH