LoginLogin About

Support » Knowledge Base » General questions » Tips for scripts owners »

Translating new applications into other languages

New versions of several WebAsyst applications (Help Desk, Contacts, Photos, Users section) utilize a different localization mechanism based on the popular gettext programming library. There is currently no convenient interface for this new localization mechanism built in WebAsyst, therefore, please follow these instructions to translate those applications into a new language. This article describes how to translate the WebAsyst Help Desk application into the French language as an example.

Each application is differentiated in the source code of the WebAsyst scripts by a special two-letter code. Use these codes for the purpose of this article:

Help Desk — ST
Photos — PD
Users — UG

Note: To translate WebAsyst Contacts into another language, translate the "Users" section.
  1. In order to add a new language to your WebAsyst account, add a new line to file kernel/languages.csv as shown below:

    language_code    Language_name    utf-8

    The contents of that file with a new language added will look as follows:

    eng    English    utf-8
    rus    Russian    utf-8
    gem    German    utf-8
    fra    French    utf-8
    Note: Between the items of each line tab characters must be used in the file. The easiest way to do so is to copy and paste one of the existing lines and edit it appropriately.
    Tip: If you see a warning message about insufficient permissions at the attempt to save the file, assign wider permissions for it, e.g., 664 or 666, and for its parent directory – 775 or 777. You may restore the original permissions after editing the file.
  2. Enable the newly added language in section "Installer -> Settings -> MySQL server" and save this change.

  3. Download a file with the name of the kind webasystAPP_ID.po from one of the subdirectories inside published/APP_ID/locale/, e.g. the English localization file published/ST/locale/en/LC_MESSAGES/webasystST.po. The localization file for the new language (French in this example) will be created using this source file.

  4. Install the Poedit program on your computer; this software is widely used to edit localization strings processed by the gettext library. Open the downloaded webasystST.po file with Poedit. In its window you will see the localization strings of the selected WebAsyst application. Click the line with a string which must be translated and enter its translation in the lower text field as shown in the picture:

  5. To save your translation, use menu item "File -> Save" in Poedit. While saving the file, the program will also generate a new file with the .mo extension in the same folder in your computer, i.e., webasystST.mo.
  6. Create a subdirectory of the kind language_code/LC_MESSAGES/ inside directory published/APP_ID/locale/ on your server, e.g., published/ST/locale/fr/LC_MESSAGES/, and upload both files into it from your computer: webasystST.po and webasystST.mo.

  7. Note: For translation of strings which do not belong to a certain WebAsyst application (e.g., elements of the common account interface or system messages), please use similar localization files system.mo and system.po inside directory system/locale/; e.g., system/locale/fr/LC_MESSAGES/system.mo and system/locale/fr/LC_MESSAGES/system.po.
  8. Uncomment the following line in file system/app_mode.php as shown below:

    define("DEVELOPER", true);
  9. Run the WebAsyst JavaScript files translation routine by opening the following URL in your browser http://WEBASYST_INSTALLATION_URL/published/APP_ID/lc.php, e.g., http://mydomain.com/published/ST/lc.php.

    For translation of system-related localization strings stored in directory system/locale/, run file system/lib/localization/localization.php; e.g., http://mydomain.com/system/lib/localization/localization.php.

Note: If WebAsyst is installed on a Windows server, the translated files may not be applied immediately. To fix this, restart your web server.

After the page reloads, the translation is completed. To see the changes in your WebAsyst account, specify the newly added language (French in this example) in the "User" account section of your user in "My settings" or "Users" and open the application for which you translated localization strings (WebAsyst Help Desk in this example).