[TYPO3-dev] Re: Class with method for getting the preferd browser language from a visitor (class.t3lib_langUtils)

Rob Vonk typo3 at robvonk.com
Sun Mar 1 11:41:10 CET 2009


Oliver Hader wrote:
> Hi Rob,
> 
> I guess that you wanted to write to the dev-list but then the post
> finally made it to the core list... 

New try..

> Some short words to the attached file:
> * we have t3lib_div::getIndpEnv() already that is used to get
> environment variables
> * to get the best service by a "quality" out of the HTTP header we
> should also use a common function (maybe in t3lib_div)
>   (gzip_encode::gzip_accepted() could also make use of that new function)
> 
> olly

I'll update the file so that it uses getIndpEnv instead.

The generic 'best service from quality parameter in HTTP header' function 
could be derived from my parseDefaultLanguage function. There's one problem 
though:

http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html

says that

"Media ranges can be overridden by more specific media ranges or specific 
media types. If more than one media range applies to a given type, the most 
specific reference has precedence."

And i think that only applies to Media and not the other headers. That 
makes the function more complex and how is determined what the most 
specific is?

On the other hand. What are the chances that typo3 will negotiate with the 
browser through headers what type of file it will send?

So what to do? Create the generic one and document that it doesn't comply 
to the full spec on Media?

Regards,

Rob






More information about the TYPO3-dev mailing list