Commit 61707cce6aa6421b57e1e896e8a57028c49b869f
1 parent
376bf478
Exists in
master
and in
11 other branches
rails4: Default locale to en if not set
I18n.locale does not accept nil
Showing
1 changed file
with
1 additions
and
1 deletions
Show diff stats
app/controllers/application_controller.rb
... | ... | @@ -70,7 +70,7 @@ class ApplicationController < ActionController::Base |
70 | 70 | before_filter :set_locale |
71 | 71 | def set_locale |
72 | 72 | FastGettext.available_locales = environment.available_locales |
73 | - FastGettext.default_locale = environment.default_locale | |
73 | + FastGettext.default_locale = environment.default_locale || 'en' | |
74 | 74 | FastGettext.locale = (params[:lang] || session[:lang] || environment.default_locale || request.env['HTTP_ACCEPT_LANGUAGE'] || 'en') |
75 | 75 | I18n.locale = FastGettext.locale.to_s.gsub '_', '-' |
76 | 76 | I18n.default_locale = FastGettext.default_locale.to_s.gsub '_', '-' | ... | ... |