How to translate text in variables/objects

0
Hi, I have the feeling I’m missing a crucial function, but how do you translate text in variables? Say I have two languages defined: English, Dutch. If I set a value/message in a variable or object, I only can put in text in one language without the option to translate it. Is there an internal function (i.e. translateText(‘My Text’) so it’s translated and presented to the user in their own language? Example: I have a variable (string – $Message). Whenever I encounter an error, I add it to the message (‘Error found: 12345). In the end I present the result of the string to the user. However, I am only able to display it in the text as entered in the variable, without an option to translate it. Same goes for when you fill a string attribute with text. My workaround was to fetch the language of the user and to provide a different translated text for each language, but it seems excessive (especially when you have 5+ languages to support). So is there another trick to do this? Like normally there is an internal function which you can call (i.e, translate) and you provide translations in a (text/xml/etc) file.
asked
2 answers
1

No, there is not. But there is a workaround: Create an enumeration that contains the texts that you want to translate and use the related enumeration value as your variable.

See https://docs.mendix.com/howto/logic-business-rules/translatable-validation-messages#2-simple-alternative-for-translating-messages

Limitation is translating combined values and texts like

 ‘We saved ‘ + $MoneyAmount + ‘ euros this year.’

 

answered
1

Check if https://medium.com/mendix/mendix-optimize-runtime-translations-ae6c7ec35dee helps you.

answered