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

+12 -12
View File
@@ -13,21 +13,21 @@
<div class="mt-1 flex flex-wrap items-center gap-2 text-sm">
<%= airworthiness_badge(aw) %>
<%= aircraft_status_badge(aircraft) unless aircraft.status == "AVAILABLE" %>
<span class="text-slate-500">Tach <%= hours(aircraft.tach_time) %> · Hobbs <%= hours(aircraft.hobbs_time) %></span>
<span class="badge-gray" title="Your access to this aircraft"><%= (current_user.aircraft_roles.find_by(aircraft: aircraft)&.role || current_role).capitalize %></span>
<span class="text-slate-500"><%= t(".tach_hobbs_html", tach_time: (hours(aircraft.tach_time)), hobbs_time: (hours(aircraft.hobbs_time))) %></span>
<span class="badge-gray" title="<%= t(".your_access_to_this_aircraft") %>"><%= (current_user.aircraft_roles.find_by(aircraft: aircraft)&.role || current_role).capitalize %></span>
</div>
</div>
</div>
<div class="flex w-full gap-2 sm:w-auto [&>a]:flex-1 [&>a]:justify-center [&>a]:whitespace-nowrap max-sm:[&>a]:px-2 sm:[&>a]:flex-none">
<%= link_to "Log Flight", new_aircraft_flight_log_path(aircraft), class: "btn-primary" %>
<%= link_to "Report Squawk", new_aircraft_squawk_path(aircraft), class: "btn-secondary" %>
<%= link_to t(".log_flight"), new_aircraft_flight_log_path(aircraft), class: "btn-primary" %>
<%= link_to t(".report_squawk"), new_aircraft_squawk_path(aircraft), class: "btn-secondary" %>
<%= more_menu do %>
<%= link_to "Status report", aircraft_report_path(aircraft), class: "menu-item" %>
<%= link_to t(".status_report"), aircraft_report_path(aircraft), class: "menu-item" %>
<% if owner? %>
<%= link_to "Access & sharing", aircraft_aircraft_roles_path(aircraft), class: "menu-item" %>
<%= link_to "Edit aircraft", edit_aircraft_path(aircraft), class: "menu-item" %>
<%= link_to "Download .sam.zip", aircraft_export_path(aircraft), class: "menu-item", data: { turbo: false } %>
<%= link_to "Download records package", aircraft_records_package_path(aircraft), class: "menu-item", data: { turbo: false } %>
<%= link_to t(".access_sharing"), aircraft_aircraft_roles_path(aircraft), class: "menu-item" %>
<%= link_to t(".edit_aircraft"), edit_aircraft_path(aircraft), class: "menu-item" %>
<%= link_to t(".download_sam_zip"), aircraft_export_path(aircraft), class: "menu-item", data: { turbo: false } %>
<%= link_to t(".download_records_package"), aircraft_records_package_path(aircraft), class: "menu-item", data: { turbo: false } %>
<% end %>
<% end %>
</div>
@@ -37,17 +37,17 @@
<%# Phones: the current section, with every section a tap away. %>
<details class="relative mb-5 md:hidden" data-controller="dropdown" data-action="click@window->dropdown#closeOutside keydown.esc@window->dropdown#close">
<summary class="flex cursor-pointer list-none items-center justify-between rounded-md bg-surface px-4 py-3 font-medium shadow-sm ring-1 ring-slate-200 [&::-webkit-details-marker]:hidden">
<span><span class="text-xs font-normal text-slate-500">Section</span><br><%= current_tab&.first || "Choose a section" %></span>
<span><span class="text-xs font-normal text-slate-500"><%= t(".section") %></span><br><%= current_tab&.first || t(".choose_a_section") %></span>
<span aria-hidden="true" class="text-slate-500">▾</span>
</summary>
<nav class="absolute inset-x-0 z-30 mt-2 grid grid-cols-2 gap-1 rounded-md bg-surface p-2 shadow-lg ring-1 ring-slate-200" aria-label="Aircraft sections">
<nav class="absolute inset-x-0 z-30 mt-2 grid grid-cols-2 gap-1 rounded-md bg-surface p-2 shadow-lg ring-1 ring-slate-200" aria-label="<%= t(".aircraft_sections") %>">
<% tabs.each do |label, path, names| %>
<%= link_to label, path, class: [ "rounded px-3 py-2.5 text-sm hover:bg-slate-100", (names.include?(controller_name) ? "bg-slate-100 font-semibold text-sky-700" : "text-slate-700") ],
aria: { current: (names.include?(controller_name) ? "page" : nil) } %>
<% end %>
</nav>
</details>
<nav class="mb-5 hidden flex-wrap border-b border-slate-200 md:flex" aria-label="Aircraft sections">
<nav class="mb-5 hidden flex-wrap border-b border-slate-200 md:flex" aria-label="<%= t(".aircraft_sections") %>">
<% tabs.each do |label, path, names| %>
<%= nav_tab label, path, names.include?(controller_name) %>
<% end %>
@@ -1,7 +1,7 @@
<%# ADs and inspection types: which parts of THIS aircraft they apply to. %>
<fieldset>
<legend class="label">Applies to on <%= aircraft.tail_number %></legend>
<label class="flex items-center gap-2 text-sm"><%= check_box_tag :applies_to_airframe, "1", applies_to_airframe %> Airframe</label>
<legend class="label"><%= t(".applies_to_on_html", tail_number: aircraft.tail_number) %></legend>
<label class="flex items-center gap-2 text-sm"><%= t(".airframe_html", applies_to_airframe: (check_box_tag :applies_to_airframe, "1", applies_to_airframe)) %></label>
<% comps = aircraft.components.where.not(status: "DISPOSED").includes(:component_type) %>
<% if comps.any? %>
<div class="mt-1 grid gap-1 sm:grid-cols-2">
@@ -10,5 +10,5 @@
<% end %>
</div>
<% end %>
<p class="hint">Component-level items follow the component if it moves to another aircraft.</p>
<p class="hint"><%= t(".component_level_items_follow_the") %></p>
</fieldset>
+2 -2
View File
@@ -1,4 +1,4 @@
<footer class="mx-auto max-w-7xl px-4 pb-6 text-xs text-slate-500 print:hidden">
Provided as is, without warranty; not FAA-approved. Verifying that your use is legal and suitable is up to you.
<% if authenticated? %><%= link_to "Disclaimer", help_page_path("disclaimer"), class: "link" %><% end %>
<%= t(".provided_as_is_without_warranty") %>
<% if authenticated? %><%= link_to t(".disclaimer"), help_page_path("disclaimer"), class: "link" %><% end %>
</footer>
+2 -2
View File
@@ -1,6 +1,6 @@
<%# Oil & Fuel tab: consumption and oil analysis are two pages under one tab. %>
<nav class="mb-4 inline-flex rounded-md bg-surface p-1 text-sm shadow-sm ring-1 ring-slate-200" aria-label="Oil and fuel">
<% [ [ "Consumption", aircraft_consumable_records_path(aircraft), "consumable_records" ], [ "Oil analysis", aircraft_oil_analyses_path(aircraft), "oil_analyses" ] ].each do |label, path, name| %>
<nav class="mb-4 inline-flex rounded-md bg-surface p-1 text-sm shadow-sm ring-1 ring-slate-200" aria-label="<%= t(".oil_and_fuel") %>">
<% [ [ t(".consumption"), aircraft_consumable_records_path(aircraft), "consumable_records" ], [ t(".oil_analysis"), aircraft_oil_analyses_path(aircraft), "oil_analyses" ] ].each do |label, path, name| %>
<%= link_to label, path, class: [ "rounded px-3 py-1.5", (controller_name == name ? "bg-slate-100 font-semibold text-sky-700" : "text-slate-600 hover:text-slate-900") ],
aria: { current: (controller_name == name ? "page" : nil) } %>
<% end %>
+3 -3
View File
@@ -1,10 +1,10 @@
<%# "Sign as" picker for the current user's certificates (signer controller). %>
<%# t(".sign_as") picker for the current user's certificates (signer controller). %>
<% certificates = current_user.certificates.reject(&:expired?) %>
<% if certificates.any? %>
<div class="flex flex-wrap items-center gap-2 text-sm">
<%= label_tag :sign_as, "Sign as", class: "text-slate-600" %>
<%= label_tag :sign_as, t(".sign_as"), class: "text-slate-600" %>
<select id="sign_as" class="input w-auto" data-signer-target="choice" data-action="signer#fill">
<option value="">— Someone else —</option>
<option value=""><%= t(".someone_else") %></option>
<% certificates.each do |c| %>
<option value="<%= c.id %>" data-name="<%= current_user.display_name %>" data-kind="<%= c.kind %>" data-number="<%= c.number %>">
<%= current_user.display_name %>, <%= c.kind_label %> <%= c.number %></option>
+1 -1
View File
@@ -1,6 +1,6 @@
<%# Cycles System → Light → Dark. Icons are swapped by theme_controller.js. %>
<button type="button" data-controller="theme" data-action="theme#cycle"
class="rounded p-1 text-white/80 hover:bg-white/10 hover:text-white" title="Theme: System" aria-label="Theme: System">
class="rounded p-1 text-white/80 hover:bg-white/10 hover:text-white" title="<%= t(".theme_system") %>" aria-label="<%= t(".theme_system") %>">
<svg data-theme-icon="system" class="h-5 w-5" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" aria-hidden="true"><rect x="3" y="4" width="18" height="12" rx="2"/><path d="M8 20h8M12 16v4"/></svg>
<svg data-theme-icon="light" class="hidden h-5 w-5" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" aria-hidden="true"><circle cx="12" cy="12" r="4"/><path d="M12 2v2M12 20v2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M2 12h2M20 12h2M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4"/></svg>
<svg data-theme-icon="dark" class="hidden h-5 w-5" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" aria-hidden="true"><path d="M21 12.8A9 9 0 1 1 11.2 3a7 7 0 0 0 9.8 9.8z"/></svg>
+28 -28
View File
@@ -1,50 +1,50 @@
<% content_for :title, @aircraft.tail_number %>
<div class="mb-5 flex flex-wrap items-center justify-between gap-3">
<div class="flex items-center gap-3">
<% if @aircraft.picture.attached? %><%= image_tag rails_blob_path(@aircraft.picture, disposition: :inline), class: "h-16 w-16 rounded-md object-cover", alt: "Photo of #{@aircraft.tail_number}" %><% end %>
<% if @aircraft.picture.attached? %><%= image_tag rails_blob_path(@aircraft.picture, disposition: :inline), class: "h-16 w-16 rounded-md object-cover", alt: t(".photo_of", tail_number: @aircraft.tail_number) %><% end %>
<div>
<h1 class="text-2xl font-bold"><%= @aircraft.tail_number %> <span class="text-base font-normal text-slate-500"><%= [@aircraft.make, @aircraft.model].compact_blank.join(" ") %></span></h1>
<div class="mt-1 flex flex-wrap items-center gap-2 text-sm">
<%= airworthiness_badge(@airworthiness) %> <%= aircraft_status_badge(@aircraft) %>
<span class="text-slate-500">Tach <%= hours(@aircraft.tach_time) %> · Hobbs <%= hours(@aircraft.hobbs_time) %></span>
<span class="text-slate-500"><%= t(".tach_hobbs_html", tach_time: (hours(@aircraft.tach_time)), hobbs_time: (hours(@aircraft.hobbs_time))) %></span>
</div>
</div>
</div>
<span class="badge-gray">Shared view · <%= ShareToken::PRIVILEGES[@share.privilege] %></span>
<span class="badge-gray"><%= t(".shared_view_html", privilege: (ShareToken::PRIVILEGES[@share.privilege])) %></span>
</div>
<div class="space-y-5">
<section class="card">
<div class="card-header"><h2 class="card-title">Airworthiness</h2>
<div class="flex items-center gap-2"><% if @share.maintenance? %><%= link_to "Status report", shared_report_path(@share.token), class: "btn-secondary btn-sm" %><% end %><%= airworthiness_badge(@airworthiness, large: true) %></div></div>
<div class="card-header"><h2 class="card-title"><%= t(".airworthiness") %></h2>
<div class="flex items-center gap-2"><% if @share.maintenance? %><%= link_to t(".status_report"), shared_report_path(@share.token), class: "btn-secondary btn-sm" %><% end %><%= airworthiness_badge(@airworthiness, large: true) %></div></div>
<div class="card-body">
<% if @airworthiness.issues.empty? %><p class="text-sm text-emerald-700">Nothing overdue or due soon.</p><% else %>
<ul class="space-y-1 text-sm"><% @airworthiness.issues.each do |i| %><li><span class="<%= issue_badge_class(i) %>"><%= i.category %></span> <%= i.title %> <span class="text-xs text-slate-500"><%= i.description %></span></li><% end %></ul>
<% if @airworthiness.issues.empty? %><p class="text-sm text-emerald-700"><%= t(".nothing_overdue_or_due_soon") %></p><% else %>
<ul class="space-y-1 text-sm"><% @airworthiness.issues.each do |i| %><li><span class="<%= issue_badge_class(i) %>"><%= i.category_label %></span> <%= i.title %> <span class="text-xs text-slate-500"><%= i.description %></span></li><% end %></ul>
<% end %>
<p class="hint mt-3"><%= Airworthiness::DISCLAIMER %></p>
<p class="hint mt-3"><%= Airworthiness.disclaimer %></p>
</div>
</section>
<div class="grid gap-5 lg:grid-cols-2">
<section class="card">
<div class="card-header"><h2 class="card-title">Open Squawks</h2></div>
<div class="card-header"><h2 class="card-title"><%= t(".open_squawks") %></h2></div>
<% if @active_squawks.any? %>
<ul class="divide-y divide-slate-100"><% @active_squawks.each do |s| %><li class="px-4 py-2 text-sm"><%= squawk_priority_badge(s) %> <%= s.issue_reported %></li><% end %></ul>
<% else %><%= empty_state "None." %><% end %>
<% else %><%= empty_state t(".none") %><% end %>
</section>
<section class="card">
<div class="card-header"><h2 class="card-title">Consumption</h2></div>
<div class="card-header"><h2 class="card-title"><%= t(".consumption") %></h2></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 (recent)</div></div>
<div><div class="text-2xl font-semibold"><%= @fuel.recent || "—" %></div><div class="text-xs text-slate-500">Fuel gal/hr (recent)</div></div>
<div><div class="text-2xl font-semibold"><%= @oil.recent || "—" %></div><div class="text-xs text-slate-500"><%= t(".oil_hrs_qt_recent") %></div></div>
<div><div class="text-2xl font-semibold"><%= @fuel.recent || "—" %></div><div class="text-xs text-slate-500"><%= t(".fuel_gal_hr_recent") %></div></div>
</div>
</section>
</div>
<section class="card">
<div class="card-header"><h2 class="card-title">Components</h2></div>
<div class="card-header"><h2 class="card-title"><%= t(".components") %></h2></div>
<div class="overflow-x-auto"><table class="table">
<thead><tr><th>Component</th><th>Make / Model</th><th class="text-right">In service</th><th class="text-right">Since OH/svc</th><th>TBO</th><th>Life</th></tr></thead>
<thead><tr><th><%= t(".component") %></th><th><%= t(".make_model") %></th><th class="text-right"><%= t(".in_service") %></th><th class="text-right"><%= t(".since_oh_svc") %></th><th><%= t(".tbo") %></th><th><%= t(".life") %></th></tr></thead>
<tbody><% @components.each do |c| %><tr>
<td><%= c %></td><td><%= c.manufacturer %> <%= c.model %></td>
<td class="text-right"><%= hours(c.hours_in_service) %></td><td class="text-right"><%= hours(c.hours_since_overhaul) %></td>
@@ -54,24 +54,24 @@
<div class="grid gap-5 lg:grid-cols-2">
<section class="card">
<div class="card-header"><h2 class="card-title">Inspections</h2></div>
<div class="card-header"><h2 class="card-title"><%= t(".inspections") %></h2></div>
<table class="table"><tbody><% @inspection_rows.each do |r| %><tr>
<td><%= r.type.name %></td><td class="text-xs"><%= r.latest&.date || "—" %></td><td><%= compliance_badge(r.status) %></td></tr><% end %></tbody></table>
</section>
<section class="card">
<div class="card-header"><h2 class="card-title">ADs</h2></div>
<div class="card-header"><h2 class="card-title"><%= t(".ads") %></h2></div>
<table class="table"><tbody><% @ad_rows.each do |r| %><tr>
<td><%= ad_link(r.ad) %><div class="text-xs text-slate-500"><%= r.ad.short_description %></div></td><td class="text-xs"><%= r.latest&.date_complied || "—" %></td><td><%= compliance_badge(r.status) %></td></tr><% end %></tbody></table>
</section>
</div>
<% if @notes.any? %>
<section class="card"><div class="card-header"><h2 class="card-title">Notes</h2></div>
<section class="card"><div class="card-header"><h2 class="card-title"><%= t(".notes") %></h2></div>
<ul class="divide-y divide-slate-100"><% @notes.each do |n| %><li class="px-4 py-2 text-sm"><%= markdown n.text %><div class="text-xs text-slate-500"><%= fmt_date(n.created_at.to_date) %></div></li><% end %></ul></section>
<% end %>
<% if @documents.any? %>
<section class="card"><div class="card-header"><h2 class="card-title">Documents</h2></div>
<section class="card"><div class="card-header"><h2 class="card-title"><%= t(".documents") %></h2></div>
<ul class="divide-y divide-slate-100"><% @documents.each do |d| %><li class="px-4 py-2 text-sm">
<span class="font-medium"><%= d.name %></span> <span class="text-xs text-slate-500"><%= d.type_label %></span>
<div class="mt-1 flex flex-wrap gap-2"><% d.pages.each_with_index do |p, i| %><%= link_to "#{i + 1}. #{p.filename}", rails_blob_path(p, disposition: :inline), class: "link text-xs", target: "_blank" %><% end %></div>
@@ -79,25 +79,25 @@
<% end %>
<% if @share.maintenance? %>
<section class="card"><div class="card-header"><h2 class="card-title">Logbook</h2></div>
<section class="card"><div class="card-header"><h2 class="card-title"><%= t(".logbook") %></h2></div>
<% if @logbook.any? %><table class="table"><tbody><% @logbook.each do |e| %><tr>
<td class="whitespace-nowrap"><%= fmt_date(e.date) %></td><td><span class="badge-gray"><%= LogbookEntry::LOG_TYPES[e.log_type] %></span></td>
<td class="text-right"><%= hours(e.aircraft_hours_at_entry) %></td><td class="whitespace-pre-wrap text-xs"><%= e.text %></td><td class="text-xs"><%= e.signoff_person %></td></tr><% end %></tbody></table>
<% else %><%= empty_state "No entries." %><% end %></section>
<% else %><%= empty_state t(".no_entries") %><% end %></section>
<div class="grid gap-5 lg:grid-cols-2">
<section class="card"><div class="card-header"><h2 class="card-title">Inspection History</h2></div>
<section class="card"><div class="card-header"><h2 class="card-title"><%= t(".inspection_history") %></h2></div>
<table class="table"><tbody><% @inspection_history.each do |r| %><tr><td><%= fmt_date(r.date) %></td><td><%= r.inspection_type.name %></td><td class="text-right"><%= hours(r.hours_at_inspection) %></td></tr><% end %></tbody></table></section>
<section class="card"><div class="card-header"><h2 class="card-title">AD Compliance History</h2></div>
<section class="card"><div class="card-header"><h2 class="card-title"><%= t(".ad_compliance_history") %></h2></div>
<table class="table"><tbody><% @ad_history.each do |c| %><tr><td class="whitespace-nowrap"><%= fmt_date(c.date_complied) %></td><td><%= ad_link(c.airworthiness_directive) %><div class="text-xs text-slate-500"><%= c.airworthiness_directive.short_description %></div></td><td class="text-xs"><%= c.not_applicable? ? "N/A: " : "" %><%= c.compliance_notes %></td></tr><% end %></tbody></table></section>
</div>
<section class="card"><div class="card-header"><h2 class="card-title">Major Repairs & Alterations</h2></div>
<section class="card"><div class="card-header"><h2 class="card-title"><%= t(".major_repairs_alterations") %></h2></div>
<% if @major_records.any? %><table class="table"><tbody><% @major_records.each do |r| %><tr><td><%= fmt_date(r.date_performed) %></td><td><%= r.type_label %></td><td><%= r.title %><div class="text-xs text-slate-500"><%= r.description %></div></td><td class="text-xs"><%= r.stc_number %></td></tr><% end %></tbody></table>
<% else %><%= empty_state "None recorded." %><% end %></section>
<% else %><%= empty_state t(".none_recorded") %><% end %></section>
<section class="card"><div class="card-header"><h2 class="card-title">Resolved Squawks</h2></div>
<% if @resolved_squawks.any? %><ul class="divide-y divide-slate-100"><% @resolved_squawks.each do |s| %><li class="px-4 py-2 text-sm"><%= squawk_priority_badge(s) %> <%= s.issue_reported %> <span class="text-xs text-slate-500">resolved <%= fmt_date(s.resolved_at&.to_date) %></span></li><% end %></ul>
<% else %><%= empty_state "None." %><% end %></section>
<section class="card"><div class="card-header"><h2 class="card-title"><%= t(".resolved_squawks") %></h2></div>
<% if @resolved_squawks.any? %><ul class="divide-y divide-slate-100"><% @resolved_squawks.each do |s| %><li class="px-4 py-2 text-sm"><%= squawk_priority_badge(s) %> <%= s.issue_reported %> <span class="text-xs text-slate-500"><%= t(".resolved_html", to_date: (fmt_date(s.resolved_at&.to_date))) %></span></li><% end %></ul>
<% else %><%= empty_state t(".none") %><% end %></section>
<% end %>
</div>