guess locale from browser settings
This commit is contained in:
parent
06654b13b2
commit
6e1121179d
3 changed files with 13 additions and 0 deletions
1
Gemfile
1
Gemfile
|
|
@ -27,6 +27,7 @@ gem 'roxml', :git => 'git://github.com/Empact/roxml.git'
|
||||||
gem 'addressable', :require => 'addressable/uri'
|
gem 'addressable', :require => 'addressable/uri'
|
||||||
gem 'json'
|
gem 'json'
|
||||||
gem 'mini_fb'
|
gem 'mini_fb'
|
||||||
|
gem 'http_accept_language', :git => 'http://github.com/iain/http_accept_language.git'
|
||||||
|
|
||||||
#Standards
|
#Standards
|
||||||
gem 'pubsubhubbub'
|
gem 'pubsubhubbub'
|
||||||
|
|
|
||||||
|
|
@ -67,6 +67,12 @@ GIT
|
||||||
capistrano (>= 2.5.5)
|
capistrano (>= 2.5.5)
|
||||||
highline (>= 1.4.0)
|
highline (>= 1.4.0)
|
||||||
|
|
||||||
|
GIT
|
||||||
|
remote: http://github.com/iain/http_accept_language.git
|
||||||
|
revision: 0b78aa7849fc90cf9e12586af162fa4c408a795d
|
||||||
|
specs:
|
||||||
|
http_accept_language (1.0.1)
|
||||||
|
|
||||||
GEM
|
GEM
|
||||||
remote: http://rubygems.org/
|
remote: http://rubygems.org/
|
||||||
specs:
|
specs:
|
||||||
|
|
@ -367,6 +373,7 @@ DEPENDENCIES
|
||||||
em-websocket
|
em-websocket
|
||||||
factory_girl_rails
|
factory_girl_rails
|
||||||
haml
|
haml
|
||||||
|
http_accept_language!
|
||||||
json
|
json
|
||||||
launchy
|
launchy
|
||||||
magent!
|
magent!
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ class ApplicationController < ActionController::Base
|
||||||
before_filter :set_friends_and_status, :except => [:create, :update]
|
before_filter :set_friends_and_status, :except => [:create, :update]
|
||||||
before_filter :count_requests
|
before_filter :count_requests
|
||||||
before_filter :set_invites
|
before_filter :set_invites
|
||||||
|
before_filter :set_locale
|
||||||
|
|
||||||
def set_friends_and_status
|
def set_friends_and_status
|
||||||
if current_user
|
if current_user
|
||||||
|
|
@ -33,4 +34,8 @@ class ApplicationController < ActionController::Base
|
||||||
@invites = current_user.invites
|
@invites = current_user.invites
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def set_locale
|
||||||
|
I18n.locale = request.compatible_language_from I18n.available_locales
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue