How to translate Webasyst into other languages
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 -a
If you cannot see the desired locale in the list, do install it before proceeding to the next step. -
Edit configuration file wa-config/locale.php 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', 'fr_FR', /* adding French language locale */ );
- Create a configuration file for the new locale in directory wa-system/locale/data/; e.g., wa-system/locale/data/fr_FR.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/fr_FR/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: nplurals=2; plural=(n > 1);\n"
In field Language in the same file specify the locale id; e.g.:"Language: fr_FR\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/fr_FR/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/[app_id]/locale/[locale]/LC_MESSAGES/[app_id].po and wa-apps/[app_id]/locale/[locale]/LC_MESSAGES/[app_id].mo.After you complete the translation, you may need to restart the web server to get the translated strings applied.
- Create date selection localization file wa-content/js/jquery-ui/i18n/jquery.ui.datepicker-en_US.js with the new locale ID instead of en_US in this example. Translate localization strings in the created copy into the new language.
- 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.
jQuery(function($){ $.datepicker.regional['en'] = { closeText: 'Close', prevText: '<Prev', nextText: 'Next>', currentText: 'Today monthNames: ['January','February','March','April','May','June', 'July','August','September','October','November','December'], monthNamesShort: ['Jan','Feb','Mar','Apr','May','Jun', 'Jul','Aug','Sep','Oct','Nov','Dec'], dayNames: ['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'], dayNamesShort: ['sun','mon','tue','wed','thu','fri','sat'], dayNamesMin: ['Su','Mo','Tu','We','Th','Fr','Sa'], weekHeader: 'Week', dateFormat: 'mm/dd/yy', firstDay: 0, isRTL: false, showMonthAfterYear: false, yearSuffix: ''}; $.datepicker.setDefaults($.datepicker.regional['en']); });
4 comments
In directory wa-config simply do not exist file locale.php. What should I do?
Create it!
Mike, to manage the translation of Webasyst, you could use the localization app https://poeditor.com/
It is more efficient than poedit, offering a common & friendly workspace for translators.
Hi, how about translating product description?