AMAPstudio

User Tools


Translation assistant

Presentation

The translation assistant can be opened from the dialog boxes by hiting the F2 function key or directly from the menu tools.

It makes it possible to create and change the translation lexicons of the application in .properties files.

The translation assistant handles french (_fr) and english (_en).

The concerned dialogs are :

  • the Capsis dialogs,
  • the dialogs of the modules
  • the dialogs of the extensions.

The technical dialogs like the Java FileChooser are not concerned.

Translation Assistant

We can find .properties translation files in :

  • The capsis kernel ( eg capsis/Labels_en.properties and _fr )
  • The capsis modules ( eg pp3/Pp3Labels_en.properties and _fr)
  • The capsis extension (eg capsis/extension/intervener/DHAThinner_en.properties and _fr)

How to use the assistant ?

The translation assistant is a 4 columns table.

  • The first column contains the keys used in the Java source code of the dialog box.
  • The two following columns show respectively the translations in french and in english of these keys, as they are known by the Capsis Translator (class Capsis.util.Translator).
  • The last columns indicates the file where the key is specified.

Thus, for one dialog, we can find keys from different translation files. We consider that a key should appear in all the files for the different supported languages (here FR and EN).

For example, The lexicon alisier.AlsLabels matches the two files alisier/AlsLabels_fr.properties and alisier/AlsLabels_en.properties. These two file should contain the same tranlsation keys.

Once the changes are done, the Save button alters the concerned .properties files and reloads them in the Capsis Translator. The changes will be visible at the next dialog opening.

How the source file is chosen for a translation ?

The list of keys in the first column is made by reading the source code of the dialog box. This way, we are sure that the list in complete (technical note: looking for the keys used in “Translator.swap” occurrences). The translations in the two other columns are obtained by asking the Translator.

The keys which translation is just modified are written back in the lexicon where they were found (by asking the Translator).

If a translation is not found (in no .properties file), the matching table cell is let empty and the Translator can not give the source lexicon of the key. To find a lexicon for the keys without translations, we process in order this way:

  1. look for a direct reference to the lexicon in the source code (technical note: by searching the instruction “Translator.addBundle”),
  2. hypothesize that the dialog is part of a Capsis module and try to get the id card of the module by following the ad hoc naming conventions and if found, ask it the lexicon name (by idCard.getModelBundleBaseName ()),
  3. create a lexicon from the class name and in the same directory (for the extensions for example).

Note: this detection method makes it possible to translate the keys once the Java source code written without having to open the .properties files with an editor.

Duplicated keys

When saving modification, The translation Assistant will check if a key is declared several times in different .properties file. If it is the case, it will ask to remove those duplicated entry. By answering yes, all the other found key will be deleted.

SVN user

When a lexicon is created, it must be added and commited in SVN. When a lexicon is changed, it must also be commited in SVN. Take care to commit only the lexicons of your own (e.g.: your module / extensions).

help/capsis/extension/generictool/assistant/translationassistant.txt · Last modified: 2013/05/23 08:25 (external edit)