[Typo3-UG Italy] sito multi lingua

Massimiliano Magli m.magli at ibimet.cnr.it
Fri Jan 13 13:38:43 CET 2006


buye at libero.it wrote:
> Salve a tutti, sono di nuovo alle prese con un piccolo problema con typo3 e cioè la gestione di un sito multilingua. Sono riusicito a impostare il sito im modo da gestire 2 lingue, italiano e inglese, in un unico tree (per intenderci usando il parametro &L=x).
> Adesso vorrei mettere la classica bandierina sul sito per "switchare" da una lingua all'altra solo che non ci riesco.
> Qualcuno può aiutarmi?
> 
> Grazie
> 
> Carlo Busetto
> 
> _______________________________________________
> Typo3-ug-italy mailing list
> Typo3-ug-italy at lists.netfielders.de
> http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-ug-italy
> 
> 


Io ho risolto il problema con un php script del tipo (chiamato
gestionelingua.php
e che trovi nell'installazione di typo3 - non mi ricordo dove, pero'):

 if (!is_object($this)) die ('Error: No parent object present.');




 // First, select all pages_language_overlay records on the current
page. Each represents a possibility for a language.
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*',
'pages_language_overlay',
'pid='.intval($GLOBALS['TSFE']->id).$GLOBALS['TSFE']->sys_page->enableFields('pag
es_language_overlay'), 'sys_language_uid');

$langArr = array();
while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res))       {
        $langArr[$row['sys_language_uid']] = $row['title'];
}

// Little red arrow, which is inserted to the left of the flag-icon if
the TSFE->sys_language_uid equals the language uid (notice that
0=english, 1=danish and
 2=german is SPECIFIC to this database, because these numbers refer to
uid's of the table sys_language)
$pointer = '<img src="t3lib/gfx/content_client.gif" width="7"
height="10" align="middle" alt="" />';

// Set each icon. If the language is the current, red arrow is printed
to the left. If the language is NOT found (represented by a
pages_language_overlay reco
rd on this page), the icon is dimmed.
$flags = array();
$flags[] = ($GLOBALS['TSFE']->sys_language_uid==0?$pointer:'').'<a
href="'.htmlspecialchars('index.php?id='.$GLOBALS['TSFE']->id.'&L=0').'"
target="_top"><img
 src="media/flags/flag_uk.gif" width="21" height="13" hspace="5"
border="0" alt="English version" title="English version" /></a>';
#$flags[] = ($GLOBALS['TSFE']->sys_language_uid==1?$pointer:'').'<a
href="'.htmlspecialchars('index.php?id='.$GLOBALS['TSFE']->id.'&L=1').'"
target="_top"><im
g src="media/uploads/flag_dk'.($langArr[1]?'':'_d').'.gif" width="21"
height="13" hspace="5" border="0" alt="" /></a>';
$flags[] = ($GLOBALS['TSFE']->sys_language_uid==3?$pointer:'').'<a
href="'.htmlspecialchars('index.php?id='.$GLOBALS['TSFE']->id.'&L=3').'"
target="_top"><img
 src="media/flags/flag_es'.($langArr[3]?'':'_d').'.gif" width="21"
height="13" hspace="5" border="0" alt="Spanish version" title="Spanish
version"/></a>';
$flags[] = ($GLOBALS['TSFE']->sys_language_uid==4?$pointer:'').'<a
href="'.htmlspecialchars('index.php?id='.$GLOBALS['TSFE']->id.'&L=4').'"
target="_top"><img
 src="media/flags/flag_ir'.($langArr[4]?'':'_d').'.gif" width="21"
height="13" hspace="5" border="0" alt="Farsi version" title="Farsi
version"/></a>';
// Make the little menu. Notice, the menu does ONLY transfer the page-id
and the "L" variable (which is also SPECIFIC for this website because
"L" has been us
ed in the extension template used to control the language setup)
$content = '<table border="0" cellpadding="0"
cellspacing="0"><tr><td><img src="clear.gif" width="30" height="1"
alt="" /></td><td>'.implode('',$flags).'</td>
</tr></table>';



ed inserendo nel typoscript delle pagine:




subparts.LANGUAGE = PHP_SCRIPT
subparts.LANGUAGE.file = path/gestionelingua.php

config.linkVars = L
#definitions for default language
config.sys_language_uid = 0
config.language = en
config.locale_all = en_EN

# Italian language, sys_language.uid = 1
[globalVar = GP:L = 0]
config.sys_language_uid = 0
config.language = en
config.locale_all = english


# English language, sys_language.uid = 3
[globalVar = GP:L = 3]
config.sys_language_uid = 3
config.language = en
config.locale_all = english


# Farsi language, sys_language.uid = 4
[globalVar = GP:L = 4]
config.sys_language_uid = 4
config.language = en
config.locale_all = english


[global]


Trovi comunque documentazione analoga
sul sito typo3.org


M.Magli




-- 
Massimiliano Magli

IBIMET - Istituto di Biometeorologia - Sezione di Bologna
CNR - AdR di Bologna
Via P.Gobetti, 101 - I-40129 Bologna (Italy)
Tel. +39 051 6399011
Fax  +39 051 6399024
mailto:m.magli at ibimet.cnr.it
http://www.bo.ibimet.cnr.it
-------------- next part --------------
A non-text attachment was scrubbed...
Name: m.magli.vcf
Type: text/x-vcard
Size: 313 bytes
Desc: not available
Url : http://lists.netfielders.de/pipermail/typo3-ug-italy/attachments/20060113/73aad01d/attachment.vcf 


More information about the TYPO3-UG-italy mailing list