/    Sign up×
Community /Pin to ProfileBookmark

find out navigator language code with php

Hi all,
does anyone know how to find out the clients language code with php? us, de, ru etc.
get_browser doesn’t work on my system right now because of the browsecap settings (unfortunately i dunno what that is). Are there any other functions to get client information?

I really don’t whant to use Js and an additional page call (php) to add this info to my session.

Can anyone help?

Thanks in advance

to post a comment
PHP

1 Comments(s)

Copy linkTweet thisAlerts:
@cul8er23authorOct 19.2003 — Asking for $HTTP_USER_AGENT using NAV6 gives out the following:

Mozilla/5.0 (Windows; U; Windows NT 5.0; de-DE; m18) Gecko/20001106 Netscape6/6.0

<?php

session_start();

$lang = 0;

$ua = $HTTP_USER_AGENT;

if (strchr($ua,'DE')){

$lang = 2;

}

if ( strchr($ua, 'US' ) ){

$lang = 1;

}

if (strchr($ua,'RU')){

$lang = 7;

}

session_register("lang");

?>

But still this no use if client is IE .... Grmmph
×

Success!

Help @cul8er23 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...