|
| Internationalization | Discussion Forum |
| IMF Developer's Guide » Internationalization |
IMF has been developed so that the user interface can communicate in multiple languages. As delivered, the text and images of the IMF GUI are set to display Canadian English, Canadian French, and US English. This document explains what you need to do in order to set up IMF so that it can communicate to your users in other languages or variants of French or English.
There are several considerations and things to convert when using IMF in an alternate language:
Interface text and graphics
The IMF scripts and object model classes do not contain the English text that is displayed in the application. Instead they contain references to text strings that are contained in external files. To add support for additional languages, we simply need to copy one of the resource files and translate the text strings contained into the target language, and name the file appropriately.
The base file is called imf_resource.properties, and is delivered in the WEB-INF/classes directory of the IMF installation directory. When the file is copied, it should be named according to the language and (optionally) the country according to ISO language and country codes. For example:
The way that the IMF web site determines which resource file to use is based on the content of the <LOCALE> element in the site configuration XML document. When IMF encounters an internationalized value (one that needs to be displayed differently in different locales), it locates the substitution text by looking for the value in the following search order:
The following resource files are included with IMF:
The following is a section of the default resource file:
# imfStatus.jsp s00020 = NO ACTIVE LAYER s00021 = Numeric value expected. s00022 = The specified scale is too small. s00023 = Scale s00024 = Zoom to scale that you enter in the box beside this button. s00025 = Map Tool
It may look as follows in the imf_resource_it.properties file (Italian):
# imfStatus.jsp s00020 = NESSUNO STRATO ATTIVO s00021 = Valore numerico previsto. s00022 = La scala specificata �troppo piccola. s00023 = Scala s00024 = Zumi alla scala che registrate nella scatola al lato di questo tasto. s00025 = Attrezzo Del Programma
To use the Italian resource file, simply put the following in the site configuration XML file:
<LOCALE language="it" />
There are three images in the IMF interface that have English text on them:
These images can be replaced with images that you create by changing references to the images in your resource file. The default values are:
# images with text, image url, width, height img01u = images/loadMap.gif img01w = 226 img01h = 47 img02u = images/loadData.gif img02w = 226 img02h = 47 img03u = images/go.gif img03w = 29 img03h = 21
Note that you can change the size of the image, because you may need more or less space for your alternate image.
Numbers and dates
Numbers and dates will automatically be displayed according to the format appropriate for the locale defined without any additional configuration required.
Tabs and tools
You can create tab image graphics in the alternate language and add them to the site configuration XML in the normal way. Tools don't have text, so no action is required. The name, hint, status, and help attributes of the tabs and tools should be in the language of your site.
Layers, fields, data
Layer titles and field aliases are defined in the map configuration file so can easily be displayed in the language appropriate for your site. If the content of fields may be only available in one language, there is nothing that can be done about that. If your database contains multiple fields that contain the same value in more than one language (e.g. PARK_NAME and PARC_NOM), and your site is in French, you can select the field to display in the default reports in the map configuration as follows:
<WMS-LAYER title="Parcs Nationaux" wms-layer-name="G_DR75P:CEOWARE2" ... > <FIELD name="PARK_NAME" visible="false" /> <FIELD name="PARK_NOM" alias="Nom de Parc" /> </WMS-LAYER>
Supporting multiple languages
If you are displaying your mapping application in more than one language, you will need more than one site configuration and map configuration file. To assist someone who finds themself on the wrong site, you should consider having a language tab like the following (english site example) so they can easily change languages:
<TAB url="$IMF/imf.jsp?site=francais"
target="top"
hint="fran�is"
status="Montrez cet emplacement en fran�is."
graphic="$IMF/tabs/27/ltblue/fr/francais63x27.gif"
width="51" height="27" />