|extraire_multi

This filter allows to extract from a block <multi> the part corresponding to a specific language.

The filter |extraire_multi{lang} applied to a text tag (#TEXTE, #TITRE, #INTRODUCTION, #BIO...) allows to select in each block <multi>...</multi> of the concerned text the part corresponding to the language passed as argument of the filter and this, independently of the language of the context in which the page is called.

Example

A field "TITRE" in the "spip_articles" table filled in as follows:

<multi>[en]New article[fr]Nouvel article[ar]مقال جديد</multi>

The simple call of #TITRE in a template will produce depending on whether the page is requested in French (&lang=fr dans l’URL) : «Nouvel article», in Arabic (&lang=ar) : «مقال جديد» or in English ( (&lang=en) : «New article».

If, for one reason or another, we want the Arabic version of the title to be displayed, regardless of the context language of the page, then we will write in the template: [(#TITRE*|extraire_multi{ar}|propre)]

Note that if a translation in the language requested by the filter ("ar" in the example above) does not exist in the block <multi>, the first translation of this block will be returned.
So if, still in the above example, we had asked for [(#TITRE*|extraire_multi{it}|propre)] , «New article» would have been displayed.

Author jack Published :

Translations : English, français, Nederlands