Previous Topic

Next Topic

Locate topic in Contents

Customizing Store Localization

To customize store localization strings for an existing language pack, edit a PHP file located in the /var/opt/hspc-frontend/includes/languages directory. In this case, please keep in mind that your customization will be re-written with standard strings during upgrade. To avoid this, back up the file before upgrade installation and after an upgrade is installed, merge the customized strings back.

Flags icons are located in the /var/opt/hspc-frontend/images/flags directory. Flags icons are named like flag_<country code>.gif. It is required that a flag icon must be named like this and be in the GIF format. Flag size is to be 18x12 pxls.

If you want to add a new language to be used in store, then you will need to:

The procedure of Parallels Business Automation - Standard language packs customization is described in details later in this document. Please look through this chapter before you start customizing store localization.

Now we describe this procedure in details.

To add a new language definition:

  1. Add a new language pack directory in the /var/opt/hspc-root/i18n/ directory. Remember that a new directory must be named by a two-letter language code in upper case, following the ISO 639 language codes.
  2. Put a standard language pack files into this directory. You can copy these files from any of the existing language packs:

    language.xml

    strings.xml

    countries.xml

    states_ca.xml

    states_us.xml

  3. Open each file except for the language.xml and do the following:
    1. Edit a file header, it includes the lang parameter, this parameter must be re-set to a new language pack:

      <?xml version="1.0" encoding="iso-8859-1"?>

      <strings lang="new_language_code" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="strings.xsd">

      Where new_language_code is a two-letter language definition according to , but in lower case.

    2. In the strings.xml file leave only one definition for a new language name, the string ID you add will be later used in a language definition file:

      <string>

      <id>lang_<country code>_uc</id>

      <c>interface language name</c>

      <val>New language name</val>

      </string>

      Where <country code> is to be replaced with a language ISO 639 two-letter code in lower case to form a string ID, and New language name is a language name to be shown in interface, for example, like English.

    3. Delete all the other strings in the other files, so that a file contents will be:

      <?xml version="1.0" encoding="iso-8859-1"?>

      <strings lang="new_language_code" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="strings.xsd">

      </strings>

      These strings are used in Parallels Business Automation - Standard tools only and since you do not need to use a new language pack in any Parallels Business Automation - Standard tools except for store (store uses own localization), leave empty files in a new language pack directory. Now you need only a language pack definition.

  4. Open and edit the language.xml file:

    <?xml version="1.0" encoding="iso-8859-1"?>

    String

    Comment

    <language id="<language code>" title="New language title">

    Set parameters' values in the <language> tag: replace <language code> with a language ISO 639 two-letter code in lower case, and New language title - with a new language name.

    <title_id>Language name string ID</title_id>

    Replace the Language name string ID with a language name string IS you have assigned in the strings.xml file, see item 3b.

    <flag_icon_id>flag_<language code></flag_icon_id>

    Replace <language code> with language ISO 639 two-letter code in lower case

     

     

    <charset>iso-8859-1</charset>

    <utf8_map>ISO_8859-1</utf8_map>

    <dateformat>%d-%b-%Y</dateformat>

    <datetimeformat>%d-%b-%Y, %H:%M</datetimeformat>

    <timeformat>%H:%M</timeformat>

    <posixlocale>en_US.utf8</posixlocale>

    These tags can be left unchanged unless you exactly know what values to use. Since you customize store localization, these settings do not play an important role. In case of problems, contact support.

    </language>

  5. Restart web server, so Parallels Business Automation - Standard will load newly created localization file.

    /etc/init.d/hspcd restart

To add a new language to PHP store:

  1. Go to the store directory and then open the includes/languages directory.
  2. As a sample for translation, take the English file since is is the most full one. Copy the EN.php file into a new file named by a new language two-letter code in upper case, following the ISO 639 language codes standard. For example, for Japanese localization file the name must be JA.php, for Chinese - ZH.php, etc.
  3. Translate the strings in a new file. The number of strings is 350-400.

    Important: Store localization file is a PHP file containing constants definition. Thus, it is very important to escape quotation marks in constants values. Back slash is to be escaped as well.

  4. Put the translated file in the store includes/languages directory.
  5. Add a flag icon. Flags are stored as GIF (and only GIF!) images in the store images/flags directory. Flag icons are to be named strictly as follows: flag_<language ISO 639 two-letter code in lower case>. For example, for English language, flag icon is to be named flag_en.gif. Flag icon size is to be 18x12 pxls.
  6. Language file and flag icon added are to be accessible by user apache. Please change files ownership into apache. A new language must become available right after files are placed into the store directories.

Please send us your feedback on this help page