Hacker News new | ask | show | jobs
by gioele 4471 days ago
To avoid such problems in Rack/Rails Ruby project I suggest the rack-i18n_best_langs gem (regardless of the name, it does not depend on the i18n gem) I wrote:

    https://github.com/gioele/rack-i18n_best_langs
> Differently from other similar Rack middleware components, rack-i18n_best_langs returns a list of languages in order of guessed importance, not a single language.

> Language discovery is done using three clues:

> * the presences of language tags in paths (e.g. /service/warranty/ita),

> * the content of the HTTP Accept-Language header,

> * the content of the rack.i18n_best_langs cookie when set.