Module: LocaleSetter::Controller
- Defined in:
- lib/locale_setter/controller.rb
Class Method Summary collapse
Instance Method Summary collapse
- #default_url_options(options = {}) ⇒ Object
- #i18n ⇒ Object
- #locale_user ⇒ Object
- #set_locale ⇒ Object
Class Method Details
.included(controller) ⇒ Object
3 4 5 |
# File 'lib/locale_setter/controller.rb', line 3 def self.included(controller) controller.before_filter :set_locale end |
Instance Method Details
#default_url_options(options = {}) ⇒ Object
7 8 9 10 11 12 13 |
# File 'lib/locale_setter/controller.rb', line 7 def ( = {}) if i18n.locale == i18n.default_locale else {LocaleSetter.config.url_param => i18n.locale}.merge() end end |
#i18n ⇒ Object
30 31 32 |
# File 'lib/locale_setter/controller.rb', line 30 def i18n I18n end |
#locale_user ⇒ Object
25 26 27 28 |
# File 'lib/locale_setter/controller.rb', line 25 def locale_user current_user_method = LocaleSetter.config.current_user_method.to_sym send(current_user_method) if respond_to?(current_user_method) end |
#set_locale ⇒ Object
15 16 17 18 19 20 21 22 23 |
# File 'lib/locale_setter/controller.rb', line 15 def set_locale Generic.set_locale( i18n, {:params => params, :user => locale_user, :domain => request.domain, :env => request.env} ) end |