Welcome Guest, Not a member yet? Register   Sign In
Language from URI
#21

[eluser]tomcode[/eluser]
It's inaccurate because not all browsers communicate the language / stick to the notation , but that's an old thing, I guess You'll catch 99 %. For the rest show the default language.

I always give the visitor the choice to switch the language, to me that's good enough.
#22

[eluser]Ashley Snowdon[/eluser]
I'm guessing that's why you explode the User Agent.

You're parsing an array into match_language() - why is it an array? Maybe you're doing something a bit different than what I am attempting. Either way, I'd have to explode() also.
#23

[eluser]tomcode[/eluser]
A browser can have several languages, if You have Firefox go into the preferences, there You can add / remove languages and set their priority. The lowest entry is always the one with the highest priority. A language ident can be xx or xx-xxx, the first two digits represent an ISO 639.1 identifier who stands for a main language. I chose to go for that main language, good enough for my purposes, I do not intend to separate British from American or Austrian from German.




Theme © iAndrew 2016 - Forum software by © MyBB