| |
| | |

CodersClub

 Forgot password?
 Register
Search
View: 12715|Reply: 12
Collapse the left

Auto detect user language

[Copy link]

 United States

Post time: 2011-11-10 09:18
| Show all posts |Read mode
To fix specific language and for search engine use, is it possible to make the path or link like these? Thank you.
http://domain.com/en-us/forum.php   or   http://domain.com/forum.php/en-us
http://domain.com/zh-cn/forum.php   or   http://domain.com/forum.php/zh-cn
http://domain.com/zh-tw/forum.php   or   http://domain.com/forum.php/zh-tw

 Russia

Post time: 2011-11-10 09:40
| Show all posts
etask, explain please,
why do you want this?

Imho, this method will cause page duplication in search engines,
so, it is not good for SEO, isn't it?

 United States

 Author| Post time: 2011-11-10 17:24
| Show all posts
I am actually concern about the SEO.
When a English user google a keyword and link to http://domain.com, the interface is English by default which is ok.
When a Chinese user google or baidu a keyword and link to http://domain.com, the interface is still English by default which is NOT Good.
If you can use cookies or rewrite base on user's browser language or location that will be wonderful.

 United States

 Author| Post time: 2011-11-10 18:09
| Show all posts
I'm checking to see if I can use one multi language version to create 3 sets of forums in 3 different languages. I try to limit English users to read en-us only while Simplified Chinese user read zh-cn only, and Traditional Chinese read zh-tw only. But they all using the same database and can access to all areas. It is just too messy for Chinese users to read thread with the English interface when they first land to the thread page from Baidu. I am sure that most of them will leave the site right away. Your method is good but need to be improved.

 Russia

Post time: 2011-11-10 20:08
| Show all posts
If you can use cookies or rewrite base on user's browser language or location that will be wonderful.

For now the default language in config file looks like this:
  1. $_config['output']['language']                 = 'en';                // Default Page language en / zh_cn / zh_tw
Copy the Code
First of all, you can change this to Chinese.

But I have an idea:

The user browser reports to a server what the language and encoding this user uses.
I.e. my browser report:
HTTP_ACCEPT_LANGUAGE=ru-ru,ru;q=0.8,en-us;q=0.6,en;q=0.4,zh-cn;q=0.2

I think, your language ratio will be more Chinese

Let's add the "auto" value for default language!
When the default language is set to "auto", the engine can automatically calculate the user preferred language...

What about such idea?

 United States

 Author| Post time: 2011-11-11 08:15
| Show all posts
Is it like this?

$_config['output']['language'] = 'auto';

 Russia

Post time: 2011-11-11 09:26
| Show all posts
Yes!
But for now it is only an idea for discuss

 United States

 Author| Post time: 2011-11-11 17:54
| Show all posts
Thanks! I like the idea.

Is it possible to assign 'en' to English sub-forum only and users cannot change to 'zh-cn'?
And assign 'zh-cn' to Chinese sub-forum only and users cannot change to 'en'?

 Russia

Post time: 2011-11-11 18:03
| Show all posts
Is it possible to assign 'en' to English sub-forum only and users cannot change to 'zh-cn'?
And assign 'zh-cn' to Chinese sub-forum only and users cannot change to 'en'?

This is not supported at all.
Post this idea into the DzX Wishlist

 Russia

Post time: 2011-11-26 11:15
| Show all posts
User preferred language auto-detection added.
Now the system will check a visitor preferred languages from his browser parameter:
HTTP_ACCEPT_LANGUAGE

If the visitor yet not selected a language before,
the system will automatically choose the user most preferred language
or a default system language if the user language is not present in the enabled language list.

How to use the autodetection:
1) Update the code from SVN.
2) Add this lines into your config_global.php:
  1. // Auto-detect user language: true|false
  2. $_config['detect_language'] = true;
Copy the Code
Set this variable to false or 0 if you do not want to use the language autodetection.
3) Update the DATA cache from your Admin-Center.

Fix:
http://code.google.com/p/discuzx-en/source/detail?r=191
You have to log in before you can reply Login | Register

Points Rules

Archive|Mobile|Dark room|CodersClub

Top.Mail.Ru
Top.Mail.Ru

2024-05-15 21:50 GMT+3 , Processed in 0.093293 sec., 9 queries .

Powered by Discuz! X3.4 Release 20230520

© 2001-2024 Discuz! Team.

MultiLingual version, Rev. 4301, © codersclub.org

Quick Reply To Top Return to the list