Hallo Leute,
hock gerade über meiner ersten mehrspachigen Seite. Default ist deutsch, weitere website-language ist englisch mit der id 7.
TypoScript:
#
#########################
# Globale Konfiguration
#########################
config {
spamProtectEmailAddresses = 2
spamProtectEmailAddresses_atSubst = (at)
extTarget = _blank
linkVars = L
sys_language_uid = 0
language = de
locale_all = de_DE
# pageTitleFirst=1
xhtml_cleaning=all
doctypeSwitch = {$doctypesw_cond}
htmlTag_langKey = de
}
# English language, sys_language.uid = 7
[globalVar = GP:L = 7]
config.sys_language_uid = 7
config.language = en
config.locale_all = english
config.htmlTag_langKey = en
[global]
im Backend haut soweit auch alles hin. Kann mir die einzelnen Seiten mit den Englischen Inhalten anlegen.
nun hab ich das Sprachmenü folgendermaßen eingebaut:
page.10.marks.FLAGGEN = PHP_SCRIPT
FLAGGEN.file = fileadmin/scripts/languageMenu.php
PHP-Skript:
<?php
/***************************************************************
* Copyright notice
*
* (c) 1999-2005 Kasper Skaarhoj (kasperYYYY@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, a german, an english and a french flag for each language supported on the site.
*
* THIS IS AN EXAMPLE designed to work with the official TYPO3 testsite, section "Another site in the ..."
* You will have to program a similar menu for your own case.
*
* $Id: example_languageMenu.php,v 1.6 2005/04/01 14:37:14 typo3 Exp $
* Revised for TYPO3 3.6 June/2003 by Kasper Skaarhoj
* XHTML compliant
*
* @author Kasper Skaarhoj <kasperYYYY@typo3.com>
*
* modified for the template YAML for Typo3: Dieter Bunkerd db@t3net.de
*/
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 = '<img class="arrow" src="fileadmin/img/arrow.gif" width="10" height="13" 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 and not linked.
$flags = array();
$flags[] = ($GLOBALS['TSFE']->sys_language_uid==0?$pointer:'').($GLOBALS['TSFE']->sys_language_uid!=0?'<a href="'.htmlspecialchars('?&L=0').'" target="_top"><img class="flag" src="fileadmin/img/flag_de.gif" width="30" height="16" alt="Deutsch" title="Deutsch" /></a>':'<img class="flag" src="fileadmin/img/flag_ac_de.gif" width="21" height="13" alt="Deutsch" title="Deutsch" />');
$flags[] = ($GLOBALS['TSFE']->sys_language_uid==7?$pointer:'').($GLOBALS['TSFE']->sys_language_uid!=7?($langArr[1]?'<a href="'.htmlspecialchars('?&L=7').'" target="_top"><img class="flag" src="fileadmin/img/flag_uk.gif" width="30" height="13" alt="English" title="English" /></a>':'<img class="flag" src="fileadmin/img/flag_ac_uk.gif" width="21" height="13" alt="English" title="English - not available yet" />'):'<img class="flag" src="fileadmin/img/flag_uk.gif" width="21" height="13" alt="English" title="English" />');
//$flags[] = ($GLOBALS['TSFE']->sys_language_uid==7?$pointer:'').($GLOBALS['TSFE']->sys_language_uid!=7?($langArr[1]?'<a href="'.htmlspecialchars('?&L=7').'" target="_top"><img class="flag" src="fileadmin/img/flag_uk.gif" width="30" height="13" alt="English" title="English" /></a>':'<img class="flag" src="fileadmin/img/flag_uk_d.gif" width="21" height="13" alt="English" title="English - not available yet" />'):'<img class="flag" src="fileadmin/img/flag_uk.gif" width="21" height="13" alt="English" title="English" />');
//$flags[] = ($GLOBALS['TSFE']->sys_language_uid==2?$pointer:'').($GLOBALS['TSFE']->sys_language_uid!=2?($langArr[2]?'<a href="'.htmlspecialchars('?&L=2').'" target="_top"><img class="flag" src="fileadmin/img/flag_fr.gif" width="21" height="13" alt="Francais" title="Francais" /></a>':'<img class="flag" src="fileadmin/img/flag_fr_d.gif" width="21" height="13" alt="Francais" title="Francais - ne pas encore disponible" />'):'<img class="flag" src="fileadmin/img/flag_fr_d.gif" width="21" height="13" alt="Francais" title="Francais - ne pas encore disponible" />');
// 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 = '<div class="langMenu">'.implode($flags). '</div>';
?>
Das Sprachmenü wird zwar angezeigt, aber ich kann nicht ins Englische umschalten -> English - not available yet
Bin dankbar für jeden Tipp.