H-Sphere Customization Guide

Adding Languages to H-Sphere Interface

(outdated in 2.4)

 

Related Docs:  

Introduction to Bundles Adding New Languages (HS 2.4 and up)

This document explains a regular way of adding new language using the language bundle compiler. We assume you know what language bundles are.

WARNING:
Interface text customization implies that you don't make any changes to default bundles!
You may need these files to restore the original setup, plus, all changes in default files will be lost with the next H-Sphere upgrade.
  1. Login as cpanel user under root:

    su -
    su - cpanel

    All affected files must have cpanel:cpanel ownership.

  2. Create custom bundle directory, e.g., ~shiva/custom/bundles if it is not created yet.

  3. Set custom bundle location in hsphere.properties (if it's not set):

    CUSTOM_TEMPLATE_BUNDLE=custom.bundles.hsphere_lang
    CUSTOM_MENU_BUNDLE=custom.bundles.menu
    CUSTOM_USER_BUNDLE=custom.bundles.messages

  4. Add bundles for a new language in the ~shiva/custom/bundles directory. These files must be named accordingly. For example, for Portuguese (Brazil):

    hsphere_lang_pt_BR.properties
    menu_pt_BR.properties
    messages_pt_BR.properties
  5. Place translation of default English texts into these newly created files. Default English text files are located in the default bundle directory:

    hsphere_lang.properties
    menu.properties
    messages.properties

    If a label or message has a variable in curly brackets, e.g. {0}, single quotes and apostrophes (') must be replaced with two single quotes (''). For example, in English we write:

    search.view_invoice = View Client's Invoice

    but:

    billing.del_no = No, I don''t want to delete {0}

    Note: With upcoming versions of H-Sphere, default English texts may be changed and new labels may be added, so you need to update translation of your language bundles accordingly.

  6. To ensure that the new language is available to choose from the interface, add a label for your language (ID and definition) into the shiva/custom/bundles/hsphere_lang.properties file, following the pattern:

    misc.langs.<XYZ>lang = <LANGUAGE> (<ENCODING>)

    Consider this example for the Portuguese (Brazil) language:

    misc.langs.ptlang = Portuguese (Brazil)

  7. Add new language to the list of languages available in H-Sphere. For this, add respective language and encoding to the LANG_LIST parameter in hsphere.properties. For example:

    LANG_LIST = en_US_ISO8859_1|ISO-8859-1:misc.langs.englang pt_BR_ISO-8859-15|ISO-8859-15:misc.langs.ptlang

    This line contains definitions for the languages that come with H-Sphere, delimited with whitespace, each including the following components:

    <language>_<COUNTRY>_<ENCODING>|<html_encoding>:misc.langs.<XYZ>lang;

    Here, misc.langs.<XYZ>lang; is a label for a language set in the previous step.

  8. In hsphere.properties, set system locale and encoding to custom values. The locale should correspond to the Java ISO standards, the encoding must correspond to the browser standards. For example, settings for Portuguese (Brazil) will look as follows:

    # Override system locale
    LOCALE = pt_BR
    # Encoding
    ENCODING = ISO-8859-15
    # System database encoding
    DB_ENCODING=ISO-8859-15

    The LOCALE value will affect not only the interface language, but also the currency, date, time, days of the week and other locale settings.

  9. Logout back to root and restart H-Sphere.

Notes:

1) To have your translation incorporated into the future versions of H-Sphere, please send the translated files to support@psoft.net.

2) Language bundles for Portuguese (Brazil) are available for download from our site.

 


Related Docs:  

Introduction to Bundles Adding New Languages (HS 2.4 and up)



© Copyright 1998-2006. Positive Software Corporation.
All rights reserved.