Module: AcceptLanguage
- Defined in:
- lib/accept_language.rb,
lib/accept_language/parser.rb,
lib/accept_language/matcher.rb
Overview
This module provides a tiny library for parsing the Accept-Language header as specified in RFC 2616. It transforms the Accept-Language header field into a language range, providing a flexible way to determine user’s language preferences and match them with the available languages in your application.
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.
25 26 27 |
# File 'lib/accept_language.rb', line 25 def self.parse(field) Parser.new(field) end |