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

+31 -31
View File
@@ -2,56 +2,56 @@
<%= f.errors_summary %>
<div class="grid gap-4 sm:grid-cols-3">
<div>
<%= f.field :component_type_id, as: :select, label: "Type",
collection: ComponentType.ordered.map { [_1.name, _1.id] }, include_blank: "— Select —" %>
<%= text_field_tag :new_component_type, params[:new_component_type], class: "input mt-2", placeholder: "…or type a new one" %>
<%= f.field :component_type_id, as: :select, label: t(".type"),
collection: ComponentType.ordered.map { [_1.name, _1.id] }, include_blank: t(".select") %>
<%= text_field_tag :new_component_type, params[:new_component_type], class: "input mt-2", placeholder: t(".or_type_a_new_one") %>
</div>
<%= f.field :manufacturer, required: true %>
<%= f.field :model, required: true %>
<%= f.field :serial_number %>
<%= f.field :install_location, hint: "e.g. Left mag, #3 cylinder" %>
<%= f.field :install_location, hint: t(".e_g_left_mag_3") %>
<%= f.field :status, as: :select, collection: Component::STATUSES.invert %>
<%= f.field :parent_component_id, as: :select, label: "Parent component",
collection: [["— None —", nil]] + aircraft.components.where.not(id: component.id).includes(:component_type).map { [_1.to_s, _1.id] } %>
<%= f.field :parent_component_id, as: :select, label: t(".parent_component"),
collection: [[t(".none"), nil]] + aircraft.components.where.not(id: component.id).includes(:component_type).map { [_1.to_s, _1.id] } %>
</div>
<fieldset class="grid gap-4 sm:grid-cols-4">
<legend class="mb-2 text-sm font-semibold text-slate-900">Time</legend>
<legend class="mb-2 text-sm font-semibold text-slate-900"><%= t(".time") %></legend>
<%= f.field :date_in_service, as: :date, required: true %>
<%= f.field :hours_in_service, as: :number, step: 0.1, label: "Total time (hours)" %>
<%= f.field :overhaul_date, as: :date, label: "Last overhaul / service" %>
<%= f.field :hours_since_overhaul, as: :number, step: 0.1, label: "Hours since OH / service" %>
<%= f.field :overhaul_kind, as: :select, label: "Overhaul type", include_blank: "—", collection: Component::OVERHAUL_KINDS.invert,
wrapper: { class: "sm:col-span-2" }, hint: "For engines and propellers: printed in logbook entries as SMOH, SFOH or SNEW." %>
<%= f.field :hours_in_service, as: :number, step: 0.1, label: t(".total_time_hours") %>
<%= f.field :overhaul_date, as: :date, label: t(".last_overhaul_service") %>
<%= f.field :hours_since_overhaul, as: :number, step: 0.1, label: t(".hours_since_oh_service") %>
<%= f.field :overhaul_kind, as: :select, label: t(".overhaul_type"), include_blank: "—", collection: Component::OVERHAUL_KINDS.invert,
wrapper: { class: "sm:col-span-2" }, hint: t(".for_engines_and_propellers_printed") %>
</fieldset>
<fieldset class="grid gap-4 sm:grid-cols-3">
<legend class="mb-2 text-sm font-semibold text-slate-900">Limits</legend>
<%= f.field :replacement_hours, as: :number, label: "Replace every (hrs)" %>
<%= f.interval :replacement, label: "Replace every" %>
<%= f.field :replacement_from_install, as: :select, label: "Replacement counts from",
collection: [ [ "Last service", false ], [ "Installation (life limit)", true ] ],
hint: "Installation: for a part that's cleaned and reused but has a life limit (e.g. a reusable oil filter); only Replaced restarts it." %>
<%= f.field :replacement_critical, as: :checkbox, label: "Replacement critical", hint: "Overdue replacement or expiry grounds the aircraft (oil, filters, ELT battery…)." %>
<%= f.field :expires_on, as: :date, label: "Expires on",
hint: "The date marked on the part, e.g. an ELT battery's replacement date (14 CFR 91.207(c): also replace it after 1 hour of cumulative use)." %>
<%= f.field :tbo_hours, as: :number, label: "TBO (hrs)" %>
<%= f.interval :tbo, label: "TBO (calendar)" %>
<legend class="mb-2 text-sm font-semibold text-slate-900"><%= t(".limits") %></legend>
<%= f.field :replacement_hours, as: :number, label: t(".replace_every_hrs") %>
<%= f.interval :replacement, label: t(".replace_every") %>
<%= f.field :replacement_from_install, as: :select, label: t(".replacement_counts_from"),
collection: [ [ t(".last_service"), false ], [ t(".installation_life_limit"), true ] ],
hint: t(".installation_for_a_part_that") %>
<%= f.field :replacement_critical, as: :checkbox, label: t(".replacement_critical"), hint: t(".overdue_replacement_or_expiry_grounds") %>
<%= f.field :expires_on, as: :date, label: t(".expires_on"),
hint: t(".the_date_marked_on_the") %>
<%= f.field :tbo_hours, as: :number, label: t(".tbo_hrs") %>
<%= f.interval :tbo, label: t(".tbo_calendar") %>
<div class="space-y-2">
<%= f.field :tbo_critical, as: :checkbox, label: "Treat TBO as a hard limit",
hint: "Under Part 91, TBO is usually the manufacturer's recommendation, unless an AD or the Airworthiness Limitations make it mandatory." %>
<%= f.field :on_condition, as: :checkbox, label: "On condition (Part 91)",
hint: "Run past TBO based on condition: TBO is shown for reference, never as a limit (this overrides the hard limit)." %>
<%= f.field :tbo_critical, as: :checkbox, label: t(".treat_tbo_as_a_hard"),
hint: t(".under_part_91_tbo_is") %>
<%= f.field :on_condition, as: :checkbox, label: t(".on_condition_part_91"),
hint: t(".run_past_tbo_based_on") %>
</div>
<p class="hint sm:col-span-3">Recurring inspections of this part (e.g. a 500-hour magneto inspection) are set up on the Inspections tab and applied to it.</p>
<p class="hint sm:col-span-3"><%= t(".recurring_inspections_of_this_part") %></p>
</fieldset>
<%= f.field :notes, as: :textarea, rows: 3 %>
<div class="flex gap-2">
<%= f.submit component.new_record? ? "Add Component" : "Save" %>
<%= link_to "Cancel", aircraft_components_path(aircraft), class: "btn-secondary" %>
<%= f.submit component.new_record? ? t(".add_component") : t(".save") %>
<%= link_to t(".cancel"), aircraft_components_path(aircraft), class: "btn-secondary" %>
</div>
<% end %>
<% if component.persisted? %>
<div class="mt-4"><%= delete_button "Delete component", aircraft_component_path(aircraft, component), confirm: "Delete #{component} and its sub-components?" %></div>
<div class="mt-4"><%= delete_button t(".delete_component"), aircraft_component_path(aircraft, component), confirm: t(".delete_and_its_sub_components", component: component) %></div>
<% end %>
+1 -1
View File
@@ -1,3 +1,3 @@
<% content_for :title, "Edit Component" %>
<% content_for :title, t(".edit_component") %>
<%= render "shared/aircraft_header", aircraft: @aircraft %>
<%= render "form", aircraft: @aircraft, component: @component %>
+13 -13
View File
@@ -1,23 +1,23 @@
<% content_for :title, "#{@aircraft.tail_number} Components" %>
<% content_for :title, t(".components", tail_number: @aircraft.tail_number) %>
<%= render "shared/aircraft_header", aircraft: @aircraft %>
<section class="card">
<div class="card-header">
<h2 class="card-title">Components</h2>
<h2 class="card-title"><%= t(".components_2") %></h2>
<div class="flex items-center gap-3">
<%= link_to (@show_disposed ? "Hide disposed" : "Show disposed"),
<%= link_to (@show_disposed ? t(".hide_disposed") : t(".show_disposed")),
aircraft_components_path(@aircraft, disposed: (@show_disposed ? nil : 1)), class: "link text-sm" %>
<% if owner? %><%= link_to "+ Add Component", new_aircraft_component_path(@aircraft), class: "btn-primary" %><% end %>
<% if owner? %><%= link_to t(".add_component"), new_aircraft_component_path(@aircraft), class: "btn-primary" %><% end %>
</div>
</div>
<% if @rows.empty? %>
<%= empty_state "No components yet. Add the engine, propeller, oil filter, ELT battery, etc." %>
<%= empty_state t(".no_components_yet_add_the") %>
<% else %>
<div class="overflow-x-auto">
<table class="table">
<thead><tr>
<th>Component</th><th>Make / Model</th><th>Status</th>
<th class="text-right">In service</th><th class="text-right">Since OH/svc</th>
<th>Limit</th><th>Life</th><th></th>
<th><%= t(".component") %></th><th><%= t(".make_model") %></th><th><%= t(".status") %></th>
<th class="text-right"><%= t(".in_service") %></th><th class="text-right"><%= t(".since_oh_svc") %></th>
<th><%= t(".limit") %></th><th><%= t(".life") %></th><th></th>
</tr></thead>
<tbody>
<% @rows.each do |c, depth| %>
@@ -32,16 +32,16 @@
<td class="text-right tabular-nums"><%= hours(c.hours_since_overhaul) %></td>
<td class="text-xs text-slate-600">
<% if c.replacement_critical? && (c.replacement_hours || c.replacement_calendar?) %>
Replace: <%= [c.replacement_hours && "#{c.replacement_hours} h", c.replacement_interval_label].compact.join(" / ") %><%= " since installed" if c.replacement_from_install? %><br>
<%= t(".replace_html", interval: ([c.replacement_hours && "#{c.replacement_hours} h", c.replacement_interval_label].compact.join(" / ")), installed: (t(".since_installed") if c.replacement_from_install?)) %>
<% end %>
<% if c.tbo_critical? && c.tbo_hours %>TBO: <%= c.tbo_hours %> h<%= " (on condition)" if c.on_condition? %><br><% end %>
<% if c.expires_on %>Expires: <%= fmt_date(c.expires_on) %><% end %>
<% if c.tbo_critical? && c.tbo_hours %><%= t(".tbo_h_html", tbo_hours: c.tbo_hours, on_condition: (t(".on_condition") if c.on_condition?)) %><% end %>
<% if c.expires_on %><%= t(".expires_html", expires_on: (fmt_date(c.expires_on))) %><% end %>
</td>
<td><%= life_badge(c.life_status) %></td>
<td class="whitespace-nowrap text-right">
<% if owner? %>
<%= link_to "Edit", edit_aircraft_component_path(@aircraft, c), class: "btn-secondary btn-sm" %>
<%= link_to "Service", aircraft_component_path(@aircraft, c, anchor: "service"), class: "btn-secondary btn-sm" %>
<%= link_to t(".edit"), edit_aircraft_component_path(@aircraft, c), class: "btn-secondary btn-sm" %>
<%= link_to t(".service"), aircraft_component_path(@aircraft, c, anchor: "service"), class: "btn-secondary btn-sm" %>
<% end %>
</td>
</tr>
+1 -1
View File
@@ -1,3 +1,3 @@
<% content_for :title, "Add Component" %>
<% content_for :title, t(".add_component") %>
<%= render "shared/aircraft_header", aircraft: @aircraft %>
<%= render "form", aircraft: @aircraft, component: @component %>
+29 -29
View File
@@ -6,30 +6,30 @@
<h2 class="card-title"><%= @component %> <%= life_badge(@component.life_status) %></h2>
<% if owner? %>
<div class="flex gap-2">
<%= link_to "+ Sub-component", new_aircraft_component_path(@aircraft, parent_id: @component.id), class: "btn-secondary btn-sm" %>
<%= link_to "Edit", edit_aircraft_component_path(@aircraft, @component), class: "btn-secondary btn-sm" %>
<%= link_to t(".sub_component"), new_aircraft_component_path(@aircraft, parent_id: @component.id), class: "btn-secondary btn-sm" %>
<%= link_to t(".edit"), edit_aircraft_component_path(@aircraft, @component), class: "btn-secondary btn-sm" %>
</div>
<% end %>
</div>
<dl class="card-body grid grid-cols-2 gap-x-4 gap-y-2 text-sm sm:grid-cols-4">
<dt class="text-slate-500">Manufacturer</dt><dd><%= @component.manufacturer %></dd>
<dt class="text-slate-500">Model</dt><dd><%= @component.model %></dd>
<dt class="text-slate-500">Serial</dt><dd><%= @component.serial_number.presence || "—" %></dd>
<dt class="text-slate-500">Status</dt><dd><%= @component.status_label %></dd>
<dt class="text-slate-500">Parent</dt><dd><%= @component.parent_component ? link_to(@component.parent_component, aircraft_component_path(@aircraft, @component.parent_component), class: "link") : "—" %></dd>
<dt class="text-slate-500">Location</dt><dd><%= @component.install_location.presence || "—" %></dd>
<dt class="text-slate-500">In service since</dt><dd><%= fmt_date(@component.date_in_service) %></dd>
<dt class="text-slate-500">Last OH / service</dt><dd><%= fmt_date(@component.overhaul_date) %></dd>
<dt class="text-slate-500">Hours in service</dt><dd><%= hours(@component.hours_in_service) %></dd>
<dt class="text-slate-500">Since OH / service</dt><dd><%= hours(@component.hours_since_overhaul) %></dd>
<dt class="text-slate-500">TBO</dt><dd><%= @component.tbo_hours ? "#{@component.tbo_hours} h (#{hours(@component.hours_to_tbo)} remaining)" : "—" %></dd>
<dt class="text-slate-500">Replacement</dt><dd>
<%= [@component.replacement_hours && "#{@component.replacement_hours} h", @component.replacement_interval_label].compact.join(" / ").presence&.then { @component.replacement_from_install? ? "#{_1} since installed" : _1 } || "—" %>
<% if (d = @component.next_replacement_date) %><div class="text-xs text-slate-500">Next by <%= fmt_date(d) %></div><% end %>
<dt class="text-slate-500"><%= t(".manufacturer") %></dt><dd><%= @component.manufacturer %></dd>
<dt class="text-slate-500"><%= t(".model") %></dt><dd><%= @component.model %></dd>
<dt class="text-slate-500"><%= t(".serial") %></dt><dd><%= @component.serial_number.presence || "—" %></dd>
<dt class="text-slate-500"><%= t(".status") %></dt><dd><%= @component.status_label %></dd>
<dt class="text-slate-500"><%= t(".parent") %></dt><dd><%= @component.parent_component ? link_to(@component.parent_component, aircraft_component_path(@aircraft, @component.parent_component), class: "link") : "—" %></dd>
<dt class="text-slate-500"><%= t(".location") %></dt><dd><%= @component.install_location.presence || "—" %></dd>
<dt class="text-slate-500"><%= t(".in_service_since") %></dt><dd><%= fmt_date(@component.date_in_service) %></dd>
<dt class="text-slate-500"><%= t(".last_oh_service") %></dt><dd><%= fmt_date(@component.overhaul_date) %></dd>
<dt class="text-slate-500"><%= t(".hours_in_service") %></dt><dd><%= hours(@component.hours_in_service) %></dd>
<dt class="text-slate-500"><%= t(".since_oh_service") %></dt><dd><%= hours(@component.hours_since_overhaul) %></dd>
<dt class="text-slate-500"><%= t(".tbo") %></dt><dd><%= @component.tbo_hours ? t(".h_remaining", tbo_hours: @component.tbo_hours, hours_to_tbo: (hours(@component.hours_to_tbo))) : "—" %></dd>
<dt class="text-slate-500"><%= t(".replacement") %></dt><dd>
<%= [@component.replacement_hours && "#{@component.replacement_hours} h", @component.replacement_interval_label].compact.join(" / ").presence&.then { @component.replacement_from_install? ? t(".since_installed", interval: _1) : _1 } || "—" %>
<% if (d = @component.next_replacement_date) %><div class="text-xs text-slate-500"><%= t(".next_by_html", d: (fmt_date(d))) %></div><% end %>
</dd>
<dt class="text-slate-500">Flags</dt>
<dt class="text-slate-500"><%= t(".flags") %></dt>
<dd class="col-span-3 flex flex-wrap gap-1">
<% { tbo_critical: "TBO critical", replacement_critical: "Replacement critical", on_condition: "On condition" }.each do |flag, label| %>
<% { tbo_critical: t(".tbo_critical"), replacement_critical: t(".replacement_critical"), on_condition: t(".on_condition") }.each do |flag, label| %>
<% if @component.public_send("#{flag}?") %><span class="badge-blue"><%= label %></span><% end %>
<% end %>
</dd>
@@ -39,15 +39,15 @@
<% if owner? %>
<section class="card" id="service">
<div class="card-header"><h2 class="card-title">Service / Replace</h2></div>
<div class="card-header"><h2 class="card-title"><%= t(".service_replace") %></h2></div>
<%= form_with url: reset_service_aircraft_component_path(@aircraft, @component), method: :post, class: "card-body space-y-3",
data: { turbo_confirm: "Reset hours for #{@component}?" } do |f| %>
<p class="text-sm text-slate-600">Resets <strong>hours since overhaul</strong> to 0 and sets the service date to today.</p>
data: { turbo_confirm: t(".reset_hours_for", component: @component) } do |f| %>
<p class="text-sm text-slate-600"><%= t(".resets_hours_since_overhaul_to_html") %></p>
<label class="flex items-start gap-2 text-sm">
<%= f.check_box :reset_in_service, class: "mt-0.5 h-4 w-4" %>
<span>Part was physically <strong>replaced</strong> — also reset hours in service and in-service date.</span>
<span><%= t(".part_was_physically_replaced_also_html") %></span>
</label>
<%= f.submit "Record Service", class: "btn-primary" %>
<%= f.submit t(".record_service"), class: "btn-primary" %>
<% end %>
</section>
<% end %>
@@ -56,16 +56,16 @@
<% if @inspection_rows.any? || owner? %>
<section class="card mt-5" id="inspections">
<div class="card-header">
<h2 class="card-title">Inspections of this component</h2>
<% if owner? %><%= link_to "+ Inspection", new_aircraft_inspection_type_path(@aircraft, component_id: @component.id), class: "btn-secondary btn-sm" %><% end %>
<h2 class="card-title"><%= t(".inspections_of_this_component") %></h2>
<% if owner? %><%= link_to t(".inspection"), new_aircraft_inspection_type_path(@aircraft, component_id: @component.id), class: "btn-secondary btn-sm" %><% end %>
</div>
<% if @inspection_rows.any? %>
<table class="table">
<thead><tr><th>Inspection</th><th>Interval</th><th>Last done</th><th>Next due</th><th>Status</th></tr></thead>
<thead><tr><th><%= t(".inspection_2") %></th><th><%= t(".interval") %></th><th><%= t(".last_done") %></th><th><%= t(".next_due") %></th><th><%= t(".status") %></th></tr></thead>
<tbody>
<% @inspection_rows.each do |row| %>
<tr>
<td class="font-medium"><%= row.type.name %><%= tag.span(" advisory", class: "text-xs text-slate-500") if row.type.advisory? %></td>
<td class="font-medium"><%= row.type.name %><%= tag.span(t(".advisory"), class: "text-xs text-slate-500") if row.type.advisory? %></td>
<td class="text-xs"><%= row.type.interval_description %></td>
<td class="text-xs"><%= row.latest ? "#{fmt_date(row.latest.date)} @ #{hours(row.latest.hours_at_inspection)} h" : "—" %></td>
<td class="text-xs"><%= [row.next_due_date&.to_s, row.next_due_hours && "#{hours(row.next_due_hours)} h"].compact.join(" / ").presence || "—" %></td>
@@ -75,14 +75,14 @@
</tbody>
</table>
<% else %>
<p class="card-body text-sm text-slate-500">None. Add one for a recurring inspection of this part (e.g. a 500-hour magneto inspection); it's tracked on the Inspections tab and can be completed from a logbook entry.</p>
<p class="card-body text-sm text-slate-500"><%= t(".none_add_one_for_a") %></p>
<% end %>
</section>
<% end %>
<% if @squawks.any? %>
<section class="card mt-5">
<div class="card-header"><h2 class="card-title">Squawks on this component</h2></div>
<div class="card-header"><h2 class="card-title"><%= t(".squawks_on_this_component") %></h2></div>
<%= render "squawks/table", squawks: @squawks, aircraft: @aircraft %>
</section>
<% end %>