Display a link for each languages in the site. |
|
| see zena 1.0 | |
Display a language selector:
<div id='lang' do='lang_links'/>
Display a language selector wrapped in p tags:
<div id='lang' do='lang_links' join=' | ' wrap='p'/>
The current language is highlighted with <em> when no wrap tag is specified. Otherwise, “on” class is added to the wrap tag. Example:
<p class='on'>en</p> | <p>fr</p>
If you need to customize further, you can use a block on site.lang_list
(list of strings like “en”, “fr”, etc):
<ul do='site.lang_list'> <li do='each' class='#{this == visitor.lang ? "on" : "off"}' do='eval'>zen_path(@node, :lang => this)</li> </ul>
The code above uses two special constructs: “this”, which means “current context’s object” (a string like “en” in this case) and ”@node” to find the last context where the current object was a Node (in this case this is just before the <ul> tag).