Adding a language selection

Occasional Collector
1 2 677

In projects using multiple languages it is often desired to display a list of available languages for a given page and link to them.

You can get a list of all defined languages for a project from the #global system object:


Please note that you should always check if a given language should actually be generated. This check can easily be done using the .shouldGenerate() method on the list entries you get from #global.project.languages.

See the example below on how to render a list of all available languages for the current page and link to them.

<ul id="languages">

     $CMS_FOR(language, #global.project.languages)$


               $CMS_IF(language == #global.language)$

                    <li class="selected"><a href="$CMS_REF(#global.ref, lang:language.abbreviation.upperCase)$">$CMS_VALUE($</a></li>


                    <li><a href="$CMS_REF(#global.ref, lang:language.abbreviation.upperCase)$">$CMS_VALUE($</a></li>





Further information on the data type Language can be found in the FirstSpirit API documentation. Details on the system object #global are available in the online documentation.

Version history
Last update:
‎06-28-2010 08:11 AM
Updated by: