Thursday, October 17, 2013

Internationalization in Demandware

i18n / internationalization

Although internationalization (or i18n for short) covers a number of different aspects, its primaryrole is to provide pages in multiple languages. To ensure this can be achieved, one should never include language-specific text in a template or controller directly. Instead of this, one should use the Demandware property mechanism. As familiar from languages such as Java, this permits thedefinition of entities known as "property" files, which assign the actual language-specific texts to unique keys. Since Demandware loads all property files automatically, this means you always have access to the keys of all property files.

Instead of using the Resource class from Demandware, you should utilize the i18n method provided by the framework. This offers a few extensions that, among other things, permit the utilization of property file content in frontend JavaScript functions.
Sample property file (""):

user.profile.complete.head=Complete Your Profile is this?


Ujjwal Soni

1 comment:

s said...

Using Resource class doesn't harm in any way. Based on the locales, if you have locale specific property files then it will automatically grab the text based on the locale.