Multi Language Management in Workplace Applications

#### Search Results

Search

# Multi Language Management in Workplace Applications

This document covers the following topics:

- General Information

- Language Switch in Content Pages

- Language Switch in Function Tree and Activities Pane

## General Information

The following provides some hints for multi language management in workplace applications which contain Natural layout pages. We assume that the user interface contains a combo box or another control which allows the end user to select the language in a Java-based layout page.

This small Java-based layout page can be very simple:

    <?xml version="1.0" encoding="UTF-8"?>
    <page model="com.softwareag.cis.test.workplace.LanguageSelectionAdapter"
        occupiedpixelheight="0" occupiedpixelwidth="0" contextmenumethod="processAsDefault">
        <pagebody vscroll="hidden" hscroll="hidden" horizdist="false">
            <vdist height="8">
            </vdist>
            <itr takefullwidth="true">
                <coltable0 width="100">
                    <itr>
                        <hdist width="5">
                        </hdist>
                        <combofix valueprop="language" width="90" flush="server"
                            flushmethod="onLanguageChanged">
                            <combooption name="German" value="de">
                            </combooption>
                            <combooption name="English" value="en">
                            </combooption>
                        </combofix>
                    </itr>
                </coltable0>
            </itr>
            <itr>
            </itr>
        </pagebody>
    </page>

For an example of how to integrate such a page layout into a frameset of a workplace definition, see /njxdemos/xml/wpworkplacelan1.xml. For language selection, this file uses the layout /njxdemos/xml/wplanselect1.xml. Based on the user selection, the workplace application has to respond correspondingly. Depending on the application needs, the reactions can be different. The following sections provide information on some basic reactions. Your workplace application may implement its own specific handling.

## Language Switch in Content Pages

When the user selects a different language, the workplace application basically has two choices:

- either close the already started activities after asking or warning the user, or

- force the already started activities to switch to the newly selected language.

The `MFWorkplaceSessionUtil` class in the package `com.softwareag.cis.workplace` contains methods for performing both kinds of reaction.

Regardless of the variant you implement for the currently started activities, you want new layout pages to be started with the newly selected language. If your layout pages are implemented with Natural, use the configuration tool that is delivered with the Natural for Ajax product and set the Language option to Set in workplace. This makes sure that newly added or opened activities use the newly selected language.

## Language Switch in Function Tree and Activities Pane

Sometimes, the newly selected language should only be applied to the activities in the workplace. Sometimes, the workplace application also wants to change the language in the function tree and activity pane.

If you use a static workplace definition (that is, a bootstrapinfo.xml file) and want to change the language in the function tree later, you must use `textid` properties instead of names.

You can change the language for a static workplace definition by reloading the workplace definition. The `MFWorkplaceSessionUtil` class in the package `com.softwareag.cis.workplace` contains convenient methods for reloading the workplace definition. When reloading a function tree, make sure to

- either close the started activities first, or

- update the page titles in the activities pane.

If you modify the function tree dynamically using the NJX:XCIWPINFO2 and/or NJX:XCIWPFUNCTIONS controls and want to change the language in the function tree later, you must also use `textid` properties in these controls.

To update the page titles in already started activities, you simply call the method `replaceLiteralInPageTitles()` of the `MFWorkplaceSessionUtil` class.

To change the language in a dynamically defined function tree, you simply call the method `replaceLiteralInFunctionTree()` in the `MFWorkplaceSessionUtil` class. Instead of reloading the workplace definition, you can also use this method for statically defined function trees.

See also the wpworkplacelan2 example in the Natural for Ajax demos.

### On this page

- General Information
- Language Switch in Content Pages
- Language Switch in Function Tree and Activities Pane