[TYPO3] Force Language and L-parameter

Søren Schaffstein soeren.schaffstein at media-lights.de
Wed Nov 29 11:25:26 CET 2006


A possible - but dirty - solution:

For now we have a solution which is not really nice, but at least it 
works. Idea is to include a library with TypoScript on the page where we 
want to force the language. This can easily be done like this:

#include library to insure that the L parameter is set
includeLibs.tx_lparam = fileadmin/templates/libraries/set_l_param.inc

The library does two simple things.
1. checks if L is set
2. if L is not set, the page is reloaded with L set to our preferred 
value (L=1)


<?php
if (!isset($_GET['L'])) {
	$url = t3lib_div::locationHeaderUrl(t3lib_div::linkThisScript(array('L' 
=> 1)));
	echo '<html>' . "\n";
	echo '<head>' . "\n";
	echo '<meta http-equiv="refresh" content="0; URL='.$url.'">' . "\n";
	echo '</head>' . "\n";
	echo '<body>' . "\n";
	echo '</body>' . "\n";
	echo '</html>' . "\n";
	exit;
}
?>


As soon as anyone finds a better solution, I'm happy to hear it...

Cheers,
Søren


Søren Schaffstein wrote:
> Hi there,
> 
> is there a way to force the language and value of the L-parameter on a 
> page by TypoScript?
> 
> Setup is this:
> We have a page in german (default lang) and english. To explain some 
> further details in more languages there are 10 pages in spanish, 
> russian, etc.. When a user jumps to one of these pages, (or enters them 
> directly from a url) TYPO3 should switch to english and apply L=1 to all 
> links.
> 
> Switching the language seems easy as it can be done using:
> config.sys_language_uid = 1
> 
> But clicking on any link then switches the language back to default.
> 
> Any ideas?
> Any help is greatly appreciated.
> 
> Cheers,
> Søren


More information about the TYPO3-english mailing list