Skip to content

Adding_multilanguage_articles

Patric Eberle edited this page Dec 25, 2014 · 8 revisions

There is nothing special about adding articles to a page. You do this the same way as you would do it in a regular Contao site. An article is simply a container for content elements which can be localized/translated. The article can be added to any page.

In an article you can have one or more content elements which can be localized (displayed in a specific language version of a page). The content elements can hold references to modules. This is the functionality which i18nl10n exploits to display localized versions of modules. For some modules you do not need to create a language specific instance (e.g. Login Form), because it uses localized messages directly from the system. For other modules you need to do so, because they display some of their fields (e.g. Title) or display data which is not localized.

Adding multi-language news list to your home page.

You usually create a separate layout per language for your home page. Then create separate news archives for each language. Then you put the corresponding module (news-list) in the right column. With i18nl10n you only need to create separate news archives and modules for each language.

First go to your home page using the Articles menu item in the back-end and create an article in the right column. This article will display a list of news items in the current language of the page.

Article for news lists

In this article you will create one content element for each language and set its "Include settings" to "Module". Multi-language news lists

Each of these modules shows news items from an archive. Note that you will need to create one news archive per language. Here is how the module form should look while editing it.

Multi-language news module

Now you simply can set a column in your home layout to display articles from that column:

Multi-language layout

Show some creativeness and experiment with other modules like Registration Form!

Inserting multi-language articles using custom HTML.

Sometimes you need to put the content of an article in several pages. This is usually done using insert tags (http://www.contao.org/en/insert-tags.html) To add an article containing multi-language content use the {{insert_i18nl10n_article::}} instead of the {{insert_article::}}.


#!HTML

Inserted article from other page

{{insert_i18nl10n_article::id_or_alias}}

Have fun!


Support this project by making a donation or sending a gift.