Language and multilingual content

Last update by Elxis Team

Manage languages and multilingual content in Elxis CMS.

Elxis is a pure multilingual CMS. You can have a web site in multiple languages easy as multilingualism in Elxis CMS comes out of the box. The interface can be translated into unlimited number of languages. The document char-set is UTF-8 and so Elxis can render perfectly any language. Elxis also specially handles utf-8 encoded strings where PHP (< version 6) lacks support. Other language specific features are also available like language based date format and support for RTL languages. Your own content, articles, menus, modules, anything, can also be in multiple languages. Elxis uses a translations system to provide multilingual content.

Interface language

Elxis language system developed having in mind the following.

  • Unified language system for both frontend and backend sections.
  • Unified language system for any extension type (components, modules, etc) and even for the XML files.
  • Be lightweight and fast with the need of as less parsing effort as possible.
  • Be easily expandable to third party extensions.
  • Be able to load multiple instances of the language class in different languages on run-time!
  • Elxis language names should be as simple as possible and they should follow the BCP47 guideline (on most cases).
  • Enable system reset on run-time.
  • Easy access of the language strings for any extension.
  • Easy system debug
  • Able to get transliteration table between any languages.

Language names follows (with some exceptions) the BCP47 guideline which is almost equal to the 2 letter ISO code. So, the language name for English is en, for Spanish es, for Italian it, for Greek el, etc. The fulL list of the Elxis language names can be seen by reading the Elxis languages database.

includes/libraries/elxis/language/langdb.php

The language files are located into the "languages" folder with each language in its own sub-folder. Third party extensions may have custom language files in their own folders. Bellow you can see the path to the folder containing the language files of a sample module.

modules/mod_sample/language/

 

Installing a new language

 

It is very easy to install a new language in Elxis CMS. Just upload the folder containing the language files into the languages directory. That's it, Elxis will detect your new language automatically. An example for the Russian (ru) language can be seen bellow.

language/ru/
language/ru/ru.php
language/ru/ru.com_content.php
language/ru/ru.com_cpanel.php
...

 

Translate Elxis to your language

 

For better understanding of the process we will use the Dutch (nl) language as an example. So you want to translate Elxis into Dutch? You will need a text editor that supports UTF-8. A good and free one is PsPad. Off course you can use any text editor you like. Take a copy of the English (en) language folder and rename it to nl. Rename all containing files from en.php to nl.php, en.com_content to nl.com_content, etc. Now, open the main language file (nl.php) and set the proper utf-8 locale for Dutch, it is nl_NL.utf8. You can ask in elxis forums for support if you don't know which locale to set. Now start translating the files be replacing the English strings with the Dutch ones. We advice you to keep the line numbers as in the original text. So if an English string is 3 lines height make the Dutch translation of it also 3 lines. This way it is easier to compare translations and detect missing strings or errors. When finish make sure to save the file as UTF-8 without BOM characters. Translate the same way all the language files. When ready upload them into the Elxis languages folder and you are done. If you like send Elxis Team your translation to include it into the official Elxis CMS release. This way you will help other users and contribute to the project.

 

Check translations

 

Elxis administration has some tools you can use to check or compare language files and translations. Navigate to Site -> Languages, pick up to 6 languages and click compare files. On the next screen you will see a comparison list for the files of the languages you chosen to compare. By clicking on a green tick icon you can see the language file contents.

You can also compare the translation of the same file into 2 different languages. On the Check translation form pick 2 languages and then the language file you want to compare. When ready click Check. The translation table will help you locate translation errors or missing language strings.

Tip:The English language is considered as the translation base, so always prefer to check a language against English.

compare language files
check translation

Content language

Enabling multilingual content

Articles, menu items, categories and almost anything saved in the database can have copies in different languages. When a visitor switch language he will see the translations of the original content. If a translation is not available for an item in the current language then the item will be displayed in the default language. Elxis has a global switch for multilingualism which can be found in configuration page. If you not intend to add multilingual content DO NOT enable multilinguism as additional database queries will be executed and the system will slow down a little without any need. Elxis will still have a multilingual interface even with the multilinguism option disabled. So, enable multilinguism only on sites with more than one languages and where you are going to add multilingual content.

The importance of the default language

When you add an article (or anything else that can have translation) in Elxis CMS the content of the article is written in site's default language. After first save you can add translations to this article to more languages. If, for example, the default language is English, you have written some articles, have some articles translated into Italian and then, for some reason, you decide to change the site's default language to Italian you will get a language inconsistency as for the new default language (Italian) the visitors will see the old articles in English! So it is very important to pick wisely the site's default language during or exactly after Elxis installation and never change it from the moment you add your first article.

Adding multilingual content

After saving an item (article, category, etc) the option to add translations is enabled. Select an other language in the multilingual field to add a translation to that language. When ready click on the save button to save your translation. You can add translations to more languages if you wish. Elxis also supports automatic translation via Bing online translation services. To use Bing is it required to provide a Bing API Id in component Translator parameters (create an API id on Bing's developers page).
translate item in Elxis CMS

Translations global overview

Elxis provides you an interface to overview and manage globally the existing translations. Navigate to Site - > Translator. You will see a list of the existing translations. If you click on the magnifier icon at the bottom of the grid you can see options to limit shown results to a specific category, element, or language, or even perform a search. If you select a grid's item and click Edit you will be able to edit the translation. You can also click New to add a translation of the selected item to an other language. Finally, Delete will delete the selected translations.

manage translations

It has been read 10601 times
Menus
Previous article
Menus