Skip to content

Commit

Permalink
Merge pull request #249 from openSUSE/handle_invalid_locale
Browse files Browse the repository at this point in the history
Fall back to 'en' when locale is invalid
  • Loading branch information
Ana06 committed Apr 22, 2018
2 parents 65d7f36 + 172d4a7 commit 03f09ba
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,8 @@ def set_language
# the short form without underscore
unless LANGUAGES.include? requested_locale
requested_locale = requested_locale.split('_').first
if LANGUAGES.include? requested_locale
params[:locale] = requested_locale
set_gettext_locale
end
params[:locale] = LANGUAGES.include?(requested_locale) ? requested_locale : 'en'
set_gettext_locale
end
@lang = FastGettext.locale
end
Expand Down

0 comments on commit 03f09ba

Please sign in to comment.