Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: Language Guess from IP

by rob_au (Abbot)
on Dec 05, 2002 at 13:41 UTC ( #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
Node Status?
node history
Node Type: note [id://217760]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (5)
As of 2021-03-02 08:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My favorite kind of desktop background is:











    Results (41 votes). Check out past polls.

    Notices?