Label translations

02/05/2011

Translations for titles of pages, titles of text and image fields, hints and predefined values in templates are done separate from web-to-print extension interface translations. For example you have a template in English and want the field names to be in English and French depending on the user’s choice.

Magento supports interface translation out of the box. Our web-to-print extension uses this to translate its interface (messages, labels of controls in personalization form and image editing window) for different locales. Labels in templates are translated separately. It allows you to use the same template for multiple languages as long as the fonts used in the template have required glyphs.

Create a template

Create a template file the way you usually do it. Make sure you use fonts that support all languages you want to target. Using Unicode fonts is the most reliable choice, but they are not always available.

Grab the list of the template fields from a web page after you uploaded it. You will need the names for the translation file.

Translate labels

First of all, you need to prepare a translation file for the necessary language (locale). Fill it with original and translated labels. These can be:

  • titles of pages,
  • titles of text and image fields,
  • hints and
  • predefined values

You can create this file yourself using any text editing application (Notepad, Notepad++ etc.). It should be saved with UTF-8 encoding. Example:
1
2
"Phrase to translate","Translation of the phrase"
"Original word","Преведен збор"

As an important requirement, the file must be named ZetaPrints_WebToPrintCustomTranslations.csv

Note. Translated strings cannot contain “double “quotes””.

Upload the file

Upload the file to app/locale/locale_name folder of your Magento installation, where locale_name is the name of the specific locale folder.

Ex. Locale name for Spanish language is es_ES, for German language is de_DE.

Note. If locale’s directory doesn’t exist then simply create it.

When a customer switches to a localized store view, Magento gathers translation texts from all available translation files in the locale folder. So, if you have a ZetaPrints_WebToPrint.csv file that holds translations for the web-to-print interface and a ZetaPrints_WebToPrintCustomTranslations.csv file that holds translations for the template labels, your store will truly be translated.

You have to enable necessary language (locale) to give your customers the option of viewing your store in their language.

Note. Be sure to clear Magento cache for the changes to take place.

See also: