[Typo3] Language selection not displayed on multi language site
Antje Lewis
alewis at utanet.at
Sun Nov 6 22:28:26 CET 2005
hi,
i don't know about the language selection being supposed to appear
automatically anywhere.
this is how i do it (3 steps):
1
i add this line to my html template:
<div id="langnav">###LANG###</div>
2
then i refer to this in my template setup TS:
page.10 {
marks.LANG = PHP_SCRIPT
marks.LANG.file = media/scripts/ahl/lang_change.php
....
}
3
and the content of that php script based on the model by kasper is:
<?php
/***************************************************************
* Copyright notice
*
* (c) 1999-2004 Kasper Skaarhoj (kasper at typo3.com)
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
* A copy is found in the textfile GPL.txt and important notices to the
license
* from the author is found in LICENSE.txt distributed with these scripts.
*
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
/**
* Creates a language-selector menu with three flags, an english, a danish
and a german flag for each language supported on the site.
*
* THIS IS from AN EXAMPLE designed to work with the official TYPO3
testsite, section "Another site in the ..."
*
* $Id: example_languageMenu.php,v 1.4 2004/03/22 15:46:24 typo3 Exp $
* Revised for TYPO3 3.6 June/2003 by Kasper Skaarhoj
* XHTML compliant
*
* @author Kasper Skaarhoj <kasper at typo3.com>
*/
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('pages_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_on = '<img src="fileadmin/img/pointer_on.gif" width="7"
height="10" align="absmiddle" alt="" />';
#$pointer_off= '<img src="fileadmin/img/pointer_off.gif" width="7"
height="10" align="absmiddle" 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 record on this page), the icon is dimmed.
$flags = array();
/*
$flags[] = ('<span
class="'.($GLOBALS['TSFE']->sys_language_uid==1?"lang_chg":"lang_act").'"><a
href="'.htmlspecialchars('index.php?id='.$GLOBALS['TSFE']->id.'&lang=0').'"
target="_top">English</a></span>';
$flags[] = ('<span
class="'.($GLOBALS['TSFE']->sys_language_uid==1?"lang_act":"lang_chg").'"><a
href="'.htmlspecialchars('index.php?id='.$GLOBALS['TSFE']->id.'&lang=1').'"
target="_top">Russian</a></span>';
*/
$flags[] = '<span
class="'.($GLOBALS['TSFE']->sys_language_uid==1?"lang_chg":"ak").'"><a
href="index.php?id='.$GLOBALS['TSFE']->id.'&lang=0'.'">English</a></span>';
$flags[] = '<span
class="'.($GLOBALS['TSFE']->sys_language_uid==1?"ak":"lang_chg").'"><a
href="index.php?id='.$GLOBALS['TSFE']->id.'&lang=1'.'">Russian</a></span>';
#<a href="#">English</a> | <span class="ak">Russian</span>
// 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 used in the extension template used to control the language setup)
#$content = "<p>".implode(' ',$flags)."</p>";
$content = implode(' | ',$flags);
?>
At 12:17 06.11.2005, you wrote:
>I am trying to add multi language capabilities to my website. I have
>succeeded so far by adding an alternative page language and I was offered
>a language selection in the backend to translate all my content elements.
>I have translated the content of my start page and on page on subsequent
>level. However, there is no language selector menu in the bottom of the
>page displayed. According to the documention, I understand it should
>automatically appear. Can anyone shed some light on this? Do I have to
>change anything in the template or the TS setup?
>
>Thanks,
>Andreas
>_______________________________________________
>Typo3-english mailing list
>Typo3-english at lists.netfielders.de
>http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-english
More information about the TYPO3-english
mailing list