Reply to Re: [Newbie] (User Agent) Language Detection - can you please take a look?

Your name:

Reply:


Posted by Mladen Gogala on 06/25/05 08:00

On Fri, 24 Jun 2005 15:11:16 -0700, David Winter wrote:

> <?php
> echo "$HTTP_ACCEPT_LANGUAGE";
> ?>
>
> does work, i.e. it shows the correct Language Code.


How about putting one echo "$userlang\n"; or var_dump($userlang);
after you set $userlang? You are not testing $HTTP_ACCEPT_LANGUAGE,
you are testing variable $userlang=substr($HTTP_ACCEPT_LANGUAGE,0,2);
PHP5 distinguishes uppercase from lowercase. Try with:
$userlang=strtoupper(substr($HTTP_ACCEPT_LANGUAGE,0,2));

Language codes are formated like this:
$ echo $LANG
en_US

What you will get from your code is "en" which isn't the same as "EN".
--
You can get more of what you want with a kind word and a gun than
you can with just a kind word. (Al Kapone)

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация