Skip to content

Commit d22c9f9

Browse files
committed
feat(i18n): extract all page strings to locale files
Extract ~200 hardcoded English strings from all 4 public pages into t() helper calls with nested YAML locale files per view. Handle JS progress text in checklist controller via Stimulus value. Restore shared footer partial renders that worktree agents reverted.
1 parent c8ec805 commit d22c9f9

10 files changed

Lines changed: 542 additions & 267 deletions

File tree

app/javascript/controllers/checklist_controller.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { Controller } from "@hotwired/stimulus"
22

33
export default class extends Controller {
44
static targets = ["item", "progress", "progressBar", "progressText"]
5+
static values = { progressTemplate: String }
56

67
connect() {
78
this.storageKey = "ruby-passport-checklist"
@@ -64,7 +65,9 @@ export default class extends Controller {
6465
this.progressBarTarget.style.width = `${percent}%`
6566
}
6667
if (this.hasProgressTextTarget) {
67-
this.progressTextTarget.textContent = `${checked} of ${total} completed`
68+
this.progressTextTarget.textContent = this.progressTemplateValue
69+
.replace('%{checked}', checked)
70+
.replace('%{total}', total)
6871
}
6972
}
7073
}

app/views/home/index.html.erb

Lines changed: 27 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<% content_for(:title) { "The Ruby Passport — Collect Memories from Ruby Events" } %>
1+
<% content_for(:title) { t('.title') } %>
22

33
<!-- Hero Section -->
44
<section class="min-h-[80vh] flex flex-col items-center justify-center px-6 py-16 bg-gradient-to-b from-slate-50 to-white">
@@ -14,7 +14,7 @@
1414
data-holographic-card-target="card"
1515
>
1616
<%= image_tag "the-passport.jpg",
17-
alt: "The Ruby Passport",
17+
alt: t('.hero.passport_alt'),
1818
class: "w-64 md:w-80 lg:w-96 rounded-lg"
1919
%>
2020
<div
@@ -26,19 +26,19 @@
2626

2727
<!-- Headline -->
2828
<h1 class="text-4xl md:text-5xl lg:text-6xl font-bold text-slate-800 mb-6 leading-tight">
29-
The Ruby Passport
29+
<%= t('.hero.heading') %>
3030
</h1>
3131

3232
<p class="text-xl md:text-2xl text-slate-600 max-w-2xl mx-auto mb-8 leading-relaxed">
33-
An in-real-life memorabilia that enables you to collect stamps and memories from the Ruby events you visit.
33+
<%= t('.hero.tagline') %>
3434
</p>
3535

3636
<!-- Status Callout -->
3737
<div class="status-callout inline-flex items-center gap-3 px-6 py-4 mb-8">
3838
<span class="text-2xl">🛠</span>
3939
<div class="text-left">
40-
<span class="font-semibold text-amber-800">Current status:</span>
41-
<span class="text-amber-700">We ordered another batch (1000 pieces) in January.</span>
40+
<span class="font-semibold text-amber-800"><%= t('.hero.status_label') %></span>
41+
<span class="text-amber-700"><%= t('.hero.status_message') %></span>
4242
</div>
4343
</div>
4444
</div>
@@ -48,18 +48,17 @@
4848
<section class="section-alternate py-20 px-6">
4949
<div class="max-w-3xl mx-auto">
5050
<h2 class="text-3xl md:text-4xl font-bold text-slate-800 text-center mb-12">
51-
How to use your Passport
51+
<%= t('.how_to_use.heading') %>
5252
</h2>
5353

