<%# app/views/shared/_language_switcher.html.erb %> <div class="dropdown dropdown-top"> <label tabindex="0" class="btn btn-ghost btn-sm"> <%= t("language.#{I18n.locale}") %> <svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4 ml-1" viewBox="0 0 20 20" fill="currentColor"> <path fill-rule="evenodd" d="M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z" clip-rule="evenodd" /> </svg> </label> <ul tabindex="0" class="dropdown-content menu p-2 shadow bg-base-100 rounded-box w-32"> <% [:en, :'zh-CN', :ja, :ko].each do |locale| %> <%= link_to url_for(locale: locale), class: "px-4 py-2 hover:bg-base-200 rounded-lg #{I18n.locale == locale ? 'bg-base-200' : ''}" do %> <%= t("language.#{locale}") %> <% end %> <% end %> </ul> </div>