Forums / Setup & design / language links in multilanguage websites with cache ON

language links in multilanguage websites with cache ON

Author Message

Yves Lescribe

Monday 14 August 2006 3:11:52 am

Hello,

I'm building new multilanguage websites and I have some problems with language links.
I have read lot of pages on this forum since I use ezpublish (3.4) and there are no real official solution provided by ez team to access a node in another language...

The code I actually use is :

       {let languages=hash('dut-NL','sitenl', 'eng-GB','site', 'fre-FR','sitefr') all_translations=$node.object.current.translation_list}
       {let flag=hash('eng-GB', 'EN', 'fre-FR', 'FR','dut-NL', 'NL') all_translations=$node.object.current.translation_list}
       {section show=$all_translations|count|gt(0)}
          {section var=translation loop=$node.object.current.translation_list}
            <a href={concat('http://' , $languages[$translation.item.language_code],'.url/',$DesignKeys:used.url_alias)} title={$translation.item.language_code}>{$flag[$translation.item.language_code]}</a>{delimiter} - {/delimiter}
          {/section}
       {/section}
       {/let}{/let}

This works perfectly when view-cache is turned off... but that's not perfect because when cache is turned off, the time to load a page is >1sec .... a little bit too long, for info, when cache is turned on, this time becomes < 0.6 sec... Really better but language links deseapper from the second visit of a page...

After searching and reading a lot of this forum, I think the problem is that $node is not accessible torrough pagelayout when cache is turned on...

I have thus tried to use {include uri="design:language.tpl"} in my pagelayout but this doesn't change anything...

Another possible solution was found at http://ez.no/community/forum/general/dissapearing_menu but I can't made an override for every node...

Does anybody knows how to made a fully working language selection available on everypage when cache is turned on, but only for nodes that are translated ? I only want to see the language link when a node is translated... Otherwise the solution is easy : static links.

I'm sorry if an answer exists in the forum, I can't find it....

Thanks,
Yves

Kristof Coomans

Monday 14 August 2006 6:58:47 am

Hello Yves

Take a look at this topic: http://ez.no/community/forum/setup_design/page_refresh_causes_custom_meta_tags_etc_to_disappear
It answers your question about the issues with the $node variable in the pagelayout when view caching is turned on.

independent eZ Publish developer and service provider | http://blog.coomanskristof.be | http://ezpedia.org

Yves Deschrijvere

Monday 14 August 2006 7:35:01 am

Hi Kristof,

Thank you very much, this works perfectly ! Great ! :-)

Yves

No limits, except those of your mind ...

Robin Muilwijk

Friday 15 December 2006 1:43:34 am

Hi,

I'm new to eZpublish and trying to make a multilanguage site. Where would I put that code? I'm trying to make language links to access another language, just as on ez.no, on the top right.

Thanks, Robin

Board member, eZ Publish Community Project Board - Member of the share.ez.no team - Key values: Openness and Innovation.

LinkedIn: http://nl.linkedin.com/in/robinmuilwijk // Twitter: http://twitter.com/i_robin // Skype: robin.muilwijk

André R.

Friday 15 December 2006 8:29:34 am

This thread is not really about multilingual sites, but you can follow links and discussion on these other threads:

http://ez.no/community/forum/setup_design/multilingual_setup
http://ez.no/community/forum/install_configuration/multi_lingual_content/re_multi_lingual_content__4

Some code to play with (given that you have english and france versions of your site):


<li{if "en"|eq($access_type.name)} class="current_siteaccess"{/if}>
 {if is_set($DesignKeys:used.url_alias)}
  <a href={concat( "http://example.com/en/", $DesignKeys:used.url_alias)} title="See this page in english">english</a>
{else}
  <a href={concat( "http://example.com/en/", $uri_string)} title="See this page in english">english</a>
{/if}
 </li>

<li{if "fr"|eq($access_type.name)} class="current_siteaccess"{/if}>
 {if is_set($DesignKeys:used.url_alias)}
  <a href={concat( "http://example.com/fr/", $DesignKeys:used.url_alias)} title="See this page in french">french</a>
{else}
  <a href={concat( "http://example.com/fr/", $uri_string)} title="See this page in french">french</a>
{/if}
 </li>

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom