eZ Community » Forums » Setup & design » Problem deciding which language is in...
expandshrink

Problem deciding which language is in use

Problem deciding which language is in use

Monday 15 May 2006 1:35:52 pm - 3 replies

Hi all!

I'm setting up a multiligual site with 3.8, and it goes quite well. Really nice improvements have been done to the ligual part of the system.

I have one problem though. In my pagelayout I want write a heading according to which language is in use.

In the old days I used to do it like this:

{section show=eq(ezini('RegionalSettings','Locale'),'eng-GB')}ยจ
..

This doesn't work anymore, so I tried this:

{if begins_with($module_result.uri,'/eng')}
<h3>Latest Calls:</h3>
{else}						
<h3>Siste utlysninger:</h3>
{/if}

This should work, as I use siteaccess as "language-decider". But for some reason <i>begins_with</i> will not work. If I use I use <i>eq</i>, it works.. but I obvioulsy need the former..

Any answer could be the right one!

Felix

Monday 15 May 2006 3:07:18 pm

I think you can watch the content of $node.object.current_language, it
should contain the language code in the format eng-GB (or fre-FR, ...)

so you can do something like :

 {if eq($node.object.current_language,'eng-GB')} ...

You can also put {$node.object|attribute('show',2)} to see what variables
concerning languages you can use.

Have also a look at this thread : http://ez.no/community/forum/setu...ailable_languages_for_objects_in_3_8
it can help you to understand some things, and if you find an answer ...

I hope this helps you

Modified on Monday 15 May 2006 3:07:46 pm by Fabio Carissimi

Monday 15 May 2006 6:08:11 pm

ezini('RegionalSettings','Locale') gives you the locale as defined in the siteaccess, which still works in 3.8. New in 3.8 is $node.object.current_language, which gives you the language of the actual object. This is not necessarily the same as the language of the site access. In site.ini.append you can specify in SiteLanguageList[] which translations are to be presented, and in which priority. If the object is not available in the language of the site access, it can be displayed in another language. The value of ShowUntranslatedObjects also influences which translation is actually shown.

Tuesday 16 May 2006 9:50:15 am

Hi there!

Thank you people for answering!

I went for this model:

{if eq($current_node.object.current_language,'eng-GB')}
 English content..
{else}
 Other content..
{/if}

Only "problem" is that, since this is done in the pagelayout, I need to fetch the node.

Felix

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from