Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: Language Guess from IP

by rob_au (Abbot)
on Dec 05, 2002 at 13:41 UTC ( [id://217760]=note: print w/replies, xml ) Need Help??


in reply to Language Guess from IP

A better approach than attempting to determine language preference from geographical location would be to make use of the Accept-Language header field as defined for HTTP/1.1 in RFC 2616.

The module I18N::AcceptLanguage performs this task by matching language preference to available languages defined in this HTTP/1.1 header field.

From the documentation for this module:

use I18N::AcceptLanguage; my $supportedLanguages = [( 'en-us', 'fr' )]; my $acceptor = I18N::AcceptLanguage->new; my $language = $acceptor->accepts( $ENV{'HTTP_ACCEPT_LANGUAGES'}, $sup +portedLanguages );

 

perl -le 'print+unpack("N",pack("B32","00000000000000000000000111110100"))'

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://217760]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (7)
As of 2024-04-23 18:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found