5454
<div class="space-y-6">
5555
<!-- Step 1 -->
5656
<div class="step-card flex gap-5">
5757
<div class="step-number">1</div>
5858
<div>
59-
<h3 class="text-xl font-semibold text-slate-800 mb-2">Claim your passport</h3>
59+
<h3 class="text-xl font-semibold text-slate-800 mb-2"><%= t('.how_to_use.step1.title') %></h3>
6060
<p class="text-slate-600 leading-relaxed">
61-
When you first receive your Passport, scan the QR code or tap the tiny chip on the cover to claim it.
62-
You will be directed to <a href="https://rubyevents.org" class="text-[#9b1c31] hover:underline font-medium">rubyevents.org</a> where you can create your account or claim it to your existing one.
61+
<%= t('.how_to_use.step1.description_html') %>
6362
</p>
6463
</div>
6564
</div>
@@ -68,9 +67,9 @@
6867
<div class="step-card flex gap-5">
6968
<div class="step-number">2</div>
7069
<div>
71-
<h3 class="text-xl font-semibold text-slate-800 mb-2">Fill it with your information</h3>
70+
<h3 class="text-xl font-semibold text-slate-800 mb-2"><%= t('.how_to_use.step2.title') %></h3>
7271
<p class="text-slate-600 leading-relaxed">
73-
The next thing you should do is fill your passport with your data (real or not, we won't check).
72+
<%= t('.how_to_use.step2.description') %>
7473
</p>
7574
</div>
7675
</div>
@@ -79,10 +78,9 @@
7978
<div class="step-card flex gap-5">
8079
<div class="step-number">3</div>
8180
<div>
82-
<h3 class="text-xl font-semibold text-slate-800 mb-2">Add your photo</h3>
81+
<h3 class="text-xl font-semibold text-slate-800 mb-2"><%= t('.how_to_use.step3.title') %></h3>
8382
<p class="text-slate-600 leading-relaxed">
84-
The event where you received it might have the required infrastructure to take and print your photo. Go to the embassy booth to do that.
85-
They might also not have it, which is fine — organizing an event like that is a time-consuming task and the budget might not have been there.
83+
<%= t('.how_to_use.step3.description') %>
8684
</p>
8785
</div>
8886
</div>
@@ -91,9 +89,9 @@
9189
<div class="step-card flex gap-5">
9290
<div class="step-number">4</div>
9391
<div>
94-
<h3 class="text-xl font-semibold text-slate-800 mb-2">Add the event stamp</h3>
92+
<h3 class="text-xl font-semibold text-slate-800 mb-2"><%= t('.how_to_use.step4.title') %></h3>
9593
<p class="text-slate-600 leading-relaxed">
96-
The event might have one or more stamps for you. Get them all! 🙌
94+
<%= t('.how_to_use.step4.description') %>
9795
</p>
9896
</div>
9997
</div>
@@ -102,10 +100,9 @@
102100
<div class="step-card flex gap-5">
103101
<div class="step-number">5</div>
104102
<div>
105-
<h3 class="text-xl font-semibold text-slate-800 mb-2">Bring your Ruby Passport to all events</h3>
103+
<h3 class="text-xl font-semibold text-slate-800 mb-2"><%= t('.how_to_use.step5.title') %></h3>
106104
<p class="text-slate-600 leading-relaxed">
107-
Every event will have its own stamp and surprises for the Ruby Passport, so you better have it on you.
108-
Plus, you might even be able to connect with a few friends.
105+
<%= t('.how_to_use.step5.description') %>
109106
</p>
110107
</div>
111108
</div>
@@ -117,14 +114,14 @@
117114
<section class="py-20 px-6 bg-white">
118115
<div class="max-w-3xl mx-auto text-center">
119116
<h2 class="text-3xl md:text-4xl font-bold text-slate-800 mb-6">
120-
Are you an event organizer?
117+
<%= t('.organizer.heading') %>
121118
</h2>
122119
<p class="text-lg text-slate-600 mb-8 max-w-xl mx-auto">
123-
Get everything you need to bring the Ruby Passport experience to your event.
120+
<%= t('.organizer.description') %>
124121
</p>
125122
<a href="<%= organizer_path %>" class="btn-primary">
126123
<span>📂</span>
127-
Ruby Passport (organizer's guide)
124+
<%= t('.organizer.cta') %>
128125
</a>
129126
</div>
130127
</section>
@@ -133,7 +130,7 @@
133130
<section class="section-alternate py-20 px-6">
134131
<div class="max-w-4xl mx-auto">
135132
<h2 class="text-3xl md:text-4xl font-bold text-slate-800 text-center mb-12">
136-
Participating Events
133+
<%= t('.events.heading') %>
137134
</h2>
138135

139136
<div class="flex flex-wrap justify-center gap-3">
@@ -151,7 +148,7 @@
151148
<span class="event-badge">Hamburg on Ruby</span>
152149
<a href="https://rubycon.it/" class="event-badge" target="_blank" rel="noopener">Rubycon Italy</a>
153150
<a href="mailto:adrian@adrianthedev.com" class="event-badge bg-[#9b1c31] text-white border-[#9b1c31] hover:bg-[#7a1627]">
154-
✨ Your event here
151+
<%= t('.events.your_event') %>
155152
</a>
156153
</div>
157154
</div>
@@ -161,16 +158,16 @@
161158
<section class="py-20 px-6 bg-white">
162159
<div class="max-w-3xl mx-auto text-center">
163160
<p class="text-lg text-slate-500 mb-8">
164-
✨ Proudly brought to you by
161+
<%= t('.sponsors.brought_to_you') %>
165162
</p>
166163

167164
<div class="flex flex-wrap items-center justify-center gap-12">
168-
<a href="https://avohq.io" target="_blank" rel="noopener" class="sponsor-logo" title="The Ruby on Rails framework for building powerful admin interfaces">
169-
<%= image_tag "avo-logo-colored.png", alt: "Avo", class: "h-12 md:h-18" %>
165+
<a href="https://avohq.io" target="_blank" rel="noopener" class="sponsor-logo" title="<%= t('.sponsors.avo_title') %>">
166+
<%= image_tag "avo-logo-colored.png", alt: t('.sponsors.avo_alt'), class: "h-12 md:h-18" %>
170167
</a>
171168
<span class="text-slate-300">&</span>
172-
<a href="https://rubyevents.org" target="_blank" rel="noopener" class="sponsor-logo" title="On a mission to index all Ruby events">
173-
<%= image_tag "ruby-events-logo.png", alt: "RubyEvents.org", class: "h-12 md:h-22" %>
169+
<a href="https://rubyevents.org" target="_blank" rel="noopener" class="sponsor-logo" title="<%= t('.sponsors.ruby_events_title') %>">
170+
<%= image_tag "ruby-events-logo.png", alt: t('.sponsors.ruby_events_alt'), class: "h-12 md:h-22" %>
174171
</a>
175172
</div>
176173
</div>

0 commit comments

Comments
 (0)