Created
February 9, 2012 14:23
-
-
Save brenes/1780304 to your computer and use it in GitHub Desktop.
set locale
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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