multilingual site: how to switch between languages with link

Author Message

Alessandro Cipriani

Wednesday 11 February 2004 1:27:20 am

hi all
i'm setting my own multilingual site
i've read the tutorial "how to setup a multilingual site"
(http://ez.no/ez_publish/documentation/configuration/configuration/language_and_charset/how_to_setup_a_multilingual_site) and now i got the following result:
when i write http://mysite.com/it I enter the italian version - writing http://mysite.com/eng I enter the english version...

now i need to be able to switch from one language to other simply by clicking on a link, and getting the same page in the other language. I found an example at http://www.fast.no/ , where the user can change "dinamically" the language he prefers.

any advice?
best regards

alessandro

Lazaro Ferreira

Thursday 12 February 2004 4:52:38 pm

Hi,

We use the translation files ( .ts ) to do the trick :

{let myvar='our_siteaccess_name_translation'|i18n('our_site_name/menu') }
<a href={$myvar|ezroot} >'our_language_title_translation'|i18n('our_site_name/menu')</a>
{/let}

$myvar will be 'eng', and 'it' respectively,
the language title translations will be "English", Italian

so, we added two new translations to our .ts files one for the siteacces name, the second one for the language name itself

the first one is piped into ezroot operator to create the URL of the siteaccess to switch to

the trick is putting the 'wrong' translation in each .ts file

i.e : In the .ts file for english you should add the italian lines, one for the siteacces name (it) the other one for the language name itself (i.e: Italiano), and viceversa

Hope this help

Lazaro
http://www.mzbusiness.com

shajeer K P

Tuesday 06 April 2004 2:19:02 am

Hi,
Where to place the following codes,
{let myvar='our_siteaccess_name_translation'|i18n('our_site_name/menu') }
<a href={$myvar|ezroot} >'our_language_title_translation'|i18n('our_site_name/menu')</a>
{/let}

Also give an example for the above code.

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 18 2025 22:39:16
Script start
Timing: Jan 18 2025 22:39:16
Module start 'layout'
Timing: Jan 18 2025 22:39:16
Module start 'content'
Timing: Jan 18 2025 22:39:17
Module end 'content'
Timing: Jan 18 2025 22:39:17
Script end

Main resources:

Total runtime0.8084 sec
Peak memory usage4,096.0000 KB
Database Queries59

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0071 589.6016152.6563
Module start 'layout' 0.00710.0038 742.257839.5078
Module start 'content' 0.01100.7956 781.7656568.9219
Module end 'content' 0.80660.0017 1,350.687512.4063
Script end 0.8083  1,363.0938 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00380.4748160.0002
Check MTime0.00140.1688160.0001
Mysql Total
Database connection0.00100.119010.0010
Mysqli_queries0.753593.2146590.0128
Looping result0.00060.0775570.0000
Template Total0.772195.520.3860
Template load0.00200.248520.0010
Template processing0.770095.257320.3850
Template load and register function0.00010.013710.0001
states
state_id_array0.00160.199810.0016
state_identifier_array0.00100.125320.0005
Override
Cache load0.00170.2093330.0001
Sytem overhead
Fetch class attribute can translate value0.00050.057930.0002
Fetch class attribute name0.00160.192540.0004
XML
Image XML parsing0.00080.099130.0003
class_abstraction
Instantiating content class attribute0.00000.000940.0000
General
dbfile0.00090.1127160.0001
String conversion0.00000.001240.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
1content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
3content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
5content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
6content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 17
 Number of unique templates used: 6

Time used to render debug report: 0.0002 secs