Child pages
  • Internationalization - I18N
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 13 Next »

Support of multiple languages, also known as the standard i18n ('i' + 18 letters in 'nternationalizatio' + 'n'), is a Servoy feature that enables developing solutions that:

  • Do not require additional forms or elements to display more than one default language.
  • Can display multiple languages based on locale references.

This feature includes language keys for every Servoy menu item as well as all Servoy system information, warning and error dialogs. In addition, it also includes a complete set of locale message text for Servoy i18n system language keys in German, Dutch (Netherlands) and Italian.

Servoy provides i18n functions as part of the built-in Servoy Library, which means that one can set/get i18n message keys and values programmatically as part of a Servoy method (script).

This chapter gives a detailed view of the Servoy i18n feature and how to use it programmatically.

In This Chapter

Solutions Using Multiple Languages

To enable a solution to support more than one language, the following actions need to be performed:

  1. Assign or create an i18n table to store multiple language keys.
  2. Create the i18n language keys that will be used or edit any of the language keys included in Servoy.

Note that only the i18n table set on the main solution is taken into account. All i18n messages of the solution, including its modules, will be stored into that table.

Definition 

Inside Servoy Developer the message files are stored as property files in the workspace, under resources > messages. At runtime though, they are stored in the database. Thus, at some point before deploying to the server, the data in the workspace needs to be transferred to the database table. This can be done either at solution export, by checking the Export i18n data checkbox in the Export Wizard, or during design by right clicking the I18N files node under Resources in Solution Explorer, and choosing Write to DB option from the context menu.

On the server, the messages are loaded in the i18n table which was specified in the solution settings. The table needs to have the following columns:

  • tableName_id  (primary key, integer)
  • message_key (i18n key, string)
  • message_language (i18n language, string)
  • message_value (i18n value, string)

Usage

On Servoy elements it is possible to use a text reference, which is a key linked to a messages file. Which is replaced at runtime with the localized text from the messages file.

An example of an element text reference is: i18n:hello_world

Which is looked up in the messages file and produces the text in a locale like 'hello world' or 'hola mundo' in Spanish.

I18N Configuration

Servoy provides support in Developer to enable problem markers on non-externalized strings. By default, these type of problems is ignored, but this can be changed from Preferences page.

To set the severity level of the non-externalized problem markers, go to Window > Preferences > JavaScript > Errors/Warnings > Externalized strings

 

  • No labels