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:

  1. Your language: #ENV{lang}
  2. <B_rubs>
  3. <ul>
  4. <BOUCLE_rubs(RUBRIQUES){racine}{0,2}>
  5. <li>#TITRE : #LANG
  6. <B_arts>
  7. <ul>
  8. <BOUCLE_arts(ARTICLES){id_rubrique}>
  9. <li>#TITRE : #LANG</li>
  10. </BOUCLE_arts>
  11. </ul>
  12. </B_arts>
  13. </li>
  14. </BOUCLE_rubs>
  15. </ul>
  16. </B_rubs>

Download

Results:

  1. Your language : fr
  2. <ul>
  3. <li>en : en
  4. <ul>
  5. <li>Notes about this documentation : en</li>
  6. </ul>
  7. </li>
  8. <li>fr : fr
  9. <ul>
  10. <li>Notes sur cette documentation : fr</li>
  11. </ul>
  12. </li>
  13. </ul>

Download

Author Mark Baber Published : Updated : 27/06/10

Translations : English, français