Files
rickyandClaude Opus 5.5 89ed0a76f9 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>
2026-11-13 22:08:20 -05:00

64 lines
4.4 KiB
ERB

<%# Flying metrics. "Flight time" = Hobbs where recorded, else tach. %>
<% periods = stats.periods %>
<div class="mb-5 grid grid-cols-2 gap-3 sm:gap-4 lg:grid-cols-4">
<% [ [ t(".past_30_days"), periods[0] ], [ t(".this_year"), periods[2] ], [ t(".past_12_months"), periods[1] ], [ t(".since", first_date: (fmt_date(stats.first_date))), periods[4] ] ].each do |title, p| %>
<section class="card p-3 sm:p-4">
<div class="text-xs font-medium uppercase tracking-wide text-slate-500"><%= title %></div>
<div class="mt-1 text-2xl font-semibold tabular-nums"><%= hours(p.flight) %> <span class="text-sm font-normal text-slate-500"><%= t(".hrs") %></span></div>
<div class="mt-1 text-xs text-slate-600"><%= t(".tach_gal_html", count: p.flights, tach: (hours(p.tach)), fuel: (number_with_delimiter(p.fuel))) %></div>
</section>
<% end %>
</div>
<div class="mb-5 grid gap-5 lg:grid-cols-3">
<section class="card lg:col-span-2">
<div class="card-header"><h2 class="card-title"><%= t(".flight_hours_by_month") %></h2>
<span class="text-xs text-slate-500"><%= t(".avg_hrs_month_over_the_html", monthly_average_past_year: (hours(stats.monthly_average_past_year))) %></span></div>
<div class="card-body">
<%= column_chart stats.flight_hours_by_month, height: "220px", colors: [ "#0369a1" ], ytitle: "hrs", library: { plugins: { legend: { display: false } } } %>
</div>
</section>
<section class="card">
<div class="card-header"><h2 class="card-title"><%= t(".totals") %></h2></div>
<dl class="card-body grid grid-cols-2 gap-x-3 gap-y-2 text-sm">
<dt class="text-slate-500"><%= t(".flights_logged") %></dt><dd class="text-right tabular-nums"><%= number_with_delimiter(stats.count) %></dd>
<dt class="text-slate-500"><%= t(".flight_time") %></dt><dd class="text-right tabular-nums"><%= t(".hrs_2_html", total_flight: (hours(stats.total_flight))) %></dd>
<dt class="text-slate-500"><%= t(".tach_time") %></dt><dd class="text-right tabular-nums"><%= t(".hrs_3_html", total_tach: (hours(stats.total_tach))) %></dd>
<dt class="text-slate-500"><%= t(".average_flight") %></dt><dd class="text-right tabular-nums"><%= t(".hrs_4_html", average_flight: (hours(stats.average_flight))) %></dd>
<dt class="text-slate-500"><%= t(".longest_flight") %></dt><dd class="text-right tabular-nums"><%= t(".hrs_5_html", longest_flight: (hours(stats.longest_flight))) %></dd>
<dt class="text-slate-500"><%= t(".fuel") %></dt><dd class="text-right tabular-nums"><%= t(".gal_html", total_fuel: (number_with_delimiter(stats.total_fuel))) %></dd>
<dt class="text-slate-500"><%= t(".fuel_burn") %></dt><dd class="text-right tabular-nums"><%= t(".gal_hr_html", gph: (stats.gph || "—")) %></dd>
<dt class="text-slate-500"><%= t(".airports_visited") %></dt><dd class="text-right tabular-nums"><%= stats.airports_visited %></dd>
</dl>
<% if stats.top_airports.any? %>
<div class="border-t border-slate-100 px-4 py-3 text-xs text-slate-600">
<span class="font-medium text-slate-700"><%= t(".most_visited") %></span>
<%= stats.top_airports.map { |code, n| "#{code} (#{n})" }.join(" · ") %>
</div>
<% end %>
</section>
</div>
<% if stats.by_year.size > 1 %>
<details class="card group mb-5">
<summary class="card-header cursor-pointer list-none [&::-webkit-details-marker]:hidden"><span class="card-title"><%= t(".by_year") %></span><span aria-hidden="true" class="text-slate-500 transition group-open:rotate-180">▾</span></summary>
<table class="table">
<thead><tr><th><%= t(".year") %></th><th class="text-right"><%= t(".flights") %></th><th class="text-right"><%= t(".flight_hrs") %></th><th class="text-right"><%= t(".tach_hrs") %></th><th class="text-right"><%= t(".fuel_gal") %></th><th class="text-right"><%= t(".avg_flight") %></th></tr></thead>
<tbody>
<% stats.by_year.each do |y| %>
<tr>
<td><%= y.label %></td>
<td class="text-right tabular-nums"><%= y.flights %></td>
<td class="text-right tabular-nums"><%= hours(y.flight) %></td>
<td class="text-right tabular-nums"><%= hours(y.tach) %></td>
<td class="text-right tabular-nums"><%= number_with_delimiter(y.fuel) %></td>
<td class="text-right tabular-nums"><%= y.flights.positive? ? hours(y.flight / y.flights) : "—" %></td>
</tr>
<% end %>
</tbody>
</table>
<p class="px-4 pb-3 hint"><%= t(".flight_time_is_hobbs_time") %></p>
</details>
<% end %>