Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

locale selection more customizable

  • Loading branch information...
commit 1dfa75c1b6f7aa90737b93f079b471861790be02 1 parent b068115
@khustochka authored
Showing with 7 additions and 2 deletions.
  1. +7 −2 app/controllers/application/application_controller.rb
View
9 app/controllers/application/application_controller.rb
@@ -15,10 +15,15 @@ class ApplicationController < ActionController::Base
private
def set_locale
- I18n.locale = ["en", "uk"].include?(params[:hl]) ? params[:hl] : "ru"
+ I18n.locale = non_default_locales.include?(params[:hl]) ? params[:hl] : I18n.default_locale
+# I18n.reload!
end
def default_url_options(options={})
- { :hl => I18n.locale } if ["en", "uk"].include?(I18n.locale)
+ { :hl => I18n.locale } if non_default_locales.include?(I18n.locale)
+ end
+
+ def non_default_locales
+ %w(en uk ru) - [I18n.default_locale.to_s]
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.