Using Maximo messages in multi-language environments

Your first question could be in this context: “Why should I read translations from the message system? Messages for Message boxes are always displayed in the correct user language!”. This is correct, but let’s assume the case that you would like to fill in a String field in a MBO Record with a text string which should be in the correct language of the user who is using the system. In that case we are not using the message system of Maximo in it’s original form, but more as a translation vehicle which we can ask: “I have a user with German language settings here. Please provide me the the defined translation for message <msggroup> <msgkey>.”. This is cool.

I will show you with a short script how you can display the content of messages in different languages:

#DESCRIPTION:Translate messages in the User-Language
from psdi.server import MXServer

mxServer = MXServer.getMXServer()
userInfo = mxServer.getUserInfo("maxadmin")

def getMessage(group, key):
    return MXServer.getMXServer().getMessage(group, key, userInfo.getLangCode())

userInfo.setLangCode("EN")  
print getMessage("access", "DBConnectFail")
print "--------------------------------------------------------"

userInfo.setLangCode("DE")
print getMessage("access", "DBConnectFail")

The result from running this script directly in the Automation Script Application (see here for details how to run a script) should look as follows:

Selection_045

Quit cool. Instead of printing out the message you could assign it to a variable and do some work on it…

Leave a Reply

Your email address will not be published. Required fields are marked *