---
title: "Sprachen Switcher"
url: "https://www.typo3.net/d/24760-sprachen-switcher"
source: "typo3.net"
tags: ["Archiv","TemplaVoilà","Frage"]
created: "2005-05-12"
last_reply: "2005-05-30"
replies: 1
solved: false
page: 1
pages: 1
lang: "de"
---

# Sprachen Switcher

Archiv › TemplaVoilà · 1 Antwort · gestartet 2005-05-12

## Eröffnungsbeitrag

**denny** · 2005-05-12 · [Beitrag #1](https://www.typo3.net/d/24760-sprachen-switcher/1)

Hi,

ich kann nun per L=0/1 meine Sprache ansurfen und es scheint auch alles zu klappen. Was mir nun fehlt, ist der Umschalter für die diversen Sprachen (aktuell 2). ich kenne nur die alte Methode per Marker. Wie bekomme ich denn nun die Flaggen od. die Selectbox an einen definierten Platz im HTML Template?

cu denny

## Antworten

### [#2](https://www.typo3.net/d/24760-sprachen-switcher/2) · Renko · 2005-05-30

du kannst wie bei <http://www.jweiland.net> mehrsprachigkeit vorgehen

du musst wie bei FTB Doku beschrieben eine id setzen und diese mit einem Field Objekt mappen als typo script Object path

nun noch folgendes ins setup

# defining the default language
config.sys_language_uid = 0
config.language = de
config.locale_all = de_DE

# Setting up the language variable "L" to be passed along with links
config.linkVars = L

# Fench language, sys_language.uid = 0
[globalVar = GP:L = 0]
config.sys_language_uid = 0
config.language = de
config.locale_all = de_DE
[global]

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

# hier kommt die die zuweisung auf das typoscipt object path, Namen beachten

## Language
lib.language = PHP_SCRIPT
lib.language.file = fileadmin/templates/scripts/language.php

dann noch PHP script für die Flaggen umschaltung hochladen

hier das Script habs noch ein wenig angepasst vom orginal damit der pointer nicht hin und her springt !

Achtung du benötigst noch folgende images im pfad

fileadmin/templates/images

pfeil.gif und
clear.gif
flag_de.gif
flag_de_d.gif
flag_uk.gif
flag_uk_d.gif

da ich eigene flaggen verwendet habe

das Orginal php script findest du im typo3 verzeichnis suche nach *languag*.php

<?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, an english, a danish and a german 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>
 */

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 src="fileadmin/templates/images/pfeil.gif" width="7" height="10" align="middle" alt="" />';
$blank = '<img src="fileadmin/templates/images/clear.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 record on this page), the icon is dimmed.
$flags = array();
$flags[] = ($GLOBALS['TSFE']->sys_language_uid==0?$pointer:$blank).'<a href="'.htmlspecialchars('index.php?id='.$GLOBALS['TSFE']->id.'&L=0').'" target="_top"><img src="fileadmin/templates/images/flag_de.gif" width="21" height="13" hspace="5" border="0" align="middle" alt="" /></a>';
$flags[] = ($GLOBALS['TSFE']->sys_language_uid==1?$pointer:$blank).'<a href="'.htmlspecialchars('index.php?id='.$GLOBALS['TSFE']->id.'&L=1').'" target="_top"><img src="fileadmin/templates/images/flag_uk'.($langArr[1]?'':'_d').'.gif" width="21" height="13" hspace="5" border="0" align="middle" alt="" /></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 used in the extension template used to control the language setup)
$content = '<table border="0" cellpadding="0" cellspacing="0" valign="middle"><tr><td><img src="clear.gif" width="30" height="1" alt="" /></td><td>'.implode('',$flags).'</td></tr></table>';

?>

[/url]

---

Quelle: „Sprachen Switcher“, typo3.net, https://www.typo3.net/d/24760-sprachen-switcher
Beiträge von Mitgliedern des Forums. Bitte mit Link auf die Diskussion zitieren.
