Creating language selection
If you have translated your site into multiple languages you surely want to have links to these languages. Luckily, this is fairly simple through the language objects collection in globally available site object. Creating a language selection is just a matter of looping through this collection:
{% if editmode or site.has_many_languages? %}
<ul class="langmenu">
{% for language in site.languages %}
<li{% if language.selected? %} class="active"{% endif %}>
<a href="{{ language.url }}"{% if language.selected? %} class="active"{% endif %}>{{ language.title }}</a>
</li>
{% endfor %}
{% if editmode %}
<li>{%languageadd%}</li>
{% endif %}
</ul>
{% endif %}
Notice that if currently viewed page has a translation in another language on your site then language.url will link directly to this page. Otherwise it will link to front page in this language.