Module: AcceptLanguage
- Defined in:
- lib/accept_language.rb,
lib/accept_language/parser.rb,
lib/accept_language/matcher.rb
Overview
AcceptLanguage is a lightweight library that parses Accept-Language HTTP headers (RFC 2616) to determine user language preferences. It converts raw header values into a structured format for matching against your application’s supported languages.
Defined Under Namespace
Class Method Summary collapse
-
.parse(field) ⇒ Parser
Parses an Accept-Language header field value into a Parser object, which can then be used to match user’s preferred languages against the languages your application supports.
Class Method Details
.parse(field) ⇒ Parser
Parses an Accept-Language header field value into a Parser object, which can then be used to match user’s preferred languages against the languages your application supports. This method accepts a string argument in the format as described in RFC 2616 Section 14.4, and returns a Parser object which responds to the #match method.
38 39 40 |
# File 'lib/accept_language.rb', line 38 def self.parse(field) Parser.new(field) end |