Problem deciding which language is in use

Author Message

Felix Laate

Monday 15 May 2006 4:35:52 am

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

Publlic Relations Manager
Greater Stavanger
www.greaterstavanger.com

Fabio Carissimi

Monday 15 May 2006 6:07:18 am

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/setup_design/available_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

Marc Boon

Monday 15 May 2006 9:08:11 am

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.

Felix Laate

Tuesday 16 May 2006 12: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

Publlic Relations Manager
Greater Stavanger
www.greaterstavanger.com

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 31 2025 01:15:28
Script start
Timing: Jan 31 2025 01:15:28
Module start 'layout'
Timing: Jan 31 2025 01:15:28
Module start 'content'
Timing: Jan 31 2025 01:15:28
Module end 'content'
Timing: Jan 31 2025 01:15:28
Script end

Main resources:

Total runtime0.0417 sec
Peak memory usage6,144.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0055 588.2656151.2266
Module start 'layout' 0.00550.0039 739.4922220.7188
Module start 'content' 0.00940.0307 960.21091,001.9609
Module end 'content' 0.04010.0016 1,962.171933.9922
Script end 0.0417  1,996.1641 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00266.2496140.0002
Check MTime0.00102.4008140.0001
Mysql Total
Database connection0.00061.407010.0006
Mysqli_queries0.00286.699430.0009
Looping result0.00000.036010.0000
Template Total0.00112.610.0011
Template load0.00081.965310.0008
Template processing0.00030.606310.0003
Override
Cache load0.00051.253210.0005
General
dbfile0.010825.955880.0014
String conversion0.00000.026340.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs