Created
October 3, 2012 10:05
-
-
Save yctay/3826188 to your computer and use it in GitHub Desktop.
RefineryCMS frontend locale switcher
This file contains 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
<!-- Locale switchers, but presents all available locales as options, even the presently active one --> | |
<ul> | |
<% Refinery::I18n.config.frontend_locales.each do |locale| %> | |
<li> | |
<%= link_to "/#{locale.to_s + request.path}", {:title => Refinery::I18n.locales[locale]} do%> | |
<span><%= Refinery::I18n.locales[locale] %></span> | |
<% end -%> | |
</li> | |
<% end %> | |
</ul> |
This file contains 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
<!-- Locale switcher that only presents the non-active locale as an option, but requires you to code scenarios --> | |
<% if I18n.locale.to_s == 'en' %> | |
<%= link_to 'es'.upcase, refinery.url_for(params.merge(:locale => 'es')) %> | |
<% else %> | |
<%= link_to 'en'.upcase, refinery.url_for(params.merge(:locale => 'en')) %> | |
<% end %> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment