Tip constructing messages for improved localisation
The supervisor of Sage X3 manages localization resources. These resources should be handled and used correctly.
Three types of localized resources exist:
- Engine messages
- Application messages
- UI texts
The difference between the application messages and the UI texts is the following:
- A UI text is identified by a meaningless numeric key (it might be reallocated under some circumstances) that is assigned on the fly.
- An application message is identified by a chapter number and a message number. The development partner has access to the message in the current language by using 'mess(x,y,1)' function,where 'y' is the chapter and 'x' the message number in this chapter.
Local menus are managed exactly as application messages, but some chapters (usually located between 100 and 200) are dedicated to error messages.
It is mandatory to use the mess
function when dealing with errors, warning, or information messages. However, sometimes a message can include variables. The place and the order of the variable elements in the final message can depend on the language.
How to handle this issue:
-
Include tags defined by $N$ in your message text where N can be 1, 2, 3, 4, or 5. Up to five elements can be managed.
-
Use the dedicated functions 'MES1', 'MES2', 'MES3', 'MES4', and 'MES5' located in the 'ASYRFNC' script to generate the final message.
For example: There is a message (chapter 140, message 65), that tells the user that a transaction was interrupted on a given table with an additional reason specified. In French, the message is as follows:Transaction interrompue sur l'enregistrement de la clé $1$ dans la table $2$ ($3$)
.
It could have been translated with the variable elements in another order in English, for example: For the following reason:"$3$", in the table $2$, with the key $1$, the transaction has been interrupted
.
To display an error on the current class where 'TABLE', 'KEYVALUE', and 'REASON' are supposed to be the values to be placed in the message, the development partner would write the following lines:
Local Char FINAL_MESSAGE(200)
FINAL_MESSAGE=func ASYRFNC.MES3(mess(65,140,1),this.TABLE,this.KEYVALUE,this.REASON)
[A]ASTATUS = Fmet this.ASETERROR("",FINAL_MESSAGE,[V]CST_AERROR)