Forums / Setup & design / multilingual site: how to switch between languages with link

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.

eZ debug

Timing: Jan 31 2025 04:27:54
Script start
Timing: Jan 31 2025 04:27:54
Module start 'content'
Timing: Jan 31 2025 04:27:54
Module end 'content'
Timing: Jan 31 2025 04:27:54
Script end

Main resources:

Total runtime0.1795 sec
Peak memory usage2,048.0000 KB
Database Queries141

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0089 588.1875180.7969
Module start 'content' 0.00890.0181 768.984493.9766
Module end 'content' 0.02700.1525 862.9609522.9219
Script end 0.1795  1,385.8828 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00361.9928200.0002
Check MTime0.00140.7897200.0001
Mysql Total
Database connection0.00231.282710.0023
Mysqli_queries0.112962.90391410.0008
Looping result0.00160.88461390.0000
Template Total0.151884.610.1518
Template load0.00100.552410.0010
Template processing0.150884.001910.1508
Override
Cache load0.00060.358710.0006
Sytem overhead
Fetch class attribute can translate value0.00100.567510.0010
XML
Image XML parsing0.00020.135410.0002
General
dbfile0.01679.2986200.0008
String conversion0.00000.004030.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/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