How to install application
  1. Upload the files on the server.
  2. Add to file .htaccess, that is in the root directory of a website, line
    php_value auto_prepend_file is included "[full_path]/protected/sli.php"
    Where [full_path] is a full path to the directory with the module.
    If the entire site is under a single controller, you can connect the module through "include "[full_path]/protected/sli.php"";
    Attention! Directive auto_prepend_file is included connects the translator with all php files. To exclude translation, for instance the administrative section of the site, indicate in .htaccess file in the directory with the module, which should not be translated, the line php_value auto_prepend_file is included none, or write down in the system settings those addresses which are to be ignored.
  3. If Your site is not working through the 1 controller. Write in your .htaccess file rewrite, to the page with the language version of the led on the original.
    For example:
    RewriteEngine on
    RewriteRule ^(?:(?:ua|en)/)?(.*)$ $1 [L]
    Where ua|en - language versions, added in SLI.
  4. Set rights 0777 for the folder "protected/data" and all the internal directory.
  5. Open the file "protected/config/config.php" and register data for connection with MySQL.
  6. Go to the admin panel by htt://siteName/sli/index.php
  7. Enter your Email and password.
  8. Log in under specified data.
Getting started
  1. Go to admin panel, move to the page bearing language addition option.
  2. Push the button add. Fill in the field. Alias - is an abbreviation of the language (usually ua, en, ru, cn etc.), which will be displayed in the address field for language selection.
  3. Push the button save.
  4. Go to the tab parameters. Select the language of the original. It is the actual language in which the website was created and that will be used for automatic translation.
  5. Caching uses Memcache, that should be installed on your server. If the extension is missing, ignore this opportunity to accelerate the work of a translator, or install the extension.
  6. Show the time of processing the program. This setting will display the time for the system to parse and translate the page, you are on now. 
  7. Scan now.
  8. Translate the data.
Parser configuration

Field description:

  • Ignore the address - addresses that will not undergo translation. Each address is added in a new line. To use a regular expression the line should begin with #
    - Ignore all the addresses that begin with the /admin.php (use a regular expression) -
    - Ignore the address search.php only
  • Allowed addresses - the address, which will receive the content with translation. If you have added at least one address, all the others will have the status of ignored!
    Each address in a new line.
    Used only in case of the page by page translation of the site. If You are unable to translate the whole site and have transferred only part of it by now, add the addresses of the translated pages to the list.
    When the translation is finished clear the list.
  • Ignore text pages - if the page contains one of the listed phrases, it will be ignored. Content will not undergo translation and will not be replaced. Typically used for error pages.

    Pages with the phrase PHP error or syntax error will be ignored
  • Ignore tags - names of the tags, the content of which should not undergo translation. After a comma.

    Data from the tags will not fall on the translation.
  • Translate the values of the attributes - the names of the attributes, the values of which should be translated. After a comma.
    For instance:

    The content of the speсified tags falls into the admin area of translation.
Site scanner

The scanner is a module by which You can scan your site for data needing translation.

Scanning by URL. In order to scan the entire site, set "/" in the "address" field . Thus we begin to scan the entire site starting from the main page. The scanner will check all the pages and save (according to parser settings) data that needs translation.

Scanning "Sitemap". In the address field, specify the path to the file sitemap.xml, and the parser will check all the file links.

Scanning the entire site is only needed when you first connect the system. All data is added to the database automatically when you first visit the page.


Variables - module of the site, which allows to create hard replace of the content for each language.
For instance, there is a picture with Russian text, and we want a diplicate with an English text. In this section, we create the variable.
In the field "original" write the address of the picture "/EN-pic.png". In the field "English" write the address of the picture for the English version of the site "/en-pic.png". Now when you change the language to English all the occurrences "/EN-pic.png" will be replaced with the "/en-pic.png".
Thus, we can change the JavaScript, change the text, which misses the translation in the usual way, and supersede statics.

How to add some content to the blacklist?

If your site contains blocks, which are frequently updated (e.g. comments), and you do not want the data to appear in the list of translation, add at the beginning of the content (which should not be translated) <!--SLI::ignore-->
and in the end <!--SLI::endIgnore-->
For instance:
Content that will not be translated
<?php SLIApi::ignoreStart();?>
<?php SLIApi::ignoreEnd();?>

How to equip your site with a block for language options?

Displaying languages on the website

To get an array of the languages employed, use the function

Usage example:
<ul class="language">
    <?php foreach(SLIApi::getLanguagesChangeList() as $val) {?>
    <li<?php echo $val['selected'] ? ' class="selected"': ";?>><a % href="<?php echo $val['href'];?>"><img src="/sli/static/img/flags/<?php echo $val['alias'];?>PNG" alt="<?php echo $val['title'];?>" title="<?php echo $val['title'];?>"></a></li>
    <?php }?>

Note the percent sign "<a%". It is to show the parser that this link does not need to be localized.
To add language selection You can use the forecited example.

Setting the MODx CMS
  • Do everything except for paragraph 3, the steps in installation.
  • Open the .htaccess file in the root directory of a website
  • Replace string
    RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
    RewriteRule ^(?:ua/)?(.*)$ index.php?q=$1 [L,QSA]
    Where ua - language added in the settings SLI
  • What would the MODx admin panel has not got on a translation of the add - in manager/.htaccess line
    php_value auto_prepend_file is included none
Не добавляются переводы в админку

Это может просиходить по нескольким причинам:

  1. Возможно вы не подключили переводчик к CMS либо на хостинге не работают .htaccess. Проверить это можно включив в настройках SLI опцию "Показывать время отработки программы". Если после включения в самом низу сайта не будет выводится время выполнения SLI - значит скрипт не подключен.
  2. Кодировка сайта отличная от UTF-8. Для решения данной проблемы откройте файл sli/protected/core/SLITranslate.php , найдите строку
    public static function autoInit($content)
    и после открывающей фигурной скобки вставьте
    $content = iconv("windows-1251", "UTF-8", $content);
    где windows-1251 ваша текущая кодировка сайта. И перед строкой
    return $content;
    $content = iconv("UTF-8", "windows-1251", $content);
    то есть декодируем строку обратно.