- Introduced `TranslatableName` module to allow for localized names for `Country` and `Region` models. - Updated views to display `localized_name` instead of `name` for improved internationalization. - Refactored JSON serialization for `translations` attribute. - Enhanced localization support by adding new languages: Japanese and Korean, with updated locale files. - Removed outdated English and Chinese locales for countries and regions to clean up the codebase.
26 lines
1.3 KiB
Plaintext
26 lines
1.3 KiB
Plaintext
<%# app/views/shared/_language_switcher.html.erb %>
|
|
<div class="dropdown dropdown-end">
|
|
<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">
|
|
<%= link_to url_for(locale: :en), class: "px-4 py-2 hover:bg-base-200 rounded-lg #{I18n.locale == :en ? 'bg-base-200' : ''}" do %>
|
|
<%= t("language.en") %>
|
|
<% end %>
|
|
|
|
<%= link_to url_for(locale: :'zh-CN'), class: "px-4 py-2 hover:bg-base-200 rounded-lg #{I18n.locale == :'zh-CN' ? 'bg-base-200' : ''}" do %>
|
|
<%= t("language.zh-CN") %>
|
|
<% end %>
|
|
|
|
<%= link_to url_for(locale: :ja), class: "px-4 py-2 hover:bg-base-200 rounded-lg #{I18n.locale == :ja ? 'bg-base-200' : ''}" do %>
|
|
<%= t("language.ja") %>
|
|
<% end %>
|
|
|
|
<%= link_to url_for(locale: :ko), class: "px-4 py-2 hover:bg-base-200 rounded-lg #{I18n.locale == :ko ? 'bg-base-200' : ''}" do %>
|
|
<%= t("language.ko") %>
|
|
<% end %>
|
|
</ul>
|
|
</div> |