Salesforce

How Do I Translate an Expression Value to Another Language? (Magic xpa 4.x)

« Go Back

Information

 
Created BySalesforce Service User
Approval Process StatusPublished
Objective
Description

How Do I Translate an Expression Value to Another Language? (Magic xpa 4.x)

The MLS will translate the values on your forms at runtime. However, expressions are evaluated while the program is running, and need to be explicitly translated. This is done using the MlsTrans() function.

For plain text strings, this is done by just wrapping MlsTrans() around the text string, such as:

MlsTrans('Hello world!')

Now, the text will appear in the current selected language.

If you were translating an expression such as:

'User ' & Trim(A) & ' logged off at ' & TStr(Time(),'HH:MM:SS') & ' on '& DStr(Date(), '##/##/####')

wrapping each piece of text in an MlsTrans() function would result in something like:

MlsTrans('User ') & Trim(A) & MlsTrans(' logged off at ') & TStr(Time(),'HH:MM:SS') & MlsTrans(' on ')& DStr(Date(), '##/##/####')

which may or may not be correct in the grammar of the target language. A better way to do this would be to use the StrBuild() function:

StrBuild (MlsTrans('User @1@ logged off at @2@ on @3@'),E ,TStr(Time(),'HH:MM:SS') ,DStr(Date(),'##/##/####') )

This allows the translator to translate

'User @1@ logged off at @2@ on @3@'

as a complete sentence, changing the word order as needed.

Reference
Attachment 
Attachment