Forum: Rails I18n Automatically detect client's locale setting

Posted by Fernando Perez (fernando)
on 2008-12-10 15:59
Hi,

Does I18n provide any easy feature to detect the client's browser
locale?
Posted by Christian Richter (dragonchaser)
on 2009-01-13 20:25
Hi Fernando,

had the same problem, but solving was quite easy:

I18n.locale = 
request.headers['HTTP_ACCEPT_LANGUAGE'].split(',')[0].split('-')[0]

greetings
Christian

Fernando Perez wrote:
> Hi,
> 
> Does I18n provide any easy feature to detect the client's browser
> locale?
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.