Java Desktop System Configuration Manager Release 1.1 Developer Guide

Localization

It is important to localize all strings that are defined in a template. Localized strings are retrieved from resource files. The resImport sub-element of the apt:template element is used to bind one or more resource files to a template. You need to specify the fully qualified path to the resource and its base name, for example:

<apt:template>
<resImport
  apt:packagePath="com.sun.star.apoc.policies.resource.staroffice"/>

The resource key to be used is defined by providing the name of the key as value of the apt:label attribute, e.g.

<property apt:name="HTTPProxy" apt:label="SO.internet.proxy.name"
          apt:dataPath="org.openoffice.Inet/Settings/ooInetHTTPProxyName"
          oor:type="xs:string">

The Configuration Manager searches every resource file bound to a template for the key specified in the apt:label attribute first. If no key is found, the value of the apt:label attribute is displayed. If a key is found, the corresponding value is retrieved from the resource file and is displayed.

The resource file from which the string is retrieved is determined in a similar way to the mechanism defined for Java: the package path specified in the resImport element and the languages selected in the web browser determine the selected resource file. For example, if en_US is the language for web pages selected in the browser, and the package path specified in the resImport element is com.sun.star.apoc.policies.resource.staroffice, the Configuration Manager searches the following files in the given order for the resource key:

./res/com/sun/star/apoc/policies/resource/staroffice_en_US.properties

./res/com/sun/star/apoc/policies/resource/staroffice_en.properties

./res/com/sun/star/apoc/policies/resource/staroffice.properties

The Configuration Manager searches the files in the local policy package first (see The Policy Package Format). If they are not found, all other packages are searched. This enables strings that are already localized in other packages to be reused, especially for category names.

See the API specification of the Java ResourceBundle for more details on resource recovery.


Tip –

All applications of the Java Web Console determine the language during the login. To force any application to use a new language, you must log out. Then log in again after you have changed the language for web pages in your browser.


The online help should also be localized. The Configuration Manager chooses the HTML file according to the same rules that are applied to the resource files, except that only the local policy package is searched for the help file. For example, if you specify /StarOffice/Internet/Proxy as the path to the HTML file, and en_US in your browser, the Configuration Manager displays the online help file ./web/StarOffice/Internet/Proxy_en_US.html.