Commit 6e7e44d5921823e85dd9c810ab5787bec5b39dcc

Authored by Braulio Bhavamitra
1 parent e137c34d

Use I18n fallbacks and default_locale

app/controllers/application_controller.rb
@@ -65,6 +65,7 @@ class ApplicationController < ActionController::Base @@ -65,6 +65,7 @@ class ApplicationController < ActionController::Base
65 FastGettext.default_locale = environment.default_locale 65 FastGettext.default_locale = environment.default_locale
66 FastGettext.locale = (params[:lang] || session[:lang] || environment.default_locale || request.env['HTTP_ACCEPT_LANGUAGE'] || 'en') 66 FastGettext.locale = (params[:lang] || session[:lang] || environment.default_locale || request.env['HTTP_ACCEPT_LANGUAGE'] || 'en')
67 I18n.locale = FastGettext.locale 67 I18n.locale = FastGettext.locale
  68 + I18n.default_locale = FastGettext.default_locale
68 if params[:lang] 69 if params[:lang]
69 session[:lang] = params[:lang] 70 session[:lang] = params[:lang]
70 end 71 end
config/initializers/i18n.rb 0 → 100644
@@ -0,0 +1,4 @@ @@ -0,0 +1,4 @@
  1 +# necessary for I18n.default_locale to work
  2 +require 'i18n/backend/fallbacks'
  3 +I18n.backend.class.send :include, I18n::Backend::Fallbacks
  4 +