Automatically detect language
Posted Jul 13, 2013 - 12:40 PM:
HelloPaul
Is it possibleto automatically detectthe language of thevisitor's browserandstartall WSN scripts automaticallyonthe language, leaving thevisitors a chance tostillchoose the languagethey preferif theproposeddoes not suit him.Ifthe language of thebrowserdoes not exist inthe languages โโofscripts,thenthe languageisthe default,in my casetheFrench.
This would bea huge advantagefor visitors toalanguage other thanFrench,alwaysin my case.
If this isalways possible,can you givemethe procedure for thepayment.
Since I have to translate between the language names and the two letter codes that browsers transmit, I'm using the ISO 639-1 country list: https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes . If your language files are named with either the native name or the the english name from that list, they should get selected -- note this is not case-sensitive. I'm also using php.net/manual/en/function....ttp-negotiate-language.php -- not that actual built-in function as it doesn't appear to be present on many hosts, but the recreated example in the first comment -- to ensure that the full list of languages supported by the browser is searched with appropriate weighting priority. When there's no match with browser preference, the WSN default language is used. When a registered member has selected a language in their member profile, that language is always used (the registration default value is calculated from their browser language value though). When a guest uses the language selector on the site to set a cookie specifying desired language, that value gets priority too.
Only the languages/setup/ has fullenglish.lng -- when installed, it renames to languages/English.lng. Make sure yours is named English.lng (or english.lng). And nederlands should be changed to dutch.lng for consistency.
Should work in 8.0.1 now, but needs testing with different languaged browsers.
Please upgrade your sites to 8.0.1 or send me access to do so. It ought to happen automatically but either you have that option off or there's not enough traffic for the cron to run or something odd if going on. Or maybe it'll happen in another day, not sure.
Comments on Automatically detect language
Forum Regular
Usergroup: Customer
Joined: Nov 05, 2006
Location: Borlo Belgique
Total Topics: 27
Total Comments: 121
Posted Jul 13, 2013 - 12:40 PM:
Hello Paul
Is it possible to automatically detect the language of the visitor's browser and start all WSN scripts automatically on the language, leaving the visitors a chance to still choose the language they prefer if the proposed does not suit him. If the language of the browser does not exist in the languages โโof scripts, then the language is the default, in my case the French.
This would be a huge advantage for visitors to a language other than French, always in my case.
If this is always possible, can you give me the procedure for the payment.
Cordially.
Francis
developer
Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California
Total Topics: 61
Total Comments: 7868
I can implement this for $65 for the next release, please use www.wsnlinks.com/index.php?...section=payamount&price=65 to pay
Since I have to translate between the language names and the two letter codes that browsers transmit, I'm using the ISO 639-1 country list: https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes . If your language files are named with either the native name or the the english name from that list, they should get selected -- note this is not case-sensitive. I'm also using php.net/manual/en/function....ttp-negotiate-language.php -- not that actual built-in function as it doesn't appear to be present on many hosts, but the recreated example in the first comment -- to ensure that the full list of languages supported by the browser is searched with appropriate weighting priority. When there's no match with browser preference, the WSN default language is used. When a registered member has selected a language in their member profile, that language is always used (the registration default value is calculated from their browser language value though). When a guest uses the language selector on the site to set a cookie specifying desired language, that value gets priority too.
Forum Regular
Usergroup: Customer
Joined: Nov 05, 2006
Location: Borlo Belgique
Total Topics: 27
Total Comments: 121
Hello Paul
The payment has been madeโโ, thank you for agreeing to this addition.
Currently, the name of my language files are:
french, fullenglish, german, nederlands, spanish, as this originally in the script.
If this is file names must be changed, can you let me know and tell me what may be changed in these files (possibly variable) so that everything works perfectly.
Cordially.
Francis
developer
Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California
Total Topics: 61
Total Comments: 7868
Only the languages/setup/ has fullenglish.lng -- when installed, it renames to languages/English.lng. Make sure yours is named English.lng (or english.lng). And nederlands should be changed to dutch.lng for consistency.
Should work in 8.0.1 now, but needs testing with different languaged browsers.
Forum Regular
Usergroup: Customer
Joined: Nov 05, 2006
Location: Borlo Belgique
Total Topics: 27
Total Comments: 121
All names of language files have been renamed as requested.
developer
Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California
Total Topics: 61
Total Comments: 7868
Please upgrade your sites to 8.0.1 or send me access to do so. It ought to happen automatically but either you have that option off or there's not enough traffic for the cron to run or something odd if going on. Or maybe it'll happen in another day, not sure.
Forum Regular
Usergroup: Customer
Joined: Nov 05, 2006
Location: Borlo Belgique
Total Topics: 27
Total Comments: 121
Hello Paul
I just sent you the access codes by email.
Good day.
Francis
developer
Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California
Total Topics: 61
Total Comments: 7868
Updated and it now shows me English when I'm not logged in, so appears to be working correctly.
Forum Regular
Usergroup: Customer
Joined: Nov 05, 2006
Location: Borlo Belgique
Total Topics: 27
Total Comments: 121
Hello Paul
It works perfectly, thank you for your work.
Cordially.
Francis