...
Warning |
---|
Currently this localisation method is only available for properties set within a client config, so for example it's not yet possible to specify localised labels for an entity or a search using this method. |
The actual values to be displayed to the users are set in a separate client resources configuration item, where you outline the text to be displayed to the user and give each piece of text a unique id, then reference that id where previously you'd use the text directly.
...
e.g. http://server:8080/weave/main.html?locale=sv
or http://server:8080/weave/index.html?locale=en_AU
Resource property files
Version 2.15.8 of the com.cohga.client.weave bundles adds support for resources defined in external properties files, rather than just in <resources> tags in config files.
All .properties files in a 'i18n' directory under the 'workspace' directory will be processed for loading of resources. The format of the files should follow the standard Java properties file format, e.g. each line should be of the format 'name=value'
If file name include an underscore, '_', in the base name then the characters after the underscore will be the locale for the resources, the part of the name before the underscore is ignored. e.g. test_sv.properties will contain Swedish resources. No underscore means no locale for the resources so they'll be used as default values.
Info |
---|
The file should be stored with UTF-8 encoding, although if the file contains a BOM (byte order mark) it can use other UTF encodings. |
Note |
---|
This encoding is different from "standard" Java properties files which assume an ISO-8859-1 encoding, but that would mean that a lot of non-ascii characters would have to be encoded using "\uXXXX" format in the file which would be too much of a pain to manage for people doing the translations. |
Finally, it's possible to zip up the contents of the i18n directory and have that used instead of the i18n directory itself.
Other text
By default Weave only performs i18n substitution of %
prefixed values that are contained within the client config, so if you need to internationalise other items, for example map layer names, this will not happen by default.
You can enable i18n processing of all responses sent from the server to the client, which includes stuff like the layer names from map engines or toc model entries, you need to set the system property weave.i18n.all
to true
, by adding -Dweave.i18n.all=true
to startup.cmd and/or weave-service.conf.
This way you can setup your underlying map engine (ArcIMS, ArcGIS, etc) to return "%map.layer.property", or for the toc model layer label, for the layer name for a Property layer, and by setting up the appropriate resources for the map.layer.property
value the layer will appear in a localised name for the user.
Console
By default Windows may not correctly display UTF-8 characters in the OSGi console.
To fix this you need to change the default font for the Command Prompt to a true type font (for example Consolas or Lucinda Console) and then execute chcp 65001
This should be done before running startup.cmd, from the same command prompt window where you just entered the chcp
command.
Alternatively you could edit the startup.cmd file to include the chcp 65001
command and set the command prompt as the default.