Some special loop criteria make it possible to retrieve articles in a specifically desired language.
{{{lang}}}
First of all, the quite simple
{lang}
criterion enables us to select the visitor’s language or a specific language:
// language of the visitor
<BOUCLE_art(ARTICLES){lang}> ... </BOUCLE_art>
// English language (en)
<BOUCLE_art(ARTICLES){lang=en}> ... </BOUCLE_art>
{{{traduction}}}
The
{traduction}
criterion enables us to list the various translations of an article:
<BOUCLE_article(ARTICLES){id_article}>
<ul>
<BOUCLE_traductions(ARTICLES) {traduction}{par lang}>
<li>[(#LANG|traduire_nom_langue)]</li>
</BOUCLE_traductions>
</ul>
</BOUCLE_article>
In this case, all the translations of an article will be displayed (including the current article, which could be excluded by specifically adding the
{exclus}
criterion).
{{{origine_traduction}}}
This criterion enables us to retrieve the original source article for a particular translated article, that being the one that serves as the source reference to the other translations. To show all of the source articles, use:
<BOUCLE_sources(ARTICLES) {origine_traduction}>
#TITRE (#LANG)<br />
</BOUCLE_sources>
To show the original translation for an article (the one in the current context):
<BOUCLE_article(ARTICLES){id_article}>
<BOUCLE_origine(ARTICLES) {traduction}{origine_traduction}>
#TITRE (#LANG)
</BOUCLE_origine>
</BOUCLE_article>
Example
Display an article in the visitor’s language where possible, and if not, then in the main language.
We start by listing, for a section, all the articles which serve as sources for the creation of translations. We then continue by checking if a translation exists in the language requested by the visitor. Depending on the result, we display the title of the translated article or that of the source article.
<BOUCLE_art1(ARTICLES){id_rubrique}{origine_traduction}>
<BOUCLE_art2(ARTICLES){traduction}{lang=#ENV{lang}}>
// if a translation does exist
<li>#TITRE</li>
</BOUCLE_art2>
// otherwise use the original article's title
<li>#TITRE</li>
<//B_art2>
</BOUCLE_art1>