Friday 21 April 2006 6:03:03 am
I am working on this new multilingual content model and I am facing problems similar to yours. I have written a kind of "language box" which provides a link to the different language versions of my content only if this translation is available. To do so I use the 'available_languages' information in the $node variable
{def $languages=$node.object.available_languages}
{if gt($languages|count(),0)}
{foreach $languages as $lang}
<a href={concat($node.url_alias,'/(language)/',$lang)|ezurl}> {$lang} </a> |
{/foreach}
{/if}
{undef $languages}
If I have English, French and German as available languages, this code displays links to
http://www.mysite.com/index.php/(language)/ger-DE, http://www.mysite.com/index.php/(language)/fre-FR and http://www.mysite.com/index.php/(language)/eng-GB. If only french version exists, there is only a link to french version.
But I agree with you, If I call http://www.mysite.com/index.php/(language)/ger-DE and this translation do not exists, it would be better to have the fallback to other language following the order in RegionalSettings.
But I have another problem, when i choose a language version of my content, I want the selected language to be kept.
If I choose French languages, I want to have other navigation part links that direct to French version (if available).
But in the standard installation (EzP 3.8beta2), links are in english and I think that is why current_language is still
set to 'eng-GB' (see $node.object.current_language). Does somebody know how to change current language ? and keep it selected until change is mad by clicking on the other language link ?
that way, it would not be necessary to have a siteaccess per language. Thanks for help
|