1
reWARder
xLanguage auto language detection
  • 2013/10/30 9:48

  • reWARder

  • Not too shy to talk

  • Posts: 107

  • Since: 2004/5/28


I didn't really know where to put this this question and it seemed to me, that this was the most accurate forum.

I would like xLanguage to automatically set the language of my website to the same language the browser of the visitor is.

Is there a way to do this or would this mean that additional code needs to be added for such an automatic selection?

2
reWARder
Re: xLanguage auto language detection
  • 2013/10/31 9:11

  • reWARder

  • Not too shy to talk

  • Posts: 107

  • Since: 2004/5/28


Is there nobody with the same question around or has nobody every though this might be a great addition to xLangauge?

3
Mamba
Re: xLanguage auto language detection
  • 2013/11/1 9:57

  • Mamba

  • Moderator

  • Posts: 11204

  • Since: 2004/4/23


This might be interesting, but also could become a complex issue if the user in Germany wants to read your Website in French.

Right now he can select the French language. If it is being done automatically, then there would be a need to overwrite the auto-assignment of the language, which could be complex....

Maybe somebody will come up with a good idea for it...
Support XOOPS => DONATE
Use 2.5.10 | Docs | Modules | Bugs

4
reWARder
Re: xLanguage auto language detection
  • 2013/11/2 7:21

  • reWARder

  • Not too shy to talk

  • Posts: 107

  • Since: 2004/5/28


Quote:

Mamba wrote:
This might be interesting, but also could become a complex issue if the user in Germany wants to read your Website in French.

Right now he can select the French language. If it is being done automatically, then there would be a need to overwrite the auto-assignment of the language, which could be complex....

Maybe somebody will come up with a good idea for it...


Personally I think it would need two things to make 99% of my visitors happy:

1. When a user first visits the site the language is going to be set according to his browser language. These language settings are going to be saved locally on his computer with a cookie.

2. If the users changes the language himself, then the language setting in the cookie changes. The cookie then issues a command to xLanguage to change the language.


Wouldn't this be a feasable approach?

5
redheadedrod
Re: xLanguage auto language detection

You would need something that looks at the browser information which I don't think anything does at this time. (Could be wrong, I just never heard of anything that does or seen any code that does.) I am assuming that the browser identifies what the language is otherwise this is not possible to do.

You could place it in the cookie and if the cookie is populated use that value otherwise look at the browser. Problem with this approach is that you will find that when a cookie is reset then the user would need to change their language again if it is not accurately reported by their browser.

Would almost be better to tie the language to the IP address or the reported user. Then it could be set once and forgotten. But again this information has to be looked at at some point. This would allow the language to be set from the first screen before the user logs in.

By reported user, when someone connects to a service both their IP address and the user name the ISP gives them are available. Although these are easily spoofed. MOST legit users won't bother even if they know how. (Exceptions might be countries like China and North Korea where their governments severely limit their access so people find proxies they can get out of the country through which will post other IP or user information.)

In the end it is a cool idea but in reality it would need to be something you could switch on and off and you are likely to create more issues than it fixes.

6
Mamba
Re: xLanguage auto language detection
  • 2013/11/2 16:10

  • Mamba

  • Moderator

  • Posts: 11204

  • Since: 2004/4/23


Quote:
You would need something that looks at the browser information which I don't think anything does at this time. (Could be wrong, I just never heard of anything that does or seen any code that does.) I am assuming that the browser identifies what the language is otherwise this is not possible to do.

I was looking at that yesterday, and we could use:

$_SERVER['HTTP_ACCEPT_LANGUAGE'];


to detect the browser's language. I am sure that if you search for this on Google, there will be some potential solutions in PHP.

Unfortunately, I don't have the time to dig into xLanguage to see if this would be a trivial thing or not. I am just too behind on too many things

Maybe somebody could take a look and come up with a solution.
Support XOOPS => DONATE
Use 2.5.10 | Docs | Modules | Bugs

7
redheadedrod
Re: xLanguage auto language detection

I meant that there was not anything within Xoops that does it.. I have only seen people change the language in the theme. You COULD likely do this in a theme if you really wanted it. Just have the code change the language based on what it got when it checks before it renders any text.

8
Anonymous
Re: xLanguage auto language detection
  • 2013/11/3 11:24

  • Anonymous

  • Posts: 0

  • Since:


WP has a nice multilingual plugin with language detection. It's like xlanguage but is more advanced, has seo and is more user friendly (I like the seperate input in editor instead of using tags). It could be nice for ideas and investigating

9
Mamba
Re: xLanguage auto language detection
  • 2013/11/3 13:30

  • Mamba

  • Moderator

  • Posts: 11204

  • Since: 2004/4/23


Quote:

flipse wrote:
It's like xlanguage but is more advanced, has seo and is more user friendly (I like the seperate input in editor instead of using tags)

You should try xContent, which was exactly addressing that, and that's why I liked that...

This was one of the better ideas of Wishcraft, but unfortunately, there are still bugs there....
Support XOOPS => DONATE
Use 2.5.10 | Docs | Modules | Bugs

10
Mamba
Re: xLanguage auto language detection
  • 2014/2/27 1:18

  • Mamba

  • Moderator

  • Posts: 11204

  • Since: 2004/4/23


I think, I found the solution for it.

1) The code was already there, but since this sounded like a "new feature" request, I was just doing some research outside to see how it could be done, and didn't look a the code itself.

2) Today Rewarder pointed us to the fact that xLanguage supposed to be doing it already, so I look inside, and it seems that there were just bugs, which prevented xLanguage form auto-detecting users language on his first visit.

3) I think, I was able to fix the bugs, and we'll be testing on Rewarder's Website to see if it works.

But it will only detect the language with the highest score. Normally the browser provides in the:

$_SERVER['HTTP_ACCEPT_LANGUAGE'];


values like these, i.e. language code and the importance value:

de-DE,de;q=0.92,pl-PL;q=0.83,pl;q=0.75,ja-JP;q=0.67,ja;q=0.58,fr-FR;q=0.5,fr;q=0.42,it-IT;q=0.33,it;q=0.25,en-US;q=0.17,en;q=0.08


In Firefox there are extensions that can change that, but in Chrome I couldn't find an extension for it. I can change the language in settings and it will switch to it, but English will still stay with the highest value, since it was the original default.

If somebody knows how to extract the current language default in Chrome, please let me know.

Otherwise, xLanguage will detect the language with the highest score.

After the tests, I'll let you know how it worked....
Support XOOPS => DONATE
Use 2.5.10 | Docs | Modules | Bugs

Login

Username:
Password:

Lost Password? Register now!

Who's Online

62 user(s) are online (45 user(s) are browsing Support Forums)


Members: 0


Guests: 62


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits