mirror of
https://github.com/rickbarrette/simple-aircraft-manager-rails.git
synced 2026-11-17 23:50:36 -05:00
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:
1 parent
3f45b557c2
commit
89ed0a76f9
313 files changed
+6387
-2653
No files matched your search
@@ -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>
|
||||
Reference in new issue
Block a user