How do I get the internationalized version of a system text in JAVA?

7
I'm generating a document, and I want to print boolean values depending on the user language. Getting the language out of the session is no problem for me. But how get I the internationalized version of for example the boolean value 'true'? In the modeler I have defined the value "Ja" for the language Dutch for the system text "True". How can I resolve the "Ja" value in JAVA? Please give an example solution for this case.
asked
1 answers
5

First lookup the i18n key by calling the getSystemTextMapping(String key) method from the class ModelerAPI. Subsequently the translation can be retrieved using Core.getInternationalizedString(IContext context, String i18nKey, Object ..args) or Core.getInternationalizedString(String languageCode, String i18nKey, Object ..args). The arguments parameter is optional here (can be used for template variables).

A code snippet illustrating this procedure:

String i18nKey = ModelerAPI.getSystemTextKeyMapping().get("mendix.widget.MxDataGrid.true");

String translation = Core.getInternationalizedString("en_US", i18nKey);

The translation of the boolean value 'false' can be found using the key "mendix.widget.MxDatagrid.false".

answered