class LanguageContext < Contexts::Base def key :lang end def constraints /ru|en/ end def default I18n.default_locale end def current I18n.locale end def apply(ctrl, value) I18n.locale = value || ctrl.params[key].presence || default end end