Monday, January 23, 2012

Multilingual Confirm/Alert in Browser Script


Working with multilingual can be as challenging as playing tennis with rafael nadal on clay court. Siebel provides outstanding set up to enable multilingual application.

There are different object managers for different langauges. There are symbolic strings for multiple language references, there are message categories to enhance re-usability. Lookup's for value comparison in different languages and not to forget multilingual email templates along with BIP reports giving end user 100 percent localized effect.

There are still some non-localizable elements including log files and help applets. However while working on the browser side i was not able to translate the message in the desired language using "LookupMessage" method as it is only supported on the server side. In order to achieve localization we used below java methods to identify the language in url display message accordingly.

Lets say you want to display confirm box in french application probably this piece may help you to achieve desired results.


var sURL = document.location.href;
var sCount = sURL.search(/fra/i); // this will search for object manager language
if(sCount > 0)
var sMsg = "Décochez va supprimer les données, Voulez-vous procéder";
else
var sMsg = "Uncheck will remove the data, Do you want to proceed?";
if(confirm(sMsg))
return ("ContinueOperation");
else
return ("CancelOperation");


There could be alternates to achieve this. As i write, another issue related to multilingual is dangling in Stop step in workflow. Question is whether we can use LookupMessage function in workflows or not? Any thoughts on this are much appreciated.

Happy Crunching!!





2 comments:

Alex said...

I would discourage placing the translated strings directly in browser script. Instead, use the Messages objects in the repository and access them via a server side business service (which you can call from the browser script). This should be more stable and you can use the business service from everywhere (including workflow processes).

have a nice day

@lex

Siebelish said...

Thanks Alex. I will definitely keep this approach in mind. However the idea behind browser script was if end user requests for some cool message to display then we can directly change .js files and deploy without server downtime.

Regards,
-Rahul-