The default Webasyst package includes only two languages for displaying various text strings in the user interface: English and Russian. Should you need to add other languages, follow the instructions provided in this article.
Ensure that you have the appropriate locale for the new language installed on the web server. For example, in Linux-based operating systems you can view the list of installed locales by executing the following command:
locale -aIf you cannot see the desired locale in the list, do install it before proceeding to the next step.
Edit configuration file wa-config/<strong>locale.php</strong> by adding the locale id of the new language as usually required in POSIX-compatible operating systems; e.g.:
<?php return array( 'en_US', 'ru_RU', <strong>'fr_FR',</strong> /* adding French language locale */ );
- Create a configuration file for the new locale in directory wa-system/locale/data/; e.g., wa-system/locale/data/<strong>fr_FR</strong>.php for French. Look at the contents of other locale configs to understand how to create your own.
Create the system localization file for the new language at wa-system/webasyst/locale/<strong>fr_FR</strong>/LC_MESSAGES/webasyst.po (path example for French). An easy way to do so is to copy a subdirectory with localization files of an existing locale and rename the subdirectory using the new locale id.
In the localization file with .po name extension, in field Plural-Forms specify the plural form detection condition for the new language. Examples of such conditions for various languages are available at http://docs.translatehouse.org/projects/localization-guide/en/latest/l10n/pluralforms.html
Below is an example for the French language:
"Plural-Forms: <strong>nplurals=2; plural=(n > 1);</strong>\n"In field Language in the same file specify the locale id; e.g.:
"Language: <strong>fr_FR</strong>\n"Translate all necessary strings in the localization file by using a special editor with the support for .po files; e.g., Poedit, and use the same editor to generate a localization file with the .mo name extension: wa-system/webasyst/locale/<strong>fr_FR</strong>/LC_MESSAGES/webasyst.mo. For all apps availabe in your Webasyst backend, create similar copies of localization files at the paths of the form wa-apps/<em>[app_id]</em>/locale/<em>[locale]</em>/LC_MESSAGES/<em>[app_id]</em>.po and wa-apps/<em>[app_id]</em>/locale/<em>[locale]</em>/LC_MESSAGES/<em>[app_id]</em>.mo.
After you complete the translation, you may need to restart the web server to get the translated strings applied.
- Clear cache in Installer.
- Select the newly added language in the contact properties of the users who need to view Webasyst backend in that language.