Tech News
← Back to articles

Accept_language 2.2 – RFC 7231/4647 compliant Accept-Language parsing for Ruby

read original related products more articles

AcceptLanguage

A lightweight, thread-safe Ruby library for parsing the Accept-Language HTTP header field.

This implementation conforms to:

Note RFC 7231 obsoletes RFC 2616 (the original HTTP/1.1 specification). The Accept-Language header behavior defined in RFC 2616 Section 14.4 remains unchanged in RFC 7231, ensuring full backward compatibility.

Installation

gem "accept_language"

Usage

AcceptLanguage . parse ( "da, en-GB;q=0.8, en;q=0.7" ) . match ( :en , :da ) # => :da

Behavior

Quality values

... continue reading