Forums / Setup & design / How to select language?

"Please Note:
  • At the specific request of Ibexa we are changing this projects name to "Exponential" or "Exponential (CMS)" effective as of August, 11th 2025.
  • This project is not associated with the original eZ Publish software or its original developer, eZ Systems or Ibexa".

How to select language?

Author Message

Osichr Hayez

Monday 12 June 2006 2:36:07 am

Exponential 3.6.8:

I enabled 2 languages in my setupwizard during installation. All my articles are on the primary language, but only a few on the secondary language.

I've created a couple of flags with links at my plagelayout.tpl, but I cant make them work as I want. What code do I need to embed to let my users switch between the languages?

Stéphane Bullier

Tuesday 13 June 2006 12:44:24 am

Hello,

You can use for example :

{if eq( $site.http_equiv.Content-language, fr-FR)}	
		<a href="{concat('http://www.exemple.com/en/', $DesignKeys:used.url_alias)}">English version</a>
		{else}			
		<a href="{concat('http://www.exemple.com/fr/', $DesignKeys:used.url_alias)}">Version française</a>
		{/if}

Stéphane

J-A Eberhard

Tuesday 13 June 2006 2:06:15 am

You can also use a loop and a direct link to the same page in another language

<ul>
        {def $locales=fetch( 'content', 'translation_list' )}
  		{foreach $locales as $locale}
  			<li>
<a href={concat("../",$locale.country_code|downcase(),"/",$module_result.content_info.url_alias)|ezurl}  >{$locale.language_name}</a>
                       </li>
  			{/if}
		{/foreach}
	{undef}
</ul>

Open Source Solution Provider
Open-Net Ltd Switzerland
http://www.open-net.ch

Osichr Hayez

Tuesday 13 June 2006 2:31:26 am

Thanks for your replies! I have now got it working using the siteaccess method.