The language of an object

Some editable objects in SPIP, such as sections and articles , have a language field stored in their corresponding SQL tables, which makes it possible to specify in which language they have been written (or to which language they belong).

We can find out the language of the current section or article by using the #LANG tag within a RUBRIQUES or ARTICLES loop.

When the current section does not have a specific language assigned, then that of its parent section is returned, and failing that, the main language of the site.

Example

Display the articles and the languages of the first 2 sections in the site:

Your language: #ENV{lang}
<B_rubs>
  <ul>
  <BOUCLE_rubs(RUBRIQUES){racine}{0,2}>
    <li>#TITRE : #LANG
      <B_arts>
        <ul>
        <BOUCLE_arts(ARTICLES){id_rubrique}>
          <li>#TITRE : #LANG</li>
        </BOUCLE_arts>
        </ul>
      </B_arts>
    </li>
  </BOUCLE_rubs>
  </ul>
</B_rubs>

Results:

Your language : fr
  <ul>
    <li>en : en
      <ul>
        <li>Notes about this documentation : en</li>
      </ul>
    </li>
    <li>fr : fr
      <ul>
        <li>Notes sur cette documentation : fr</li>
      </ul>
    </li>
  </ul>

Author Mark Baber Published : Updated : 12/03/23

Translations : English, français