I18N::AcceptLanguage

I18N::AcceptLanguage is a Perl module that matches language preference to available languages.
Download

I18N::AcceptLanguage Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Christian Gilmore
  • Publisher web site:
  • http://search.cpan.org/~cgilmore/I18N-AcceptLanguage-1.04/lib/I18N/AcceptLanguage.pm

I18N::AcceptLanguage Tags


I18N::AcceptLanguage Description

I18N::AcceptLanguage is a Perl module that matches language preference to available languages. I18N::AcceptLanguage is a Perl module that matches language preference to available languages.SYNOPSIS use I18N::AcceptLanguage; my $supportedLanguages = ; my $acceptor = I18N::AcceptLanguage->new(); my $language = $acceptor->accepts($ENV{HTTP_ACCEPT_LANGUAGE}, $supportedLanguages);I18N::AcceptLanguage matches language preference to available languages per rules defined in RFC 2616, section 14.4: HTTP/1.1 - Header Field Definitions - Accept-Language.PUBLIC METHODSaccepts( CLIENT_PREFERENCES, SUPPORTED_LANGUAGES )Returns the highest priority common language between client and server. If no common language is found, the defaultLanguage is returned. If defaultLanuage is also not set, an empty string is returned. The method expects two arguments:CLIENT_PREFERENCESA string in the same format defined in RFC 2616, quoted here: 1#( ( ( 1*8ALPHA *( "-" 1*8ALPHA ) ) | "*" ) )Examples: da, en-gb;q=0.8, en;q=0.7 en-us, ja, *SUPPORTED_LANGUAGESA reference to a list of language ranges supported by the server.new( )Returns a new I18N::AcceptLanguage object. The method accepts the following key/value pair options:debugA boolean set to either 0 or 1. When set to 1, debug messages will be printed to STDOUT. The value of debug defaults to 0.defaultLanguageA string representing the server's default language choice. The value of defaultLanguage defaults to an empty string.strictA boolean set to either 0 or 1. When set to 1, the software strictly conforms to the protocol specification. When set to 0, the software will perform a secondary, aggressive language match regardless of country (ie, a client asking for only en-gb will get back en-us if the server does not accept en-gb or en but does accept en-us). The last matching language in the supported languages list will be chosen. The value of strict defaults to 1. Requirements: · Perl


I18N::AcceptLanguage Related Software