Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

Ways to use getMessage()

Krishna119
Kilo Contributor

Recommended way to use getMessage() is 

var message = gs.getMessage("This is the message with params {0}", param);
gs.addInfoMessage(message);

Alternately, it can also be written as 

var message = "This is the message with params {0}";
gs.addInfoMessage(gs.getMessage(message,param));

and it works. 

Is there any problem in second way?

 

5 REPLIES 5

Krishna119
Kilo Contributor

I guess it is more to do with translation extractions, which scan code for getMessage() calls and identify strings to translate. In method 1, the string is obvious. In method 2, it is not.