Sha256: 12453d972854bc146e471b8721f08f28a47f589d7f605155e9fca56f31f93f9f

Contents?: true

Size: 1.4 KB

Versions: 23

Compression:

Stored size: 1.4 KB

Contents

<% tag ||= :div %>
<% css_class ||= "" %>
<% show_name ||= false %>
<% show_arrow ||= false %>

<%# if CONFIG[:allow_locale_change] %>
<% if system_locales.count > 1 %>
  
  <%= content_tag tag, class: "dropdown #{css_class}" do %>
    <a class="dropdown-toggle" data-toggle="dropdown" href="#">
      <%= flag() %> 
      <%#= t("language", locale: I18n.locale.to_s) if show_name %> 
      <%= get_system_locales.where(iso_code: I18n.locale.to_s).any? ? get_system_locales.where(iso_code: I18n.locale.to_s).first.natural_name : t("language", locale: I18n.locale.to_s) if show_name %>
      <%= raw('<b class="caret"></b>') if show_arrow %>
    </a>
    <ul class="dropdown-menu">
      <%# CONFIG[:app_locales].each do |lcl| %>
      <% if 3 == 4 %>
      <% system_locales.each do |lcl| %>
        <% if I18n.available_locales.include?(lcl.to_sym) %>
          <li>
            <a href="<%= change_locale_path(lcl, back: url_for(locale:nil)) %>"><%= flag(lcl) %> <%= t("language", locale: lcl) %></a>
          </li>
        <% end %>
      <% end %>
      <% end %>
      
      <% get_system_locales.each do |lcl| %>
        <% if I18n.available_locales.include?(lcl.iso_code.to_sym) %>
          <li>
            <a href="<%= change_locale_path(lcl.iso_code, back: url_for(locale:nil)) %>"><%= flag(lcl.iso_code) %> <%= lcl.natural_name %></a>
          </li>
        <% end %>
      <% end %>
    </ul>
  <% end %>
  
<% end %>

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
magic_locales-0.0.21 lib/app/views/magic_locales/_locale_switch.html.erb
magic_locales-0.0.20 lib/app/views/magic_locales/_locale_switch.html.erb
magic_locales-0.0.19 lib/app/views/magic_locales/_locale_switch.html.erb
magic_locales-0.0.18 lib/app/views/magic_locales/_locale_switch.html.erb
magic_locales-0.0.17 lib/app/views/magic_locales/_locale_switch.html.erb
magic_locales-0.0.17.beta2 lib/app/views/magic_locales/_locale_switch.html.erb
magic_locales-0.0.17.beta1 lib/app/views/magic_locales/_locale_switch.html.erb
magic_locales-0.0.16 lib/app/views/magic_locales/_locale_switch.html.erb
magic_locales-0.0.15 lib/app/views/magic_locales/_locale_switch.html.erb
magic_locales-0.0.14 lib/app/views/magic_locales/_locale_switch.html.erb
magic_locales-0.0.13 lib/app/views/magic_locales/_locale_switch.html.erb
magic_locales-0.0.12 lib/app/views/magic_locales/_locale_switch.html.erb
magic_locales-0.0.11 lib/app/views/magic_locales/_locale_switch.html.erb
magic_locales-0.0.10 lib/app/views/magic_locales/_locale_switch.html.erb
magic_locales-0.0.9 lib/app/views/magic_locales/_locale_switch.html.erb
magic_locales-0.0.8 lib/app/views/magic_locales/_locale_switch.html.erb
magic_locales-0.0.7 lib/app/views/magic_locales/_locale_switch.html.erb
magic_locales-0.0.6 lib/app/views/magic_locales/_locale_switch.html.erb
magic_locales-0.0.5 lib/app/views/magic_locales/_locale_switch.html.erb
magic_locales-0.0.4 lib/app/views/magic_locales/_locale_switch.html.erb