logo       

Re: [Rails I18n] Suggested code for auto finding the client locale: msg#00011

lang.ruby.rails.i18n

Subject: Re: [Rails I18n] Suggested code for auto finding the client locale

Another mail on the Globalize mailing list about this topic by Thiago
Arrais, (Globalize flavor this time):

-- begin --

Here is the code I came up with:

http://www.textsnippets.com/posts/show/546

It considers not only the accept-language field, but other user options.
In order of precedence they are:

- Explicit locale passed on URL
- Previous language selection (stored on user session)
- Accept-Language field contents
- Default locale

You may package this snippet with Globalize in any way you'd like.

Cheers,

Thiago Arrais

-- end --

--
Posted via http://www.ruby-forum.com/.


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise