info@janox.org



Return to documentation index

Title: Translating Janox application

Content:

- Preamble

- Labels collection

- Translation table

- Activating language translation

- Translating menu


Preamble

This document is about the "Janox multilanguage support", a Janox feature intended to provide an easy and run-time way to translate a Janox application to other languages.

In this way translation time can be deferred to run-time: a super-user (user with administrative roles) can proide a new language translation without any application recoding.

The system is based on collecting strings to translate to external translation repositories. A repository is a translation table in the form:

"app-lang-string" = "new_lang_string"

and can be edited as a standard text file.

By this structure we get 3 important targets:

1. Any new language translation can be provided by the application owner/administrator, without involving application developers

2. Translation tables are external, easy-reading standard text files: easy to seek and edit, easy to be given outside for translating.

3. Translations can be added and modified while production: missing translations will appear in the original language and application will go on.


Labels collection

The first step is to create the translation repository for the needed language.

First of all you need to log as "root" to the application you want to translate. From Administrator context menu run Options->Preferences to set the language code you want to provide ("eng", "ita", ...): any standard file name is allowed. Log-out and log-in again.

Now you will get a new Administrator context menu item: "Start labels collection". Call this function and navigate throw your application interfaces. From now on each time you open an interface (window) all strings will be collected to a translation repository.

NOTE: Only labels that really appear on interfaces will be collected, not all application labels: to get labels from a window you need to run that window while collecting labels.

Collection function will be active untill you quit the session or untill you run "Stop labels collection" from Administrator context menu.

Now a new "lang" folder has been created in the application root, containing a file named as your language code. For example: if you set language code to "eng", after labels collection you will find "<app-root>/lang/eng" folder and file.


Translation table

This new created file is the translation repository for your language code.

Now you can edit this file with a standard text editor: all you need to do is to provide a translation for all collected strings in the table, while you have on the left-hand of the match the "original application language string" (key) and on the right-hand the "new language translated string" (value).

Translation table is divided into 3 parts:

1. NEW WORDS TO TRANSLATE

When <key>=<value> the string is considered "to translate": it is mostly the case of new collected labels.

2. TRANSLATED WORDS

When <key>!=<value> the string is considered "translated" and it is put in this section.

3. SAFE WORDS

When you provide a blank ("") translation value for a string, you declare that string "safe" and it will remain unchanged in translation: it is useful for removing this kind of strings from first section (NEW WORDS TO TRANSLATE).

Each time you run "Labels collection", translation table will be updated and re-arranged.


Activating language translation

To activate a language translation for a user just set the user option "lang" (in options Janox system table) to a language code "<lang-code>" and provide file <app-root>/lang/<lang-code> as translation table (see "Labels collection" and "Translation table").

To set la "lang" option you have two ways:

1. by application, inserting in system table "o2_options"

2. allowing user access to system interface "o2sys_options_admin".

From now on, when the user log-in, all labels will be translated to the set language code, if a translation is provided, else the original language string will be used.


Translating menu

Menu are translated a part: to provide a menu translation table for a language named "<lang-code>", just copy your application menu repository from

<app-root>/prgs/menu_repository.inc

to

<app-root>/lang/<lang-code>.menu.

The <lang-code>.menu file can be edited as text (PHP) file: string to translate is the fourth parameter of the function "o2def::menu_item()".


Return to documentation index

 
Janox is distributed under the terms of the GNU Lesser General Public License (LGPL)