[PHP] User's language settings

2004-11-08 Thread Dmitri Pissarenko
Hello!
I have a web-site, part of which is in Russian and another part in English.
English and Russian parts are located in different directories. The 
web-site is static.

I want to create a PHP file, which redirects the user from /index.php to 
/ru/index.html, when his primary language is Russian and to 
/en/index.html, when his primary language is non-Russian.

In other words:
?php
if ($languageRussian)
{
header(Location: http://dapissarenko.com/ru/index.html;);
}
else
{
header(Location: http://dapissarenko.com/en/index.html;);
}
exit;
?
How can I determine user's primary language?
Thanks!
dap
--
Dmitri Pissarenko
Software Engineer
http://dapissarenko.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] User's language settings

2004-11-08 Thread Marek Kilimajer
Dmitri Pissarenko wrote:
Hello!
I have a web-site, part of which is in Russian and another part in English.
English and Russian parts are located in different directories. The 
web-site is static.

I want to create a PHP file, which redirects the user from /index.php to 
/ru/index.html, when his primary language is Russian and to 
/en/index.html, when his primary language is non-Russian.

In other words:
?php
if ($languageRussian)
{
header(Location: http://dapissarenko.com/ru/index.html;);
}
else
{
header(Location: http://dapissarenko.com/en/index.html;);
}
exit;
?
How can I determine user's primary language?
Thanks!
dap
$_SERVER[HTTP_ACCEPT_LANGUAGE] - string with user's language 
preferences. However only a fraction of users willingly set it, so many 
times it will be on its default value, english even for russian speaking 
visitors.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] User's language settings

2004-11-08 Thread Daniel Schierbeck
Marek Kilimajer wrote:
Dmitri Pissarenko wrote:
Hello!
I have a web-site, part of which is in Russian and another part in 
English.

English and Russian parts are located in different directories. The 
web-site is static.

I want to create a PHP file, which redirects the user from /index.php 
to /ru/index.html, when his primary language is Russian and to 
/en/index.html, when his primary language is non-Russian.

In other words:
?php
if ($languageRussian)
{
header(Location: http://dapissarenko.com/ru/index.html;);
}
else
{
header(Location: http://dapissarenko.com/en/index.html;);
}
exit;
?
How can I determine user's primary language?
Thanks!
dap

$_SERVER[HTTP_ACCEPT_LANGUAGE] - string with user's language 
preferences. However only a fraction of users willingly set it, so many 
times it will be on its default value, english even for russian speaking 
visitors.
Yup. I think it's better if you let the visitors decide.
--
Daniel Schierbeck
Help spread Firefox (www.getfirefox.com): 
http://www.spreadfirefox.com/?q=user/registerr=6584

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] User's language settings

2004-11-08 Thread Skippy
On Mon, 08 Nov 2004 22:37:41 +0100 Marek Kilimajer [EMAIL PROTECTED]
wrote:
 How can I determine user's primary language?

 $_SERVER[HTTP_ACCEPT_LANGUAGE] - string with user's language 
 preferences. However only a fraction of users willingly set it, so many 
 times it will be on its default value, english even for russian speaking 
 visitors.

Perhaps try to advertise it somewhere on your site, how to set it in
various browsers. People will use this once they realise the setting is
there. It's very nice to go to a website without doing anything special and
be greeted by your mother tongue. Once they experience this they will like
it.

HTTP_ACCEPT_LANGUAGE will look like this: ro,en-us;q=0.7,en;q=0.3
Comma is the main delimiter, separating languages. The q signifies
precedence among similar languages, such as en-us vs en. Otherwise, the
order in which the languages were given sets precedence.


-- 
Skippy - Romanian Web Developers - http://ROWD.ORG

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php