Friday 10 April 2009 3:26:04 am
After testing Yannick's Code, I finally kept my initial code as it was not really what I wanted to do. Yannick's code scans the whole language possibilities of EZP and displays flags for all languages (Catalan, Spanish, Chinese, Japanese, English, Canadian...). It was not really what I wanted to do. My aim was to display just One flag (on the two translation languages which are avalaible on my site, see my first post upper in this page). Changing Yannick's code to something a bit lighter, could do the job except for language_name to be displayed as tip which, for the moment, I did'nt find an easy way to get it passing the equivalent locale_code. So, if someone has some advice concerning this ... Here is the code which I tested and works correctly (except for what I said) :
<div id="languages">
{def $langue = ezini( 'RegionalSettings', 'Locale', 'site.ini' )}
{def $site_languages=ezini('RegionalSettings', 'SiteLanguageList')}
{foreach $site_languages as $lang}
{if ne($langue, $lang)}
<a href={concat('index.php/',$lang|extract_left(3)|downcase())|ezroot}>
<img src={$lang |flag_icon} alt="{$lang}" title="{$lang}"/>
</a>
{break}
{/if}
{/foreach}
</div>
|