Skip to content

Instantly share code, notes, and snippets.

@brenes
Created February 9, 2012 14:23
Show Gist options
  • Select an option

  • Save brenes/1780304 to your computer and use it in GitHub Desktop.

Select an option

Save brenes/1780304 to your computer and use it in GitHub Desktop.
set locale
def set_locale
# Si estoy en NavItemsController, y el match se hace con *, el locale
# en realidad está en el primer item de nicetitles
if controller_name == "nav_items" &&
params[:nicetitles].present? &&
Settings.app.locales.keys.map(&:to_s).include?(params[:nicetitles].first)
I18n.locale = params[:nicetitles].shift
elsif params[:locale].present?
I18n.locale = params[:locale]
else
I18n.locale = Settings.app.base_language
end
@lang = I18n.locale
logger.debug("[neutrino] active locale = #{I18n.locale}")
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment