Internationalization of KonaKart

KonaKart is completely multi-lingual both at the database level and at the UI level.

Translating the KonaKart Application

The data within the database such as product descriptions and category names etc. may exist in different languages. The database contains a languages table that contains information about each of the supported languages. When a new product is added to the database through the administration tool, it is possible to enter a description in multiple languages.

With KonaKart you can either store the application messages in message catalog files on disk or in the database. The default is to use message catalog files but from the v5.2.0.0 release it became possible to use the database to store these messages. Some users prefer to manage the messages in the database whereas others prefer files. The choice is yours!

A configuration parameter called "USE_DB_FOR_MESSAGES" is used by the system to determine whether the messages are stored in the database or in files. You can set this value in the Admin Application under Configuration >> Admin App Configuration. The label used in English for this field is "Use D/B For Messages" and it can have a value of "true" or "false".

When the messages (the storefront Application messages, the Admin Application messages and the Admin Application Help messages) are stored in the database you should use the Messages panel of the Admin Application to maintain the messages.

KonaKart Admin Application

KonaKart Admin Application - Messages Panel

Note that when editing the messages using the Messages Panel of the Admin Application you can click on the "Switch Editor" icon (to the right of the "Locale" field) to switch between the Rich Text Editor and the Plain Text Editor. This is sometimes useful to gain greater control over the HTML that is saved (the HTML that is created by the Rich Text Editor can be slightly different depending on which browser you use).

When the messages are stored in files there is a message catalog for each language. These can be found in the WEB-INF/classes directory of the application server. The default message catalog is called Messages.properties. This is defined as the default catalog in the struts-config.xml file in the WEB-INF directory using the following syntax:


<message-resources parameter="Messages" null="false" />

In order to change a language, the following steps must be taken (An example can be seen in the class SetLocaleAction.java):

Struts must be informed of the new language by calling the method setLocale() from within the Struts action. If Struts is passed a locale of en_GB, it looks for a message catalog called Messages_en_GB.properties. If it can’t find that, it looks for Messages_en.properties. If it cannot find that, it defaults to Messages.properties which was set as the default in the struts-config.xml file.

The KonaKart client engine must be informed of the new locale by calling the setLocale() method on it. This call configures the engine so that all subsequent calls will retrieve data from the KonaKart database in the appropriate language.

Translating the country names.

The KonaKart database allows for only one definition of a country name. In some cases (where only one language is used for the store) this is sufficient and no translation of these names is required. In cases where it's required to show the country names in the language of the supported locales you need to follow the following instructions.

You can display a list of countries (for example for display on the customer registration form) in the language of the currently-selected locale by taking the following steps:

  • Set the translated country names in the message catalog for each supported locale (or set these values in the database if you use the database for your messages). The key to use is defined for each country in the countries table of the database (as an example, the default key for the "United States" is "CTRY.USA").

  • Enable the lookup of the translated messages by setting the Use Country Names in Msg Cat configuration variable to true. (The configuration variable key is USE_MSG_CAT_FOR_COUNTRY_NAMES ). You can find this configuration setting on the Configuration >> Store Configuration tab of the Admin Application.

Once set up you can use a call on the KonaKart Application Client Engine (KKAppEng) called getAllCountries() to get a list of countries with the translated names. The list of country names returned is ordered according to the collation rules of the selected locale. You can see examples of the use of this call in the RegisterCustomerBody.jsp source file provided in the download kits.

Translating the KonaKart Admin Application

The KonaKart Administration Application can be completely translated by either editing the messages in two message catalog files (for file-based messages) or by editing the messages stored in the database using the Admin Application itself.

To make the Admin Application available in a new language you need to supply two new message catalog files (for file-based messages) or simply add a complete set of database records for the new language (when KonaKart is configured for database-based messages).

Whichever language you use this is also a handy way to re-label the "custom" fields that appear on many of the important objects within KonaKart to reflect the meaning in your particular system.

In the case of file-based messages, your new message catalogs must be called:


// contains all the strings except the help page text 
AdminMessages_[language-code].properties     

// contains just the text on the help pages
AdminHelpMessages_[language-code].properties 

For [language_code] you should use the 2-character language code that you have set up in the languages section of the admin application. For example, you might have "fr" for French, "zh" for Chinese, "de" for German, "ja" for Japanese etc. You can also use the full locale if you prefer (such as "en_UK", "es_ES", "pt_BR" etc).

For file-based messages you should place your completed message catalogs in this directory:

webapps/konakartadmin/WEB-INF/classes

Since there are quite a large number of messages to translate, you might choose to do this over a period of time. A recommended approach is to start your new message catalogs with copies of the default (English) catalogs (called AdminMessages.properties and AdminHelpMessages.properties) then translate the messages that are most important to you first and complete the rest as time permits.

There are also a number of strings in the database that need to be translated. These are used by the Admin App to label some of the configuration parameters and provide helpful comments. If you issue a: "SELECT configuration_title, configuration_description FROM configuration;" SQL query, you will see the values that you can update.

Also, you may wish to include translations for the velocity templates (eg. EmailNewPassword, OrderDetails, OrderInvoice, OrderPackingList and OrderStatusChange).

Once you have completed the message catalogs, velocity templates and a sql update script for your language, please contribute these to the KonaKart Community by posting them to the contributions section of our forum for the benefit of other users.