Tuesday, June 16, 2015

How to change locale on your Store app (ATG Oracle commerce)

ATG does provide a mechanism to change locale on your application very easily with a component called RequestLocale, this componet can change the locale of the application and it is a session component, just need to change localeString Property to use the locale you want.

Inside a jsp can change the locale, below is an example of how to change it when switchTo parameter is send:
Once this is done the application will read the resource bundles from the new locale, so the site will be on the new locale. Important Note: For the Repository translations it will be needed to set
 /atg/dynamo/servlet/pipeline/DynamoHandler.generateRequestLocales to true.

This will serve repository translated properties by locale.

This can be found on documentation at: http://docs.oracle.com/cd/E24152_01/Platform.10-1/ATGPlatformProgGuide/html/s1807allowinguserstochoosealocale01.html and http://docs.oracle.com/cd/E23095_01/Platform.93/ATGProgGuide/html/s1808characterencodingandlocaleconfig01.html

It is important to note that if there is a missing key on resourceBundle the site will display this ????theBundle.key?????

And also if there is not translation or resourceBundle associated with the locale provided, ATG will use the default one which is en_US.

Here are some screenshot examples of the above code working on a store header.





This post is related to this translations post, which shows how to configure a Repository to use different locales.
Post a Comment