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

+14 -15
View File
@@ -7,30 +7,29 @@
<%= f.field :serial_number %>
<%= f.field :purchased, as: :date %>
<%= f.field :status, as: :select, collection: Aircraft::STATUSES.invert %>
<%= f.field :icao_type, label: "ICAO type", placeholder: "C150", maxlength: 4, hint: "Type designator, used for AirTrail." %>
<%= f.field :icao_type, label: t(".icao_type"), placeholder: "C150", maxlength: 4, hint: t(".type_designator_used_for_airtrail") %>
</div>
<%= f.field :description, as: :textarea, rows: 3 %>
<div class="grid gap-4 sm:grid-cols-4">
<% if aircraft.new_record? %>
<%= f.field :tach_time, as: :number, step: 0.1, label: "Current tach" %>
<%= f.field :hobbs_time, as: :number, step: 0.1, label: "Current hobbs" %>
<%= f.field :tach_time, as: :number, step: 0.1, label: t(".current_tach") %>
<%= f.field :hobbs_time, as: :number, step: 0.1, label: t(".current_hobbs") %>
<% end %>
<%= f.field :tach_time_offset, as: :number, step: 0.1, hint: "Subtracted from tach for maintenance math (e.g. after a tach replacement)." %>
<%= f.field :hobbs_time_offset, as: :number, step: 0.1, hint: "The same, for Hobbs." %>
<%= f.field :tach_time_offset, as: :number, step: 0.1, hint: t(".subtracted_from_tach_for_maintenance") %>
<%= f.field :hobbs_time_offset, as: :number, step: 0.1, hint: t(".the_same_for_hobbs") %>
</div>
<%= f.field :time_basis, as: :select, label: "Maintenance clock", collection: Aircraft::TIME_BASES.invert,
hint: "The clock used as time in service for inspections, ADs and component times (14 CFR 1.1 defines it as takeoff to landing). " \
"Changing it doesn't convert hours already recorded against the other clock." %>
<%= f.field :time_basis, as: :select, label: t(".maintenance_clock"), collection: Aircraft::TIME_BASES.invert,
hint: t(".the_clock_used_as_time") %>
<% unless aircraft.new_record? %>
<p class="hint">To change hours use “Update Hours” on the overview, so component times stay in sync.</p>
<p class="hint"><%= t(".to_change_hours_use_update") %></p>
<% end %>
<%= f.field :picture, as: :file, accept: "image/*" %>
<%= f.field :electronic_records_since, as: :date, label: "Electronic records since", wrapper: { class: "max-w-xs" },
hint: "The date this app became the maintenance record. Earlier records stay in the paper logbooks (mark their scans as legacy records)." %>
<%= f.field :airworthiness_enforcement, as: :checkbox, label: "Enforce airworthiness",
hint: "Block flight logs and hours updates while the aircraft shows Grounded." %>
<%= f.field :electronic_records_since, as: :date, label: t(".electronic_records_since"), wrapper: { class: "max-w-xs" },
hint: t(".the_date_this_app_became") %>
<%= f.field :airworthiness_enforcement, as: :checkbox, label: t(".enforce_airworthiness"),
hint: t(".block_flight_logs_and_hours") %>
<div class="flex gap-2">
<%= f.submit aircraft.new_record? ? "Add Aircraft" : "Save" %>
<%= link_to "Cancel", aircraft.new_record? ? root_path : aircraft_path(aircraft), class: "btn-secondary" %>
<%= f.submit aircraft.new_record? ? t(".add_aircraft") : t(".save") %>
<%= link_to t(".cancel"), aircraft.new_record? ? root_path : aircraft_path(aircraft), class: "btn-secondary" %>
</div>
<% end %>
+11 -11
View File
@@ -1,8 +1,8 @@
<%# The most recent day's flying (Overview). %>
<section class="card">
<div class="card-header">
<h2 class="card-title">Last flight</h2>
<%= link_to "Flights →", aircraft_flight_logs_path(aircraft), class: "link text-sm" %>
<h2 class="card-title"><%= t(".last_flight") %></h2>
<%= link_to t(".flights"), aircraft_flight_logs_path(aircraft), class: "link text-sm" %>
</div>
<% if last_day %>
<% route = last_day.flat_map { [ _1.departure_location, _1.destination_location ] }.compact_blank.chunk_while { _1 == _2 }.map(&:first) %>
@@ -10,18 +10,18 @@
<% fuel_after = last_day.reverse.find(&:fuel_level_after)&.fuel_level_after %>
<% oil_after = last_day.reverse.find(&:oil_level_after)&.oil_level_after %>
<dl class="card-body grid grid-cols-[auto_1fr] gap-x-4 gap-y-1.5 text-sm">
<dt class="text-slate-500">Date</dt>
<dd><%= fmt_date(last_leg.date) %><%= " · #{pluralize(last_day.size, 'leg')}" if last_day.size > 1 %></dd>
<% if route.any? %><dt class="text-slate-500">Route</dt><dd><%= route.join(" → ") %></dd><% end %>
<dt class="text-slate-500">Flown</dt><dd><%= hours(last_day.sum { _1.tach_time.to_d }) %> hrs tach</dd>
<% if last_leg.tach_in %><dt class="text-slate-500">Ended at</dt><dd>Tach <%= hours(last_leg.tach_in) %><%= " · Hobbs #{hours(last_leg.hobbs_in)}" if last_leg.hobbs_in %></dd><% end %>
<% if fuel_after %><dt class="text-slate-500">Fuel after</dt><dd><%= number_with_precision(fuel_after, precision: 1, strip_insignificant_zeros: true) %> gal</dd><% end %>
<% if oil_after %><dt class="text-slate-500">Oil after</dt><dd><%= number_with_precision(oil_after, precision: 1, strip_insignificant_zeros: true) %> qt</dd><% end %>
<dt class="text-slate-500"><%= t(".date") %></dt>
<dd><%= fmt_date(last_leg.date) %><%= " · #{t("counts.leg", count: last_day.size)}" if last_day.size > 1 %></dd>
<% if route.any? %><dt class="text-slate-500"><%= t(".route") %></dt><dd><%= route.join(" → ") %></dd><% end %>
<dt class="text-slate-500"><%= t(".flown") %></dt><dd><%= t(".hrs_tach_html", hours: (hours(last_day.sum { _1.tach_time.to_d }))) %></dd>
<% if last_leg.tach_in %><dt class="text-slate-500"><%= t(".ended_at") %></dt><dd><%= t(".tach_html", tach_in: (hours(last_leg.tach_in)), hobbs_in: (t(".hobbs", hobbs_in: (hours(last_leg.hobbs_in))) if last_leg.hobbs_in)) %></dd><% end %>
<% if fuel_after %><dt class="text-slate-500"><%= t(".fuel_after") %></dt><dd><%= t(".gal_html", fuel: (number_with_precision(fuel_after, precision: 1, strip_insignificant_zeros: true))) %></dd><% end %>
<% if oil_after %><dt class="text-slate-500"><%= t(".oil_after") %></dt><dd><%= t(".qt_html", oil: (number_with_precision(oil_after, precision: 1, strip_insignificant_zeros: true))) %></dd><% end %>
<% if (notes = last_day.filter_map { _1.notes.presence }).any? %>
<dt class="text-slate-500">Notes</dt><dd class="whitespace-pre-line"><%= notes.join("\n") %></dd>
<dt class="text-slate-500"><%= t(".notes") %></dt><dd class="whitespace-pre-line"><%= notes.join("\n") %></dd>
<% end %>
</dl>
<% else %>
<%= empty_state "No flights logged yet." %>
<%= empty_state t(".no_flights_logged_yet") %>
<% end %>
</section>
+5 -5
View File
@@ -1,9 +1,9 @@
<% content_for :title, "Edit #{@aircraft.tail_number}" %>
<% content_for :title, t(".edit", tail_number: @aircraft.tail_number) %>
<%= render "shared/aircraft_header", aircraft: @aircraft %>
<%= render "form", aircraft: @aircraft %>
<div class="mt-6 max-w-3xl card card-body border-red-200">
<h2 class="font-semibold text-red-700">Danger zone</h2>
<p class="text-sm text-slate-600 mb-3">Deleting an aircraft removes all of its records, documents and history.</p>
<%= delete_button "Delete #{@aircraft.tail_number}", aircraft_path(@aircraft),
confirm: "Delete #{@aircraft.tail_number} and ALL its records? This cannot be undone.", class: "btn-danger" %>
<h2 class="font-semibold text-red-700"><%= t(".danger_zone") %></h2>
<p class="text-sm text-slate-600 mb-3"><%= t(".deleting_an_aircraft_removes_all") %></p>
<%= delete_button t(".delete", tail_number: @aircraft.tail_number), aircraft_path(@aircraft),
confirm: t(".delete_and_all_its_records", tail_number: @aircraft.tail_number), class: "btn-danger" %>
</div>
+9 -9
View File
@@ -1,16 +1,16 @@
<% content_for :title, "Fleet" %>
<% content_for :title, t(".fleet") %>
<div class="mb-5 flex items-center justify-between">
<h1 class="text-2xl font-bold tracking-tight">Fleet</h1>
<h1 class="text-2xl font-bold tracking-tight"><%= t(".fleet") %></h1>
<div class="flex gap-2">
<%= more_menu do %><%= link_to "Import from a .sam.zip archive", new_aircraft_import_path, class: "menu-item" %><% end %>
<%= link_to "+ Add Aircraft", new_aircraft_path, class: "btn-primary" %>
<%= more_menu do %><%= link_to t(".import_from_a_sam_zip"), new_aircraft_import_path, class: "menu-item" %><% end %>
<%= link_to t(".add_aircraft"), new_aircraft_path, class: "btn-primary" %>
</div>
</div>
<% if @aircraft_list.empty? %>
<div class="card card-body text-center">
<p class="text-slate-600">No aircraft yet.</p>
<p class="mt-3"><%= link_to "Add your first aircraft", new_aircraft_path, class: "btn-primary" %></p>
<p class="text-slate-600"><%= t(".no_aircraft_yet") %></p>
<p class="mt-3"><%= link_to t(".add_your_first_aircraft"), new_aircraft_path, class: "btn-primary" %></p>
</div>
<% else %>
<div class="grid gap-4 sm:grid-cols-2 lg:grid-cols-3">
@@ -19,7 +19,7 @@
<%= link_to aircraft_path(aircraft), class: "card block overflow-hidden transition hover:shadow-md" do %>
<div class="flex h-36 items-center justify-center bg-slate-200">
<% if aircraft.picture.attached? %>
<%= image_tag aircraft.picture, class: "h-full w-full object-cover", alt: "Photo of #{aircraft.tail_number}" %>
<%= image_tag aircraft.picture, class: "h-full w-full object-cover", alt: t(".photo_of", tail_number: aircraft.tail_number) %>
<% else %>
<span class="text-5xl text-slate-400" aria-hidden="true">✈</span>
<% end %>
@@ -33,7 +33,7 @@
<%= airworthiness_badge(aw) %>
</div>
<div class="mt-3 flex items-center justify-between text-sm text-slate-600">
<span>Tach <strong><%= hours(aircraft.tach_time) %></strong></span>
<span><%= t(".tach_html", tach_time: (hours(aircraft.tach_time))) %></span>
<%= aircraft_status_badge(aircraft) %>
</div>
<% if aw.issues.any? %>
@@ -41,7 +41,7 @@
<% aw.issues.first(3).each do |issue| %>
<li class="<%= issue_text_class(issue) %>">• <%= issue.title %></li>
<% end %>
<% if aw.issues.size > 3 %><li class="text-slate-500">+ <%= aw.issues.size - 3 %> more</li><% end %>
<% if aw.issues.size > 3 %><li class="text-slate-500"><%= t(".more_html", issues: (aw.issues.size - 3)) %></li><% end %>
</ul>
<% end %>
</div>
+2 -2
View File
@@ -1,3 +1,3 @@
<% content_for :title, "Add Aircraft" %>
<h1 class="mb-4 text-2xl font-bold">Add Aircraft</h1>
<% content_for :title, t(".add_aircraft") %>
<h1 class="mb-4 text-2xl font-bold"><%= t(".add_aircraft") %></h1>
<%= render "form", aircraft: @aircraft %>
+30 -30
View File
@@ -5,19 +5,19 @@
<div class="space-y-5 lg:col-span-2">
<section class="card">
<div class="card-header">
<h2 class="card-title">Airworthiness</h2>
<h2 class="card-title"><%= t(".airworthiness") %></h2>
<div class="flex items-center gap-2">
<%= link_to "Status report", aircraft_report_path(@aircraft), class: "btn-secondary btn-sm", title: "Printable maintenance status (91.417)" %>
<%= link_to t(".status_report"), aircraft_report_path(@aircraft), class: "btn-secondary btn-sm", title: t(".printable_maintenance_status_91_417") %>
</div>
</div>
<div class="card-body">
<% if @airworthiness.issues.empty? %>
<p class="text-sm text-emerald-700">Nothing overdue or due soon. All tracked ADs, inspections, components and squawks are current.</p>
<p class="text-sm text-emerald-700"><%= t(".nothing_overdue_or_due_soon") %></p>
<% else %>
<ul class="divide-y divide-slate-100">
<% @airworthiness.issues.each do |issue| %>
<li class="flex items-start gap-3 py-2">
<span class="<%= issue_badge_class(issue) %> mt-0.5"><%= issue.category %></span>
<span class="<%= issue_badge_class(issue) %> mt-0.5"><%= issue.category_label %></span>
<div>
<div class="text-sm font-medium"><%= issue.title %></div>
<div class="text-xs text-slate-500"><%= issue.description %></div>
@@ -27,46 +27,46 @@
</ul>
<% end %>
<% if @aircraft.airworthiness_enforcement? %>
<p class="hint mt-3">Airworthiness enforcement is on: flights and hours updates are blocked while the aircraft shows Grounded.</p>
<p class="hint mt-3"><%= t(".airworthiness_enforcement_is_on_flights") %></p>
<% end %>
<p class="hint mt-3"><%= Airworthiness::DISCLAIMER %></p>
<p class="hint mt-3"><%= Airworthiness.disclaimer %></p>
</div>
</section>
<section class="card">
<div class="card-header">
<h2 class="card-title">Active Squawks</h2>
<%= link_to "All squawks →", aircraft_squawks_path(@aircraft), class: "link text-sm" %>
<h2 class="card-title"><%= t(".active_squawks") %></h2>
<%= link_to t(".all_squawks"), aircraft_squawks_path(@aircraft), class: "link text-sm" %>
</div>
<% if @active_squawks.any? %>
<%= render "squawks/table", squawks: @active_squawks, aircraft: @aircraft %>
<% else %>
<%= empty_state "No open squawks." %>
<%= empty_state t(".no_open_squawks") %>
<% end %>
</section>
<section class="card">
<div class="card-header"><h2 class="card-title">Consumption</h2>
<%= link_to "Oil & fuel →", aircraft_consumable_records_path(@aircraft), class: "link text-sm" %></div>
<div class="card-header"><h2 class="card-title"><%= t(".consumption") %></h2>
<%= link_to t(".oil_fuel"), aircraft_consumable_records_path(@aircraft), class: "link text-sm" %></div>
<div class="card-body grid grid-cols-2 gap-4 text-center">
<div><div class="text-2xl font-semibold"><%= @oil.recent || "—" %></div><div class="text-xs text-slate-500">Oil, hrs/qt (last ~100 hrs)</div></div>
<div><div class="text-2xl font-semibold"><%= @fuel.recent || "—" %></div><div class="text-xs text-slate-500">Fuel burn, gal/hr (last ~50 hrs)</div></div>
<div><div class="text-2xl font-semibold"><%= @oil.recent || "—" %></div><div class="text-xs text-slate-500"><%= t(".oil_hrs_qt_last_100") %></div></div>
<div><div class="text-2xl font-semibold"><%= @fuel.recent || "—" %></div><div class="text-xs text-slate-500"><%= t(".fuel_burn_gal_hr_last") %></div></div>
</div>
</section>
</div>
<div class="space-y-5">
<section class="card">
<div class="card-header"><h2 class="card-title">Update Hours</h2></div>
<div class="card-header"><h2 class="card-title"><%= t(".update_hours") %></h2></div>
<%= form_with url: hours_aircraft_path(@aircraft), method: :patch, class: "card-body space-y-3" do |f| %>
<div class="grid grid-cols-2 gap-3">
<div><%= f.label :tach_time, "Tach", class: "label" %>
<div><%= f.label :tach_time, t(".tach"), class: "label" %>
<%= f.number_field :tach_time, value: @aircraft.tach_time, step: 0.1, class: "input", required: true %></div>
<div><%= f.label :hobbs_time, "Hobbs", class: "label" %>
<div><%= f.label :hobbs_time, t(".hobbs"), class: "label" %>
<%= f.number_field :hobbs_time, value: @aircraft.hobbs_time, step: 0.1, class: "input" %></div>
</div>
<p class="hint">Enter the current meter readings. The difference is applied to every in-service component. For a single flight, use <%= link_to "Log Flight", new_aircraft_flight_log_path(@aircraft), class: "link" %>.</p>
<%= f.submit "Update Hours", class: "btn-primary" %>
<p class="hint"><%= t(".enter_the_current_meter_readings_html", link: (link_to t(".log_flight"), new_aircraft_flight_log_path(@aircraft), class: "link")) %></p>
<%= f.submit t(".update_hours"), class: "btn-primary" %>
<% end %>
</section>
@@ -74,14 +74,14 @@
<section class="card">
<div class="card-header">
<h2 class="card-title">Details</h2>
<% if owner? %><%= link_to "Edit", edit_aircraft_path(@aircraft), class: "btn-secondary btn-sm" %><% end %>
<h2 class="card-title"><%= t(".details") %></h2>
<% if owner? %><%= link_to t(".edit"), edit_aircraft_path(@aircraft), class: "btn-secondary btn-sm" %><% end %>
</div>
<dl class="card-body grid grid-cols-2 gap-x-3 gap-y-2 text-sm">
<dt class="text-slate-500">Serial</dt><dd><%= @aircraft.serial_number.presence || "—" %></dd>
<dt class="text-slate-500">Purchased</dt><dd><%= fmt_date(@aircraft.purchased) %></dd>
<dt class="text-slate-500">Tach offset</dt><dd><%= hours(@aircraft.tach_time_offset) %></dd>
<dt class="text-slate-500">Hobbs offset</dt><dd><%= hours(@aircraft.hobbs_time_offset) %></dd>
<dt class="text-slate-500"><%= t(".serial") %></dt><dd><%= @aircraft.serial_number.presence || "—" %></dd>
<dt class="text-slate-500"><%= t(".purchased") %></dt><dd><%= fmt_date(@aircraft.purchased) %></dd>
<dt class="text-slate-500"><%= t(".tach_offset") %></dt><dd><%= hours(@aircraft.tach_time_offset) %></dd>
<dt class="text-slate-500"><%= t(".hobbs_offset") %></dt><dd><%= hours(@aircraft.hobbs_time_offset) %></dd>
</dl>
<% if @aircraft.description.present? %>
<p class="border-t border-slate-100 px-4 py-3 text-sm text-slate-600"><%= simple_format @aircraft.description %></p>
@@ -89,25 +89,25 @@
</section>
<section class="card">
<div class="card-header"><h2 class="card-title">Notes</h2>
<%= link_to "+ Add", new_aircraft_note_path(@aircraft), class: "btn-secondary btn-sm" %></div>
<div class="card-header"><h2 class="card-title"><%= t(".notes") %></h2>
<%= link_to t(".add"), new_aircraft_note_path(@aircraft), class: "btn-secondary btn-sm" %></div>
<% if @notes.any? %>
<ul class="divide-y divide-slate-100">
<% @notes.each do |note| %>
<li class="px-4 py-2 text-sm">
<div><%= markdown_excerpt note.text %></div>
<div class="text-xs text-slate-500"><%= note.user&.display_name %> · <%= time_ago_in_words(note.created_at) %> ago <%= "· public" if note.public? %></div>
<div class="text-xs text-slate-500"><%= t(".ago_html", display_name: note.user&.display_name, created_at: (time_ago_in_words(note.created_at)), public: (t(".public") if note.public?)) %></div>
</li>
<% end %>
</ul>
<% else %>
<%= empty_state "No notes." %>
<%= empty_state t(".no_notes") %>
<% end %>
</section>
<section class="card">
<div class="card-header"><h2 class="card-title">Recent Activity</h2>
<%= link_to "All →", aircraft_events_path(@aircraft), class: "link text-sm" %></div>
<div class="card-header"><h2 class="card-title"><%= t(".recent_activity") %></h2>
<%= link_to t(".all"), aircraft_events_path(@aircraft), class: "link text-sm" %></div>
<%= render "events/list", events: @recent_events %>
</section>
</div>