Ask a Question related to Dreamweaver AppDev, Design and Development.
-
laphotoimage2 #1
Retrieve Language
I'm writing a web page using PHP and javascript and I need a way using either to retrieve the language being used on the users P.C. be that English, German, etc.
Thanks,
Tom
laphotoimage2 Guest
-
Retrieve URL from DB
Does anyone know how to pull a URL from a DB? Here's my example: I have a database with training records in it. Inside the DB people fall under... -
Dictionary language switches language during spellcheck
During a spellcheck of a complete document, the language mysteriously switches from English USA (which in Canada isn't quite right, but that's... -
#25051 [Opn->WFx]: translating between gettext language identifiers and 'Accept-Language' ones
ID: 25051 Updated by: sniper@php.net Reported By: wouter at grep dot be -Status: Open +Status: Wont... -
#25051 [NEW]: translating between gettext language identifiers and 'Accept-Language' ones
From: wouter at grep dot be Operating system: irrelevant PHP version: Irrelevant PHP Bug Type: Feature/Change Request Bug... -
How to prevent the language icon from disappearing and a language switching delay?
What is wrong with my question since nobody answers it? How to improve the question? "Dmitriy Kopnichev" <kopn@hotbox.ru> wrote in message... -
Joe Makowiec #2
Re: Retrieve Language
On Thu 28 Apr 2005 04:22:42p, laphotoimage2 wrote in
macromedia.dreamweaver.appdev:
/Assuming/ the browser gives you correct information, you can access it in> I'm writing a web page using PHP and javascript and I need a way using
> either to retrieve the language being used on the users P.C. be that
> English, German, etc.
HTTP_ACCEPT_LANGUAGE or accept-language header. Using this script:
<SCRIPT LANGUAGE="javascript1.2">
var nav_lng="peed-jahn_brah"; //default language string
if(navigator.language)nav_lng="navigator.language" ;
if(navigator.browserLanguage)nav_lng="navigator.us erLanguage";
if(navigator.systemLanguage)nav_lng="navigator.sys temLanguage";
if(navigator.browserLanguage)nav_lng="navigator.br owserLanguage";
if(navigator.userLanguage)nav_lng="navigator.userL anguage";
if(window.navigator.language)nav_lng="window.navig ator.language";
alert(nav_lng);
</script>
(adapted from [url]http://www.webmasterworld.com/forum91/2476-2-10.htm[/url])
It turns out that FireFox returns the value in window.navigator.language;
IE6/Win returns it in navigator.userLanguage.
In PHP, you can snag the value in $_SERVER['HTTP_ACCEPT_LANGUAGE']
See: [url]http://www.php.net/reserved.variables[/url]
Joe Makowiec Guest
-
David Powers #3
Re: Retrieve Language
laphotoimage2 wrote:
Think very, very carefully what you do with that information. Not> I'm writing a web page using PHP and javascript and I need a way using either to retrieve the language being used on the users P.C. be that English, German, etc.
everybody working on a computer running on a specific language will be a
native speaker of that language. An American accessing the internet in
the business centre of a hotel in Germany will not thank you for serving
up a page in German. I have one computer that uses Japanese as its base
language. I can read Japanese, but if my brother were to use my
computer, he'd be completely lost if you "kindly" served him a page in
Japanese.
Try to serve the most appropriate content by all means, but make sure
you give the user a clear option to change the language of the content.
--
David Powers
Author, "Foundation PHP 5 for Flash" (friends of ED)
Co-author "PHP Web Development with DW MX 2004" (Apress)
[url]http://computerbookshelf.com[/url]
David Powers Guest
-



Reply With Quote

