Move all user-facing text into config/locales/en.yml for localization

- Views use lazy t(".key") lookups; sentences with values or links stay
  whole (interpolation, _html keys); counts use one/other plurals
- Stored-value labels (statuses, types, priorities...) are LabelSets read
  from labels: in the current locale; field names and validation messages
  under activerecord:; flash and activity text under flash:
- Services, models, helpers, mailer subjects, the logbook PDF, procedures
  templates, records package README and transcription warnings localized;
  the PDF reuses LogbookEntry#certification_statement instead of a copy
- Scripts read js: strings from a JSON tag via app/javascript/i18n.js
- Dates through I18n.l (app, weekday, month_year, long formats); html lang
  follows the locale
- APP_LOCALE picks the language (falls back to English); missing
  translations raise in development and tests
- README: Translating section and APP_LOCALE

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
rickyandClaude Opus 5.5 committed 2026-11-13 22:08:20 -05:00
1 parent 3f45b557c2
commit 89ed0a76f9
313 files changed
+6387 -2653

No files matched your search

@@ -6,7 +6,7 @@
<div class="grid gap-2 sm:grid-cols-2">
<% setup.stations.each do |st| %>
<label class="text-sm">
<span class="label"><%= st.name %> <span class="font-normal text-slate-500">· arm <%= st.arm %> in<%= ", max #{st.max.to_s.sub(/\.0\z/, '')} #{st.fuel ? 'gal' : 'lb'}" if st.max %></span></span>
<span class="label"><%= st.name %> <span class="font-normal text-slate-500"><%= t(".arm_in_html", arm: st.arm, max: (t(".max", max: (st.max.to_s.sub(/\.0\z/, '')), unit: (st.fuel ? t('.gal') : t('.lb'))) if st.max)) %></span></span>
<span class="flex items-center gap-2">
<input type="number" min="0" step="0.1" class="input" inputmode="decimal" data-wb-calculator-target="station"
data-arm="<%= st.arm.to_f %>" data-fuel="<%= st.fuel %>" data-max="<%= st.max.to_f %>" data-action="input->wb-calculator#update">
@@ -15,20 +15,20 @@
</label>
<% end %>
<% if setup.stations.any?(&:fuel) %>
<label class="text-sm"><span class="label">Fuel burned in flight</span>
<span class="flex items-center gap-2"><input type="number" min="0" step="0.1" class="input" inputmode="decimal" data-wb-calculator-target="burn" data-action="input->wb-calculator#update"><span class="w-6 text-xs text-slate-500">gal</span></span></label>
<label class="text-sm"><span class="label"><%= t(".fuel_burned_in_flight") %></span>
<span class="flex items-center gap-2"><input type="number" min="0" step="0.1" class="input" inputmode="decimal" data-wb-calculator-target="burn" data-action="input->wb-calculator#update"><span class="w-6 text-xs text-slate-500"><%= t(".gal") %></span></span></label>
<% end %>
</div>
<div class="grid items-start gap-3 sm:grid-cols-[1fr_auto]">
<table class="w-full text-sm table-keep">
<thead><tr class="text-left text-xs uppercase text-slate-500"><th></th><th class="text-right">Weight</th><th class="text-right">CG</th><th class="text-right">Moment</th></tr></thead>
<thead><tr class="text-left text-xs uppercase text-slate-500"><th></th><th class="text-right"><%= t(".weight") %></th><th class="text-right"><%= t(".cg") %></th><th class="text-right"><%= t(".moment") %></th></tr></thead>
<tbody>
<tr><td>Takeoff</td><td class="text-right tabular-nums" data-wb-calculator-target="takeoffWeight">—</td><td class="text-right tabular-nums" data-wb-calculator-target="takeoffCg">—</td><td class="text-right tabular-nums" data-wb-calculator-target="takeoffMoment">—</td></tr>
<tr><td>Landing</td><td class="text-right tabular-nums" data-wb-calculator-target="landingWeight">—</td><td class="text-right tabular-nums" data-wb-calculator-target="landingCg">—</td><td class="text-right tabular-nums" data-wb-calculator-target="landingMoment">—</td></tr>
<tr><td><%= t(".takeoff") %></td><td class="text-right tabular-nums" data-wb-calculator-target="takeoffWeight">—</td><td class="text-right tabular-nums" data-wb-calculator-target="takeoffCg">—</td><td class="text-right tabular-nums" data-wb-calculator-target="takeoffMoment">—</td></tr>
<tr><td><%= t(".landing") %></td><td class="text-right tabular-nums" data-wb-calculator-target="landingWeight">—</td><td class="text-right tabular-nums" data-wb-calculator-target="landingCg">—</td><td class="text-right tabular-nums" data-wb-calculator-target="landingMoment">—</td></tr>
</tbody>
</table>
<svg viewBox="0 0 220 160" class="h-40 w-56 rounded bg-slate-50" data-wb-calculator-target="chart" aria-label="CG envelope"></svg>
<svg viewBox="0 0 220 160" class="h-40 w-56 rounded bg-slate-50" data-wb-calculator-target="chart" aria-label="<%= t(".cg_envelope") %>"></svg>
</div>
<ul class="space-y-1 text-sm" data-wb-calculator-target="messages" role="status"></ul>
<p class="hint">A planning aid from the figures entered here. Check against the POH and the aircraft's current W&B report.</p>
<p class="hint"><%= t(".a_planning_aid_from_the") %></p>
</div>
+10 -10
View File
@@ -1,18 +1,18 @@
<%= form_with model: [aircraft, record], url: record.new_record? ? aircraft_weight_balance_records_path(aircraft) : aircraft_weight_balance_record_path(aircraft, record),
class: "card card-body space-y-4 max-w-2xl" do |f| %>
<%= f.errors_summary %>
<p class="text-sm text-slate-600">The figures from the weight & balance report: after weighing, or after an alteration or equipment change that changes the empty weight or CG.</p>
<p class="text-sm text-slate-600"><%= t(".the_figures_from_the_weight") %></p>
<div class="grid gap-4 sm:grid-cols-2">
<%= f.field :date, as: :date %>
<%= f.field :reason, placeholder: "e.g. Weighed at annual; GTX 345 installed" %>
<%= f.field :empty_weight, as: :number, step: 0.1, label: "Empty weight (lb)", required: true %>
<%= f.field :empty_arm, as: :number, step: 0.01, label: "Empty CG / arm (in aft of datum)", required: true %>
<%= f.field :max_gross_weight, as: :number, step: 0.1, label: "Max gross weight (lb)" %>
<%= f.field :major_record_id, as: :select, label: "Alteration (337)",
collection: [ [ "— None —", nil ] ] + aircraft.major_records.recent_first.map { [ "#{_1.date_performed} – #{_1.title.truncate(50)}", _1.id ] } %>
<%= f.field :document_id, as: :select, label: "W&B report document", collection: document_options(aircraft) %>
<%= f.field :reason, placeholder: t(".e_g_weighed_at_annual") %>
<%= f.field :empty_weight, as: :number, step: 0.1, label: t(".empty_weight_lb"), required: true %>
<%= f.field :empty_arm, as: :number, step: 0.01, label: t(".empty_cg_arm_in_aft"), required: true %>
<%= f.field :max_gross_weight, as: :number, step: 0.1, label: t(".max_gross_weight_lb") %>
<%= f.field :major_record_id, as: :select, label: t(".alteration_337"),
collection: [ [ t(".none"), nil ] ] + aircraft.major_records.recent_first.map { [ "#{_1.date_performed} – #{_1.title.truncate(50)}", _1.id ] } %>
<%= f.field :document_id, as: :select, label: t(".w_b_report_document"), collection: document_options(aircraft) %>
</div>
<%= f.field :notes, as: :textarea, rows: 2 %>
<div class="flex gap-2"><%= f.submit "Save" %><%= link_to "Cancel", aircraft_weight_balance_records_path(aircraft), class: "btn-secondary" %></div>
<div class="flex gap-2"><%= f.submit t(".save") %><%= link_to t(".cancel"), aircraft_weight_balance_records_path(aircraft), class: "btn-secondary" %></div>
<% end %>
<% if record.persisted? %><div class="mt-4"><%= delete_button "Delete record", aircraft_weight_balance_record_path(aircraft, record) %></div><% end %>
<% if record.persisted? %><div class="mt-4"><%= delete_button t(".delete_record"), aircraft_weight_balance_record_path(aircraft, record) %></div><% end %>
@@ -1,3 +1,3 @@
<% content_for :title, "#{@aircraft.tail_number} Weight & Balance" %>
<% content_for :title, t(".weight_balance", tail_number: @aircraft.tail_number) %>
<%= render "shared/aircraft_header", aircraft: @aircraft %>
<%= render "form", aircraft: @aircraft, record: @record %>
+20 -20
View File
@@ -1,62 +1,62 @@
<% content_for :title, "#{@aircraft.tail_number} Weight & Balance" %>
<% content_for :title, t(".weight_balance", tail_number: @aircraft.tail_number) %>
<%= render "shared/aircraft_header", aircraft: @aircraft %>
<% setup = @aircraft.loading_setup %>
<div class="grid gap-5 lg:grid-cols-2">
<section class="card">
<div class="card-header">
<h2 class="card-title">Current weight & balance</h2>
<% if owner? %><%= link_to "+ New W&B", new_aircraft_weight_balance_record_path(@aircraft), class: "btn-primary btn-sm" %><% end %>
<h2 class="card-title"><%= t(".current_weight_balance") %></h2>
<% if owner? %><%= link_to t(".new_w_b"), new_aircraft_weight_balance_record_path(@aircraft), class: "btn-primary btn-sm" %><% end %>
</div>
<% if @current %>
<dl class="card-body grid grid-cols-2 gap-x-4 gap-y-2 text-sm">
<dt class="text-slate-500">As of</dt><dd><%= fmt_date(@current.date) %><%= " · #{@current.reason}" if @current.reason.present? %></dd>
<dt class="text-slate-500">Empty weight</dt><dd class="font-medium"><%= number_with_precision(@current.empty_weight, precision: 1, delimiter: ",") %> lb</dd>
<dt class="text-slate-500">Empty CG (arm)</dt><dd class="font-medium"><%= number_with_precision(@current.empty_arm, precision: 2) %> in</dd>
<dt class="text-slate-500">Moment</dt><dd><%= number_with_precision(@current.empty_moment, precision: 0, delimiter: ",") %> lb-in</dd>
<dt class="text-slate-500">Max gross weight</dt><dd><%= @current.max_gross_weight ? "#{number_with_precision(@current.max_gross_weight, precision: 0, delimiter: ',')} lb" : "—" %></dd>
<dt class="text-slate-500">Useful load</dt><dd class="font-medium"><%= @current.useful_load ? "#{number_with_precision(@current.useful_load, precision: 1, delimiter: ',')} lb" : "—" %></dd>
<dt class="text-slate-500"><%= t(".as_of") %></dt><dd><%= fmt_date(@current.date) %><%= " · #{@current.reason}" if @current.reason.present? %></dd>
<dt class="text-slate-500"><%= t(".empty_weight") %></dt><dd class="font-medium"><%= t(".lb_html", delimiter: (number_with_precision(@current.empty_weight, precision: 1, delimiter: ","))) %></dd>
<dt class="text-slate-500"><%= t(".empty_cg_arm") %></dt><dd class="font-medium"><%= t(".in_html", precision: (number_with_precision(@current.empty_arm, precision: 2))) %></dd>
<dt class="text-slate-500"><%= t(".moment") %></dt><dd><%= t(".lb_in_html", delimiter: (number_with_precision(@current.empty_moment, precision: 0, delimiter: ","))) %></dd>
<dt class="text-slate-500"><%= t(".max_gross_weight") %></dt><dd><%= @current.max_gross_weight ? "#{number_with_precision(@current.max_gross_weight, precision: 0, delimiter: ',')} lb" : "—" %></dd>
<dt class="text-slate-500"><%= t(".useful_load") %></dt><dd class="font-medium"><%= @current.useful_load ? "#{number_with_precision(@current.useful_load, precision: 1, delimiter: ',')} lb" : "—" %></dd>
</dl>
<% else %>
<%= empty_state "No weight & balance recorded yet. Add the figures from the current W&B report." %>
<%= empty_state t(".no_weight_balance_recorded_yet") %>
<% end %>
</section>
<section class="card">
<div class="card-header">
<h2 class="card-title">Loading calculator</h2>
<% if owner? %><%= link_to "Loading setup", edit_aircraft_loading_setup_path(@aircraft), class: "btn-secondary btn-sm" %><% end %>
<h2 class="card-title"><%= t(".loading_calculator") %></h2>
<% if owner? %><%= link_to t(".loading_setup"), edit_aircraft_loading_setup_path(@aircraft), class: "btn-secondary btn-sm" %><% end %>
</div>
<% if @current && setup.configured? %>
<%= render "weight_balance_records/calculator", record: @current, setup: setup %>
<% elsif !@current %>
<%= empty_state "Record the current weight & balance first." %>
<%= empty_state t(".record_the_current_weight_balance") %>
<% else %>
<%= empty_state(owner? ? "Set up the loading stations and CG envelope from the POH to use the calculator." : "An owner needs to set up the loading stations first.") %>
<%= empty_state(owner? ? t(".set_up_the_loading_stations") : t(".an_owner_needs_to_set")) %>
<% end %>
</section>
</div>
<section class="card mt-5">
<div class="card-header"><h2 class="card-title">History</h2></div>
<div class="card-header"><h2 class="card-title"><%= t(".history") %></h2></div>
<% if @records.any? %>
<div class="overflow-x-auto">
<table class="table">
<thead><tr><th>Date</th><th class="text-right">Empty weight</th><th class="text-right">CG</th><th class="text-right">Useful load</th><th>Reason</th><th></th></tr></thead>
<thead><tr><th><%= t(".date") %></th><th class="text-right"><%= t(".empty_weight") %></th><th class="text-right"><%= t(".cg") %></th><th class="text-right"><%= t(".useful_load") %></th><th><%= t(".reason") %></th><th></th></tr></thead>
<tbody>
<% @records.each do |r| %>
<tr>
<td class="whitespace-nowrap"><%= fmt_date(r.date) %></td>
<td class="text-right tabular-nums"><%= number_with_precision(r.empty_weight, precision: 1, delimiter: ",") %> lb</td>
<td class="text-right tabular-nums"><%= number_with_precision(r.empty_arm, precision: 2) %> in</td>
<td class="text-right tabular-nums"><%= t(".lb_html", delimiter: (number_with_precision(r.empty_weight, precision: 1, delimiter: ","))) %></td>
<td class="text-right tabular-nums"><%= t(".in_html", precision: (number_with_precision(r.empty_arm, precision: 2))) %></td>
<td class="text-right tabular-nums"><%= r.useful_load ? "#{number_with_precision(r.useful_load, precision: 1, delimiter: ',')} lb" : "—" %></td>
<td class="text-xs"><%= r.reason %>
<% if r.major_record %><div><%= link_to r.major_record.title, aircraft_major_record_path(@aircraft, r.major_record), class: "link" %></div><% end %>
<% if r.document %><div><%= link_to "📄 #{r.document.name}", aircraft_document_path(@aircraft, r.document), class: "link" %></div><% end %></td>
<td class="text-right"><% if owner? %><%= link_to "Edit", edit_aircraft_weight_balance_record_path(@aircraft, r), class: "btn-secondary btn-sm" %><% end %></td>
<td class="text-right"><% if owner? %><%= link_to t(".edit"), edit_aircraft_weight_balance_record_path(@aircraft, r), class: "btn-secondary btn-sm" %><% end %></td>
</tr>
<% end %>
</tbody>
</table>
</div>
<% else %><%= empty_state "No records yet." %><% end %>
<% else %><%= empty_state t(".no_records_yet") %><% end %>
</section>
@@ -1,3 +1,3 @@
<% content_for :title, "#{@aircraft.tail_number} Weight & Balance" %>
<% content_for :title, t(".weight_balance", tail_number: @aircraft.tail_number) %>
<%= render "shared/aircraft_header", aircraft: @aircraft %>
<%= render "form", aircraft: @aircraft, record: @record %>