Language Detection

June 25, 2010 at 08:05

The extension rlmp_language_detection is supposed to automatically detect the browser language and display the right language page. This is supposed to be as easy as installing the extension but, of course, with Typo3 it is never that easy. To make sure this won't take me 2 days to get working next time I need it (and I pray to god this day may never come), I want to carefully explain what I did, step by step. Not all of what I did may be necessary, I'm just describing what I did to make it work in the end.

1. download the extension from the repository and install it in the extension manager

2. added the following to the Root Typoscript:

plugin.tx_rlmplanguagedetection_pi1 {
defaultLang = de
useOneTreeMethod = 1

3. after refreshing my page, there was no change at all. After some more research, I added the following typoscript:

page.1000 =< plugin.tx_rlmplanguagedetection_pi1

4. another refresh produces this error:

NO entry in the $TCA-array for the table "static_languages".

5. it seems that for this extension there is one other necessary: static_info_tables. So I installed it, I tested, and: no change. From an earlier try I remembered, that for rlmp_language_detection, there must never be a standard language defined, so to my TS I removed the following line:

#config.sys_language_uid = 0

6. Still no result. I spent the next hours researching but since the community is just so awful, there was nothing to be found. After a while I was fed up with this and decided to do what I do best: look at the php code itself and find out what the FUCK is wrong with this extension. I opened the file typo3conf/ext/rlmp_language_detection/pi1/class.tx_rlmplanguagedetection_pi1.php and checked step by step what was happening. Eventually I found where the script was abruptly stopped:

// Break out if the session tells us that the user has selected language
if (!$this->conf['dontBreakIfLanguageAlreadySelected']) {
	if($GLOBALS["TSFE"]->fe_user->getKey('ses','tx_rlmplanguagedetection_languageSelected') == TRUE) {
		return $content;

7. Seriously?! So there is a variable called dontBreakIfLanguageAlreadySelected. Of course I always deleted the cache and called the index page during my tests and yet this script seems to be convinced that a language has already been chosen. What the FUCK! So I added the following TS line:

plugin.tx_rlmplanguagedetection_pi1.dontBreakIfLanguageAlreadySelected = 1

8. And suddenly it worked! A MIRACLE!

That was yet another bad, frustrating experience with Typo3. The thing is, if something doesn't work right away, you're on your own. It frequently happened to me that after hours of google searching I found a post of someone asking exactly the same question as I had. These questions may be stupid, but the answer usually is a condescending "read the fucking manual!". Unfortunately, the manual doesn't help at all. There was nothing mentioned of static_info_tables and neither the variable dontBreakIfLanguageAlreadySelected... honestly, how was I supposed to find out that this might be important? I'm not a psychic.

Just... screw typo3 and SCREW the community that is just a bunch of arrogant, unhelpful, stuckup BASTARDS!

Tags: Automatische Sprachumschaltung rlmp_language_detection Spracherkennung typo3 extension

Hinterlasse einen Kommentar:
Vielen vielen Dank für diesen super Tipp. Ich hatte schon fast aufgegeben aber zum Glück diese Seite gefunden. Und ich muss Dir zustimmen, die Hilfe die man in den gängigen Foren erhält ist wirklich sehr dürftig. Also danke nochmal und weiter so !!!

Danke für diesen Beitrag. Ich sollte für nen Kunden ne Sprachumschaltung basierend auf Browsereinstellung in seinem Typo3 4.4.2 realisieren und dieses rlmp_language_detection wollte einfach absolut nichts tun. Ich war schon dran, das Handtuch zu werfen, als ich doch noch Deinen Beitrag in Google gefunden habe. Nun funktionierts. Knackpunkt bei mir war ebenfalls "dontBreakIfLanguageAlreadySelected". Erschwerend kommt dazu, dass ich nicht nachvollziehen kann, was das Ding alles als "bereits selected" ansieht, wird wohl immer ein Rätsel bleiben. Anyway.. thx!

Ebenfalls vielen Dank, nach stundenlanger Suche in all den "Profi"-Foren, wo letztendlich nur Müll drinsteht, endlich hier die Lösung. Ganz einfach erklärt, sodass wirklich jeder versteht, wie und warum was funktioniert mit der Extension. Vielen Dank

Hallo, vielen Dank für Deine Anleitung - mir erging es bis dato wie Dir... Jedoch habe ich immer noch kein Erfolg - mein TS sieht wie folgt aus: plugin.tx_rlmplanguagedetection_pi1 { defaultLang = de useOneTreeMethod = 1 } page.1000 =< plugin.tx_rlmplanguagedetection_pi1 plugin.tx_rlmplanguagedetection_pi1.dontBreakIfLanguageAlreadySelected = 1 config.htmlTag_setParams = none config.htmlTag_setParams = xml:lang="de-DE" lang="de-DE" # deutsch = standard = id 0 config.linkVars = L #config.sys_language_uid = 0 config.language = de config.locale_all = de_DE config.htmlTag_setParams = lang="de" dir="ltr" # deutsch [globalVar = GP:L=0] #config.sys_language_uid = 0 config.language = de config.locale_all = de_DE config.htmlTag_setParams = lang="de" dir="ltr" [global] # englisch [globalVar = GP:L=1] #config.sys_language_uid = 1 config.language = en config.locale_all = en_EN config.htmlTag_setParams = lang="en" dir="ltr" [global] # espanol [globalVar = GP:L=2] #config.sys_language_uid = 2 config.language = es config.locale_all = es_ES config.htmlTag_setParams = lang="es" dir="ltr" [global] Hast Du eine Idee was noch falsch sein könnte? Gruß

ich fürchte ich muss mich schon seit einer Weile nicht mehr mit typo3 beschäftigen - ich hab das alles verdrängt, ich kann dir da leider nicht helfen

Vielen Dank für die Anleitung! Das hätte ich nie selbst herausgefunden.