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,11 +1,11 @@
|
||||
<%# Engine monitor recording: summary and charts. Locals: flight_log, recording, error %>
|
||||
<section class="card max-w-5xl" id="engine-data">
|
||||
<div class="card-header">
|
||||
<h2 class="card-title">Engine data</h2>
|
||||
<h2 class="card-title"><%= t(".engine_data") %></h2>
|
||||
<% if flight_log.engine_data.attached? %>
|
||||
<div class="flex items-center gap-2 text-xs">
|
||||
<%= link_to flight_log.engine_data.filename, rails_blob_path(flight_log.engine_data, disposition: :attachment), class: "link" %>
|
||||
<% if manage_engine_data? %><%= delete_button "Remove", engine_data_aircraft_flight_log_path(@aircraft, flight_log), confirm: "Remove the engine data file from this flight?" %><% end %>
|
||||
<% if manage_engine_data? %><%= delete_button t(".remove"), engine_data_aircraft_flight_log_path(@aircraft, flight_log), confirm: t(".remove_the_engine_data_file") %><% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
@@ -15,33 +15,33 @@
|
||||
<% egt, cht = recording.hottest(:egt), recording.hottest(:cht) %>
|
||||
<% tail = recording.metadata[:aircraft_id] %>
|
||||
<% if tail.present? && tail.upcase != @aircraft.tail_number.to_s.upcase %>
|
||||
<p class="border-b border-slate-100 bg-amber-50 px-4 py-2 text-xs text-amber-800">This recording is from <strong><%= tail %></strong>, not <%= @aircraft.tail_number %>.</p>
|
||||
<p class="border-b border-slate-100 bg-amber-50 px-4 py-2 text-xs text-amber-800"><%= t(".this_recording_is_from_not_html", tail: tail, tail_number: @aircraft.tail_number) %></p>
|
||||
<% end %>
|
||||
<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">Recorded</dt>
|
||||
<dd class="col-span-3"><%= recording.local(recording.started_at).strftime("%Y-%m-%d %H:%M") %>–<%= recording.local(recording.ended_at).strftime("%H:%M") %> monitor time
|
||||
<span class="text-xs text-slate-500">· <%= recording.format %><%= " flight ##{recording.metadata[:flight_number]}" if recording.metadata[:flight_number] %> · <%= number_with_delimiter(recording.samples) %> samples</span></dd>
|
||||
<dt class="text-slate-500">Engine run</dt><dd><%= recording.engine_start ? run_duration(recording.run_time) : "Engine not run" %></dd>
|
||||
<dt class="text-slate-500">Fuel burned</dt><dd><%= engine_value(recording.fuel_burned, "gal", precision: 1) %></dd>
|
||||
<dt class="text-slate-500">Tach</dt><dd class="tabular-nums"><%= hours_line.(:tach, 2) %></dd>
|
||||
<dt class="text-slate-500">Engine hrs</dt><dd class="tabular-nums"><%= hours_line.(:engine_hours, 2) %></dd>
|
||||
<% if (flt = recording.last(:flight_hours)) %><dt class="text-slate-500">Airborne</dt><dd><%= flt.zero? ? "No (ground run)" : "#{number_with_precision(flt, precision: 2)} hrs" %></dd><% end %>
|
||||
<dt class="text-slate-500"><%= t(".recorded") %></dt>
|
||||
<dd class="col-span-3"><%= t(".monitor_time_html", start: (recording.local(recording.started_at).strftime("%Y-%m-%d %H:%M")), end: (recording.local(recording.ended_at).strftime("%H:%M"))) %>
|
||||
<span class="text-xs text-slate-500"><%= t(".samples_html", file_format: recording.format, flight_number: (" flight ##{recording.metadata[:flight_number]}" if recording.metadata[:flight_number]), samples: (number_with_delimiter(recording.samples))) %></span></dd>
|
||||
<dt class="text-slate-500"><%= t(".engine_run") %></dt><dd><%= recording.engine_start ? run_duration(recording.run_time) : t(".engine_not_run") %></dd>
|
||||
<dt class="text-slate-500"><%= t(".fuel_burned") %></dt><dd><%= engine_value(recording.fuel_burned, "gal", precision: 1) %></dd>
|
||||
<dt class="text-slate-500"><%= t(".tach") %></dt><dd class="tabular-nums"><%= hours_line.(:tach, 2) %></dd>
|
||||
<dt class="text-slate-500"><%= t(".engine_hrs") %></dt><dd class="tabular-nums"><%= hours_line.(:engine_hours, 2) %></dd>
|
||||
<% if (flt = recording.last(:flight_hours)) %><dt class="text-slate-500"><%= t(".airborne") %></dt><dd><%= flt.zero? ? t(".no_ground_run") : "#{number_with_precision(flt, precision: 2)} hrs" %></dd><% end %>
|
||||
</dl>
|
||||
|
||||
<div class="overflow-x-auto border-t border-slate-100">
|
||||
<table class="table">
|
||||
<thead><tr><th>Peak (engine running)</th><th class="text-right">Value</th><th class="text-right">At</th></tr></thead>
|
||||
<thead><tr><th><%= t(".peak_engine_running") %></th><th class="text-right"><%= t(".value") %></th><th class="text-right"><%= t(".at") %></th></tr></thead>
|
||||
<tbody>
|
||||
<% peaks = [
|
||||
[ "RPM", recording.max(:rpm), "rpm" ],
|
||||
[ "Manifold pressure", recording.max(:map), "inHg", 1 ],
|
||||
[ (egt ? "EGT (cyl #{egt[:cylinder]})" : "EGT"), egt && [ egt[:value], egt[:at] ], "°F" ],
|
||||
[ (cht ? "CHT (cyl #{cht[:cylinder]})" : "CHT"), cht && [ cht[:value], cht[:at] ], "°F" ],
|
||||
[ t(".manifold_pressure"), recording.max(:map), "inHg", 1 ],
|
||||
[ (egt ? t(".egt_cyl", cylinder: (egt[:cylinder])) : "EGT"), egt && [ egt[:value], egt[:at] ], "°F" ],
|
||||
[ (cht ? t(".cht_cyl", cylinder: (cht[:cylinder])) : "CHT"), cht && [ cht[:value], cht[:at] ], "°F" ],
|
||||
[ "TIT", recording.max(:tit), "°F" ],
|
||||
[ "Oil temp", recording.max(:oil_t), "°F" ],
|
||||
[ "Oil pressure", recording.max(:oil_p), "psi" ],
|
||||
[ "Fuel flow", recording.max(:fuel_flow), "gph", 1 ],
|
||||
[ "Volts (low)", recording.min(:volts), "V", 1 ]
|
||||
[ t(".oil_temp"), recording.max(:oil_t), "°F" ],
|
||||
[ t(".oil_pressure"), recording.max(:oil_p), "psi" ],
|
||||
[ t(".fuel_flow"), recording.max(:fuel_flow), "gph", 1 ],
|
||||
[ t(".volts_low"), recording.min(:volts), "V", 1 ]
|
||||
].select { _2 } %>
|
||||
<% peaks.each do |label, (value, at), unit, places| %>
|
||||
<tr><td><%= label %></td><td class="text-right tabular-nums"><%= engine_value(value, unit, precision: places || 0) %></td>
|
||||
@@ -53,7 +53,7 @@
|
||||
|
||||
<div data-controller="engine-chart" data-engine-chart-url-value="<%= engine_data_aircraft_flight_log_path(@aircraft, flight_log, format: :json) %>"
|
||||
class="border-t border-slate-100">
|
||||
<p class="px-4 pt-3 text-xs text-slate-500">Click a chart to explore it: zoom into any part of the flight and read exact values.</p>
|
||||
<p class="px-4 pt-3 text-xs text-slate-500"><%= t(".click_a_chart_to_explore") %></p>
|
||||
<div class="grid gap-6 p-4 lg:grid-cols-2">
|
||||
<% engine_chart_groups(recording).each_with_index do |group, i| %>
|
||||
<% chart = engine_chart(recording, *group[:keys], ytitle: group[:unit], colors: group[:colors].many? ? group[:colors] : nil) %>
|
||||
@@ -64,39 +64,39 @@
|
||||
data-engine-chart-group-param="<%= i %>">
|
||||
<figcaption class="mb-1 flex items-center justify-between text-xs font-semibold text-slate-600">
|
||||
<%= group[:title] %>
|
||||
<span class="font-normal text-slate-400 group-hover:text-sky-700" aria-hidden="true">⤢ Explore</span>
|
||||
<span class="font-normal text-slate-400 group-hover:text-sky-700" aria-hidden="true"><%= t(".explore") %></span>
|
||||
</figcaption>
|
||||
<%= chart %>
|
||||
</figure>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<dialog data-engine-chart-target="dialog" aria-label="Engine data viewer"
|
||||
<dialog data-engine-chart-target="dialog" aria-label="<%= t(".engine_data_viewer") %>"
|
||||
class="m-auto h-dvh max-h-none w-screen max-w-none bg-surface p-0 text-slate-800 shadow-2xl backdrop:bg-black/60 sm:h-[min(52rem,94dvh)] sm:w-[min(80rem,96vw)] sm:rounded-lg"
|
||||
data-action="keydown->engine-chart#keydown close->engine-chart#closed">
|
||||
<div class="flex h-full flex-col">
|
||||
<div class="flex items-center gap-2 border-b border-slate-200 px-3 py-2">
|
||||
<div data-engine-chart-target="tabs" role="tablist" class="flex min-w-0 flex-1 gap-1 overflow-x-auto"></div>
|
||||
<button type="button" data-action="engine-chart#close" class="rounded px-2 py-1 text-lg leading-none text-slate-500 hover:bg-slate-100" aria-label="Close">✕</button>
|
||||
<button type="button" data-action="engine-chart#close" class="rounded px-2 py-1 text-lg leading-none text-slate-500 hover:bg-slate-100" aria-label="<%= t(".close") %>">✕</button>
|
||||
</div>
|
||||
<div class="flex flex-wrap items-center gap-2 px-4 py-2 text-xs text-slate-500">
|
||||
<span data-engine-chart-target="range" class="tabular-nums"></span>
|
||||
<span class="hidden sm:inline">· Drag across the chart to zoom in, double-click to reset.</span>
|
||||
<span class="sm:hidden">· Drag to zoom.</span>
|
||||
<span class="hidden sm:inline"><%= t(".drag_across_the_chart_to") %></span>
|
||||
<span class="sm:hidden"><%= t(".drag_to_zoom") %></span>
|
||||
<span class="ml-auto flex gap-2">
|
||||
<button type="button" data-engine-chart-target="zoomOut" data-action="engine-chart#zoomOut" class="btn-secondary btn-sm" disabled>Zoom out</button>
|
||||
<button type="button" data-engine-chart-target="reset" data-action="engine-chart#resetZoom" class="btn-secondary btn-sm" disabled>Reset zoom</button>
|
||||
<button type="button" data-engine-chart-target="zoomOut" data-action="engine-chart#zoomOut" class="btn-secondary btn-sm" disabled><%= t(".zoom_out") %></button>
|
||||
<button type="button" data-engine-chart-target="reset" data-action="engine-chart#resetZoom" class="btn-secondary btn-sm" disabled><%= t(".reset_zoom") %></button>
|
||||
</span>
|
||||
</div>
|
||||
<div class="relative min-h-0 flex-1 touch-none select-none px-2 sm:px-4" data-engine-chart-target="frame"
|
||||
data-action="pointerdown->engine-chart#dragStart pointermove->engine-chart#dragMove pointerup->engine-chart#dragEnd pointercancel->engine-chart#dragCancel dblclick->engine-chart#resetZoom">
|
||||
<canvas data-engine-chart-target="canvas"></canvas>
|
||||
<div data-engine-chart-target="selection" hidden class="pointer-events-none absolute border-x border-sky-500 bg-sky-500/15"></div>
|
||||
<p data-engine-chart-target="status" class="absolute inset-0 grid place-items-center text-sm text-slate-500">Loading…</p>
|
||||
<p data-engine-chart-target="status" class="absolute inset-0 grid place-items-center text-sm text-slate-500"><%= t(".loading") %></p>
|
||||
</div>
|
||||
<div class="max-h-[30%] overflow-auto border-t border-slate-200">
|
||||
<table class="table text-sm">
|
||||
<thead><tr><th>Series <span class="font-normal normal-case text-slate-500">(visible range)</span></th><th class="text-right">Min</th><th class="text-right">Avg</th><th class="text-right">Max</th></tr></thead>
|
||||
<thead><tr><th><%= t(".series") %> <span class="font-normal normal-case text-slate-500"><%= t(".visible_range") %></span></th><th class="text-right"><%= t(".min") %></th><th class="text-right"><%= t(".avg") %></th><th class="text-right"><%= t(".max") %></th></tr></thead>
|
||||
<tbody data-engine-chart-target="stats"></tbody>
|
||||
</table>
|
||||
</div>
|
||||
@@ -109,10 +109,10 @@
|
||||
|
||||
<% if manage_engine_data? && !flight_log.engine_data.attached? %>
|
||||
<%= form_with model: flight_log, url: engine_data_aircraft_flight_log_path(@aircraft, flight_log), method: :patch, class: "card-body flex flex-wrap items-end gap-3" do |f| %>
|
||||
<%= f.field :engine_data, as: :file, label: "Attach engine monitor data", hint: "CGR-30P / CGR-30C flight recording (.csv).", accept: ".csv,text/csv" %>
|
||||
<%= f.submit "Upload", class: "btn-secondary" %>
|
||||
<%= f.field :engine_data, as: :file, label: t(".attach_engine_monitor_data"), hint: t(".cgr_30p_cgr_30c_flight"), accept: ".csv,text/csv" %>
|
||||
<%= f.submit t(".upload"), class: "btn-secondary" %>
|
||||
<% end %>
|
||||
<% elsif !flight_log.engine_data.attached? %>
|
||||
<%= empty_state "No engine data for this flight." %>
|
||||
<%= empty_state t(".no_engine_data_for_this") %>
|
||||
<% end %>
|
||||
</section>
|
||||
Reference in new issue
Block a user