Child pages
  • Internationalization - I18N

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

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

Stoc

Solutions Using Multiple Languages

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

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

Selecting i18n Database Connection and i18n Table

The i18n table can be created/chosen from an existing server, or a separate server can be created for the table to be placed in.

The i18n server and table can be selected in:

  • The solution Properties view: i18nDataSource property - select an existing table in a server or create one in the Select i18n table dialog.
  • Solution Explorer under Resources - double click the I18N files node. If no i18n table has been defined for the active solution yet, a message dialog will prompt to define one right away.
  • The Internationalization preferences in the Servoy Developer Preferences dialog - go to Window > Preferences > Servoy > Internationalization. This preference will be applied to all solutions. (warning)(warning)(warning)(warning)(warning)(warning)(warning) doesn't work currently(warning)(warning)(warning)(warning)(warning)
Tip

TIP: Create a single i18n database server connection and i18n table when having a solution that contains one or modules - this allows to add and/or change i18n values and/or keys from either the solution or any of the added modules.

Creating i18n Language Keys

 

Definition 

Inside Servoy Developer the message files are stored as property files in the workspace.

On the server these messages are loaded in an i18n table, the i18n table which can be specified in the solution settings, it 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 message messages file. Which is replaced at runtime with the localized text from the message 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