getInternationalizedString to translate String Variables

Is it possible to translate String variables in the modeler? The translation tool of Mendix does a thorough job of translating the UI elements in Mendix both on forms and microflow pop-ups, but sometimes more complex return messages are required, using concatenated strings. Is it possible to use the getInternationalizedString somehow to help translate these composite messages in Mendix? I've Googled and searched the forums and got some Caption/Label/System text translations but nothing that does string messages. See screenshot for an illustration:
2 answers

We talked about this in our Mendix in an International environment knowledge network day. The way this was solved is to create an entity with the warning messages. Then you could solve it with the method described in the post about this subject.




I have used the following trick to abuse the mendix framework a little. What I do is the following:

  • I create an enumeration (Let's call it 'Translation' for easy reference) per module, which contains all translations.
  • Per translatable string, I create an entry in this enumeration. (for example: 'ERROR_MAX_AUTH_USER' could be an entry for this enumeration for you.)
  • In the captions of your application languages you can change it to: 'Error, the maximum number of authorized users is two'. You could also use a token value like [%TOKEN%].
  • When you want to reflect it in your string, you use: 'getCaption(Translation.ERROR_MAX_AUTH_USER) and it will display the text based on the user's locale.

This way you abuse the mendix framework a little, but it should be what you need, and without implementing any custom.