kriechi/http_accept_language — explained in plain English
Analysis updated 2026-08-07 · repo last pushed 2015-01-26
Automatically serve a visitor the closest matching language your app supports.
Switch your entire Rails app translations automatically based on the visitor's browser preference.
Match browser language requests to available locales using flexible or strict regional rules.
| kriechi/http_accept_language | 0xdevalias/huginn-chef | 100rabhg/masterdetailapp | |
|---|---|---|---|
| Language | Ruby | Ruby | Ruby |
| Last pushed | 2015-01-26 | 2014-09-30 | 2024-02-20 |
| Maintenance | Dormant | Dormant | Dormant |
| Setup difficulty | easy | hard | moderate |
| Complexity | 2/5 | 4/5 | 2/5 |
| Audience | developer | ops devops | developer |
Figures from each repo's GitHub metadata at analysis time.
The http_accept_language gem helps Ruby on Rails apps detect what language a visitor prefers, based on a signal their browser sends automatically. When someone arrives at your site, their browser includes a hidden preference like "I prefer Dutch, but English is fine too." This tool reads that signal and hands your app a clean list of languages to work with. Under the hood, it intercepts incoming web requests and parses the language header into a sorted array of preferences. It also applies a practical twist on the standard rules: if someone requests "en-US" (US English) but your app only offers "en" (generic English), the gem treats them as compatible. The strict specification says that shouldn't work in that direction, but real-world usage calls for it. This is useful for anyone building a multilingual website. Say you have a store available in English, US English, and Belgian Dutch. A visitor from the Netherlands whose browser lists Dutch as their top choice would automatically get served Belgian Dutch, the closest match you offer. Another visitor who prefers British English but only finds US English available gets that instead. You can also flip on an "auto locale" feature that wires this up so your entire app switches translations on its own. Developers can pick from a few methods depending on how strict they want the matching to be. Some look for exact regional matches, while others ignore region entirely and just match on the base language. The README doesn't go into detail about performance characteristics or advanced configuration, but the tool covers the common scenarios most teams face when deciding which language to show a new visitor.
A Ruby gem that reads the language preference a visitor's browser sends and gives your Rails app a sorted list of languages to match against, with flexible regional fallback.
Mainly Ruby. The stack also includes Ruby, Ruby on Rails.
Dormant — no commits in 2+ years (last push 2015-01-26).
Setup difficulty is rated easy, with roughly 5min to a first successful run.
Mainly developer.
This repo across BitVibe Labs
Verify against the repo before relying on details.