Language Detection

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!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.