guess locale from browser settings

This commit is contained in:
livefromthemoon@gmail.com 2010-10-28 03:37:29 +02:00
parent 06654b13b2
commit 6e1121179d
3 changed files with 13 additions and 0 deletions

View file

@ -27,6 +27,7 @@ gem 'roxml', :git => 'git://github.com/Empact/roxml.git'
gem 'addressable', :require => 'addressable/uri'
gem 'json'
gem 'mini_fb'
gem 'http_accept_language', :git => 'http://github.com/iain/http_accept_language.git'
#Standards
gem 'pubsubhubbub'

View file

@ -67,6 +67,12 @@ GIT
capistrano (>= 2.5.5)
highline (>= 1.4.0)
GIT
remote: http://github.com/iain/http_accept_language.git
revision: 0b78aa7849fc90cf9e12586af162fa4c408a795d
specs:
http_accept_language (1.0.1)
GEM
remote: http://rubygems.org/
specs:
@ -367,6 +373,7 @@ DEPENDENCIES
em-websocket
factory_girl_rails
haml
http_accept_language!
json
launchy
magent!

View file

@ -9,6 +9,7 @@ class ApplicationController < ActionController::Base
before_filter :set_friends_and_status, :except => [:create, :update]
before_filter :count_requests
before_filter :set_invites
before_filter :set_locale
def set_friends_and_status
if current_user
@ -33,4 +34,8 @@ class ApplicationController < ActionController::Base
@invites = current_user.invites
end
end
def set_locale
I18n.locale = request.compatible_language_from I18n.available_locales
end
end