- Showing <%= @weather_arts.total_count %> weather arts
+ <%= "#{t("text.showing")} #{@weather_arts.total_count} #{t("text.weather_arts")} " %>
<% if @current_region %>
from <%= @current_region.name %>
<% end %>
@@ -154,7 +154,7 @@
<%= link_to city_weather_art_path(art.city, art),
class: "btn btn-primary btn-sm w-full" do %>
- View Details
+ <%= t("button.view_detail") %>
diff --git a/app/views/cities/_city.html.erb b/app/views/cities/_city.html.erb
index ca03e5b..f55851a 100644
--- a/app/views/cities/_city.html.erb
+++ b/app/views/cities/_city.html.erb
@@ -75,7 +75,7 @@
<%= link_to city_path(city),
class: "btn btn-primary btn-sm gap-2", data: { turbo_frame: "_top" } do %>
- View Details
+ <%= t("button.view_detail") %>
@@ -115,7 +115,7 @@
<%= link_to city_path(city),
class: "btn btn-primary btn-sm gap-2", data: { turbo_frame: "_top" } do %>
- View Details
+ <%= t("button.view_detail") %>
diff --git a/app/views/cities/_search_city.html.erb b/app/views/cities/_search_city.html.erb
index 1c72ed1..dafec9c 100644
--- a/app/views/cities/_search_city.html.erb
+++ b/app/views/cities/_search_city.html.erb
@@ -18,7 +18,7 @@
<%= f.text_field :query,
value: params[:query] ? URI.decode_www_form_component(params[:query]) : nil,
class: "w-full pl-12 pr-12 py-3 rounded-full bg-base-200/80 backdrop-blur border border-base-300 focus:outline-none focus:ring-2 focus:ring-primary/50 transition",
- placeholder: "Search cities...",
+ placeholder: t("text.search_cities"),
autocomplete: "off",
data: {
action: "input->search#submit",
diff --git a/app/views/cities/index.html.erb b/app/views/cities/index.html.erb
index ebd0048..1927c92 100644
--- a/app/views/cities/index.html.erb
+++ b/app/views/cities/index.html.erb
@@ -16,16 +16,16 @@
- Explore Cities
+ <%= t("cities.title") %>
- Discover AI-generated weather art from cities around the world
+ <%= t("arts.subtitle") %>
<% if featured_art %>
- Latest from
+ <%= t("text.latest_from") %>
<%= featured_art.city.name %> ,
<%= featured_art.city.country.name %>
•
@@ -50,7 +50,7 @@
- <%= @current_region&.name || 'All Regions' %>
+ <%= @current_region&.name || t("text.all_regions") %>
@@ -59,7 +59,7 @@
<%= link_to cities_path,
class: "#{@current_region ? '' : 'active'}" do %>
- All Regions
+ <%= t("text.all_regions") %>
<% end %>
diff --git a/app/views/cities/show.html.erb b/app/views/cities/show.html.erb
index ba4591d..9a9d992 100644
--- a/app/views/cities/show.html.erb
+++ b/app/views/cities/show.html.erb
@@ -16,7 +16,7 @@
- Back to Cities
+ <%= t("button.back_to_cities") %>
<% end %>
diff --git a/app/views/home/_arts.html.erb b/app/views/home/_arts.html.erb
index bb127f0..a8302ca 100644
--- a/app/views/home/_arts.html.erb
+++ b/app/views/home/_arts.html.erb
@@ -20,7 +20,7 @@
- <%= link_to "View Details", city_weather_art_path(art.city, art),
+ <%= link_to t("button.view_detail"), city_weather_art_path(art.city, art),
class: "btn btn-primary btn-outline" %>
diff --git a/app/views/home/index.html.erb b/app/views/home/index.html.erb
index 22b1e5c..3a05bf4 100644
--- a/app/views/home/index.html.erb
+++ b/app/views/home/index.html.erb
@@ -11,13 +11,12 @@
- Where Weather Meets Artificial Intelligence
+ <%= t("home.headline_html") %>
- Experience weather through the lens of AI-generated art,
- bringing a new perspective to daily meteorological phenomena.
+ <%= t("home.subtitle") %>
- <%= link_to "Explore Cities", cities_path,
+ <%= link_to t("button.explore_cities"), cities_path,
class: "btn btn-primary btn-lg mt-8 font-sans" %>
@@ -25,9 +24,9 @@
- Latest Weather Art
+ <%= t("title.latest_weather_art") %>
<%= render 'home/arts', arts: @latest_arts %>
- Popular Weather Art
+ <%= t("title.popular_weather_art") %>
<%= render 'home/arts', arts: @popular_arts %>
<%#= render 'home/arts', arts: @random_arts %>
@@ -35,7 +34,7 @@
<%= link_to arts_path, class: "btn btn-primary btn-lg gap-2" do %>
- View All Weather Arts
+ <%= t("button.view_all_weather_arts") %>
diff --git a/app/views/layouts/_navbar.html.erb b/app/views/layouts/_navbar.html.erb
index 47d4b86..fcb64ac 100644
--- a/app/views/layouts/_navbar.html.erb
+++ b/app/views/layouts/_navbar.html.erb
@@ -3,14 +3,14 @@
<%= link_to root_path, class: "text-xl md:text-2xl font-display font-bold hover:text-primary transition-colors" do %>
- Today AI Weather
+ <%= t('brand.name') %>
<% end %>
- <%= link_to "Cities", cities_path, class: "btn btn-ghost btn-sm font-sans" %>
- <%= link_to "Arts", arts_path, class: "btn btn-ghost btn-sm font-sans" %>
+ <%= link_to t("title.cities"), cities_path, class: "btn btn-ghost btn-sm font-sans" %>
+ <%= link_to t("title.arts"), arts_path, class: "btn btn-ghost btn-sm font-sans" %>
<% if user_signed_in? %>
@@ -27,12 +27,15 @@
<%= render 'layouts/user_menu' %>
+
+ <%= render 'shared/language_switcher' %>
<% else %>
<%= link_to new_user_session_path, class: "btn btn-primary btn-sm" do %>
-
Sign in
+
<%= t("title.sign_in") %>
+ <%= render 'shared/language_switcher' %>
<% end %>
<% end %>
@@ -46,8 +49,8 @@
- <%= link_to "Cities", cities_path %>
- <%= link_to "Arts", arts_path %>
+ <%= link_to t("title.cities"), cities_path %>
+ <%= link_to t("title.arts"), arts_path %>
<% if user_signed_in? %>
@@ -56,7 +59,7 @@
- Settings
+ <%= t("title.settings") %>
<% end %>
@@ -67,7 +70,7 @@
- Sign out
+ <% t("title.sign_out") %>
<% end %>
@@ -77,7 +80,7 @@
- Sign in
+ <%= t("title.sign_in") %>
<% end %>
<% end %>
diff --git a/app/views/layouts/_user_menu.html.erb b/app/views/layouts/_user_menu.html.erb
index 2b672ce..1e15b32 100644
--- a/app/views/layouts/_user_menu.html.erb
+++ b/app/views/layouts/_user_menu.html.erb
@@ -5,7 +5,7 @@
-
Settings
+
<%= t("title.settings") %>
<% end %>
@@ -15,7 +15,7 @@
-
Admin Dashboard
+
<%= t("title.admin_dashboard") %>
<% end %>
<% end %>
@@ -29,7 +29,7 @@
-
Sign out
+
<%= t("title.sign_out") %>
<% end %>
\ No newline at end of file
diff --git a/app/views/shared/_language_switcher.html.erb b/app/views/shared/_language_switcher.html.erb
new file mode 100644
index 0000000..373e85b
--- /dev/null
+++ b/app/views/shared/_language_switcher.html.erb
@@ -0,0 +1,17 @@
+
+
+ <% if I18n.locale.to_s == 'en' %>
+ 🇺🇸
+ <% else %>
+ 🇨🇳
+ <% end %>
+
+
+ <%= link_to url_for(locale: :en), class: "#{I18n.locale == :en ? 'active' : ''}" do %>
+ 🇺🇸 English
+ <% end %>
+ <%= link_to url_for(locale: :'zh-CN'), class: "#{I18n.locale == :'zh-CN' ? 'active' : ''}" do %>
+ 🇨🇳 简体中文
+ <% end %>
+
+
\ No newline at end of file
diff --git a/app/views/shared/_pagination.html.erb b/app/views/shared/_pagination.html.erb
index 58ec111..e0d9c62 100644
--- a/app/views/shared/_pagination.html.erb
+++ b/app/views/shared/_pagination.html.erb
@@ -78,9 +78,12 @@
- Showing <%= collection.offset_value + 1 %> to
- <%= collection.last_page? ? collection.total_count : collection.offset_value + collection.limit_value %>
- of <%= collection.total_count %> <%= collection_name || 'items' %>
+ <%= t('pagination.showing_items',
+ from: collection.offset_value + 1,
+ to: collection.last_page? ? collection.total_count : collection.offset_value + collection.limit_value,
+ total: collection.total_count,
+ items: t("pagination.items.#{collection_name}", default: t('pagination.items.default'))
+ ) %>
<% end %>
\ No newline at end of file
diff --git a/app/views/weather_arts/_card.html.erb b/app/views/weather_arts/_card.html.erb
index bead5f5..ac0743f 100644
--- a/app/views/weather_arts/_card.html.erb
+++ b/app/views/weather_arts/_card.html.erb
@@ -35,7 +35,7 @@
<%= link_to city_weather_art_path(weather_art.city, weather_art),
class: "btn btn-primary btn-block" do %>
- View Details
+ <%= t("button.view_detail") %>