Module: LocaleSelector::ControllerInstanceMethods

Defined in:
lib/locale_selector.rb

Instance Method Summary collapse

Instance Method Details

#offered_localesObject

List of explicitely offered locales, as set during the initialization by #offer_locales



118
119
120
# File 'lib/locale_selector.rb', line 118

def offered_locales
  self.class.send :global_offered_locales
end

This helper saves the user locale selection in a cookie. You can adjust the cookie path during the initialization with #offer_locales, use the :lang_cookie_path option.



125
126
127
128
129
130
131
# File 'lib/locale_selector.rb', line 125

def save_cookie(requested_lang)
  cookies[:lang] = {
    :value => requested_lang,
    :expires => 1.month.from_now,
    :path => root_path
  }
end