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,15 +1,15 @@
|
||||
<%= form_with model: [aircraft, record], class: "card card-body space-y-4 max-w-2xl" do |f| %>
|
||||
<%= f.errors_summary %>
|
||||
<div class="grid gap-4 sm:grid-cols-2">
|
||||
<%= f.field :record_type, as: :select, label: "Type", collection: ConsumableRecord::TYPES.invert %>
|
||||
<%= f.field :record_type, as: :select, label: t(".type"), collection: ConsumableRecord::TYPES.invert %>
|
||||
<%= f.field :date, as: :date %>
|
||||
<%= f.field :quantity_added, as: :number, step: 0.01, label: "Quantity added (qt / gal)" %>
|
||||
<%= f.field :level_after, as: :number, step: 0.01, label: "Level after" %>
|
||||
<%= f.field :consumable_type, label: "Product", placeholder: "Aeroshell W100 / 100LL" %>
|
||||
<%= f.field :flight_hours, as: :number, step: 0.1, label: "Tach at time of record" %>
|
||||
<%= f.field :quantity_added, as: :number, step: 0.01, label: t(".quantity_added_qt_gal") %>
|
||||
<%= f.field :level_after, as: :number, step: 0.01, label: t(".level_after") %>
|
||||
<%= f.field :consumable_type, label: t(".product"), placeholder: t(".aeroshell_w100_100ll") %>
|
||||
<%= f.field :flight_hours, as: :number, step: 0.1, label: t(".tach_at_time_of_record") %>
|
||||
</div>
|
||||
<%= f.field :notes, as: :textarea, rows: 2 %>
|
||||
<%= f.field :excluded_from_averages, as: :checkbox, label: "Exclude from averages", hint: "Use for oil changes: the quantity added is ignored in consumption rates." %>
|
||||
<div class="flex gap-2"><%= f.submit "Save" %><%= link_to "Cancel", aircraft_consumable_records_path(aircraft), class: "btn-secondary" %></div>
|
||||
<%= f.field :excluded_from_averages, as: :checkbox, label: t(".exclude_from_averages"), hint: t(".use_for_oil_changes_the") %>
|
||||
<div class="flex gap-2"><%= f.submit t(".save") %><%= link_to t(".cancel"), aircraft_consumable_records_path(aircraft), class: "btn-secondary" %></div>
|
||||
<% end %>
|
||||
<% if record.persisted? %><div class="mt-4"><%= delete_button "Delete record", aircraft_consumable_record_path(aircraft, record) %></div><% end %>
|
||||
<% if record.persisted? %><div class="mt-4"><%= delete_button t(".delete_record"), aircraft_consumable_record_path(aircraft, record) %></div><% end %>
|
||||
@@ -8,7 +8,7 @@
|
||||
<col class="w-28"><col class="w-24"><col class="w-24"><col class="w-24"><col><col class="w-24"><col><col class="w-20">
|
||||
</colgroup>
|
||||
<% if page == 1 %>
|
||||
<thead><tr><th>Date</th><th>Type</th><th class="text-right">Added</th><th class="text-right">Level after</th><th>Product</th><th class="text-right">Tach</th><th>Notes</th><th></th></tr></thead>
|
||||
<thead><tr><th><%= t(".date") %></th><th><%= t(".type") %></th><th class="text-right"><%= t(".added") %></th><th class="text-right"><%= t(".level_after") %></th><th><%= t(".product") %></th><th class="text-right"><%= t(".tach") %></th><th><%= t(".notes") %></th><th></th></tr></thead>
|
||||
<% end %>
|
||||
<tbody>
|
||||
<% records.each do |r| %>
|
||||
@@ -19,8 +19,8 @@
|
||||
<td class="text-right tabular-nums" data-label="Level after"><%= r.level_after ? "#{r.level_after} #{r.unit}" : "" %></td>
|
||||
<td class="truncate" data-label="Product"><%= r.consumable_type %></td>
|
||||
<td class="text-right tabular-nums" data-label="Tach"><%= hours(r.flight_hours) %></td>
|
||||
<td class="text-xs text-slate-500 break-words"><%= r.notes %><%= " (excluded from average)" if r.excluded_from_averages? %></td>
|
||||
<td class="text-right"><% if owner? %><%= link_to "Edit", edit_aircraft_consumable_record_path(@aircraft, r), class: "btn-secondary btn-sm" %><% end %></td>
|
||||
<td class="text-xs text-slate-500 break-words"><%= r.notes %><%= t(".excluded_from_average") if r.excluded_from_averages? %></td>
|
||||
<td class="text-right"><% if owner? %><%= link_to t(".edit"), edit_aircraft_consumable_record_path(@aircraft, r), class: "btn-secondary btn-sm" %><% end %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
@@ -29,7 +29,7 @@
|
||||
<% if more %>
|
||||
<%= turbo_frame_tag "consumable-records-#{page + 1}", src: aircraft_consumable_records_path(@aircraft, page: page + 1), loading: :lazy, target: "_top", class: "block" do %>
|
||||
<p class="px-4 py-4 text-center text-sm text-slate-500">
|
||||
Loading earlier records… <%= link_to "Load more", aircraft_consumable_records_path(@aircraft, page: page + 1), class: "link", data: { turbo_frame: "consumable-records-#{page + 1}" } %>
|
||||
<%= t(".loading_earlier_records_html", link: (link_to t(".load_more"), aircraft_consumable_records_path(@aircraft, page: page + 1), class: "link", data: { turbo_frame: "consumable-records-#{page + 1}" })) %>
|
||||
</p>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
@@ -1,24 +1,24 @@
|
||||
<% content_for :title, "#{@aircraft.tail_number} Oil & Fuel" %>
|
||||
<% content_for :title, t(".oil_fuel", tail_number: @aircraft.tail_number) %>
|
||||
<%= render "shared/aircraft_header", aircraft: @aircraft %>
|
||||
<%= render "shared/oil_subnav", aircraft: @aircraft %>
|
||||
<div class="grid gap-5 lg:grid-cols-2">
|
||||
<% [@oil, @fuel].each do |stats| %>
|
||||
<section class="card">
|
||||
<div class="card-header">
|
||||
<h2 class="card-title"><%= stats.oil? ? "Oil Consumption" : "Fuel Burn" %></h2>
|
||||
<%= link_to "+ Add #{stats.oil? ? 'Oil' : 'Fuel'}", new_aircraft_consumable_record_path(@aircraft, type: stats.record_type), class: "btn-secondary btn-sm" %>
|
||||
<h2 class="card-title"><%= stats.oil? ? t(".oil_consumption") : t(".fuel_burn") %></h2>
|
||||
<%= link_to t(stats.oil? ? ".add_oil" : ".add_fuel"), new_aircraft_consumable_record_path(@aircraft, type: stats.record_type), class: "btn-secondary btn-sm" %>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="mb-3 flex flex-wrap gap-x-6 gap-y-1 text-sm">
|
||||
<div><span class="text-2xl font-semibold"><%= stats.recent || "—" %></span> <span class="text-slate-500"><%= stats.metric_label %>, last ~<%= stats.recent_window_hours %> hrs</span></div>
|
||||
<div><span class="text-lg"><%= stats.lifetime || "—" %></span> <span class="text-slate-500">lifetime</span></div>
|
||||
<div><span class="text-2xl font-semibold"><%= stats.recent || "—" %></span> <span class="text-slate-500"><%= t(".last_hrs_html", metric_label: stats.metric_label, recent_window_hours: stats.recent_window_hours) %></span></div>
|
||||
<div><span class="text-lg"><%= stats.lifetime || "—" %></span> <span class="text-slate-500"><%= t(".lifetime") %></span></div>
|
||||
</div>
|
||||
<% if stats.points.size >= 2 %>
|
||||
<%= line_chart stats.chart_data, xtitle: "Tach hours", ytitle: stats.metric_label, height: "220px", curve: false, points: false,
|
||||
library: { scales: { x: { type: "linear" } } }, colors: [stats.oil? ? "#b45309" : "#0369a1"] %>
|
||||
<p class="hint">Rolling <%= stats.chart_window_hours %>-hour window: total <%= stats.oil? ? "oil" : "fuel" %> added ÷ hours flown, so partial fills average out.<%= " Higher is better." if stats.oil? %></p>
|
||||
<p class="hint"><%= t(".rolling_hour_window_total_added_html", chart_window_hours: stats.chart_window_hours, fuel: (stats.oil? ? "oil" : "fuel"), oil: (t(".higher_is_better") if stats.oil?)) %></p>
|
||||
<% else %>
|
||||
<%= empty_state "Not enough history yet (need more than #{stats.chart_window_hours} tach hours of records)." %>
|
||||
<%= empty_state t(".not_enough_history_yet_need", chart_window_hours: stats.chart_window_hours) %>
|
||||
<% end %>
|
||||
</div>
|
||||
</section>
|
||||
@@ -26,10 +26,10 @@
|
||||
</div>
|
||||
|
||||
<section class="card mt-5">
|
||||
<div class="card-header"><h2 class="card-title">Records</h2></div>
|
||||
<div class="card-header"><h2 class="card-title"><%= t(".records") %></h2></div>
|
||||
<% if @records.any? %>
|
||||
<%= render "consumable_records/records", records: @records, page: @page, more: @more %>
|
||||
<% else %>
|
||||
<%= empty_state "No oil or fuel records yet." %>
|
||||
<%= empty_state t(".no_oil_or_fuel_records") %>
|
||||
<% end %>
|
||||
</section>
|
||||
Reference in new issue
Block a user