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,4 +1,4 @@
|
||||
<% content_for :title, "Import Preview" %>
|
||||
<% content_for :title, t(".import_preview") %>
|
||||
<%= render "shared/aircraft_header", aircraft: @aircraft %>
|
||||
<% rows = @import.rows %>
|
||||
<% problems = rows.select { _1.status.in?(%i[error warning]) } %>
|
||||
@@ -6,20 +6,20 @@
|
||||
|
||||
<section class="card mb-5">
|
||||
<div class="card-header">
|
||||
<h2 class="card-title">Preview: <%= @filename %></h2>
|
||||
<span class="text-xs text-slate-500">Columns found: <%= @import.columns.keys.map { _1.to_s.humanize }.join(", ") %></span>
|
||||
<h2 class="card-title"><%= t(".preview_html", filename: @filename) %></h2>
|
||||
<span class="text-xs text-slate-500"><%= t(".columns_found_html", columns: (@import.columns.keys.map { _1.to_s.humanize }.join(", "))) %></span>
|
||||
</div>
|
||||
<div class="card-body grid grid-cols-2 gap-4 text-center sm:grid-cols-5">
|
||||
<div><div class="text-2xl font-semibold"><%= @import.importable.size %></div><div class="text-xs text-slate-500">flights to import</div></div>
|
||||
<div><div class="text-2xl font-semibold"><%= hours(@import.total_tach_hours) %></div><div class="text-xs text-slate-500">tach hours</div></div>
|
||||
<div><div class="text-2xl font-semibold text-amber-700"><%= @import.count(:warning) %></div><div class="text-xs text-slate-500">warnings (imported)</div></div>
|
||||
<div><div class="text-2xl font-semibold text-red-700"><%= @import.count(:error) %></div><div class="text-xs text-slate-500">errors (skipped)</div></div>
|
||||
<div><div class="text-2xl font-semibold text-slate-500"><%= @import.count(:duplicate) %></div><div class="text-xs text-slate-500">already imported</div></div>
|
||||
<div><div class="text-2xl font-semibold"><%= @import.importable.size %></div><div class="text-xs text-slate-500"><%= t(".flights_to_import") %></div></div>
|
||||
<div><div class="text-2xl font-semibold"><%= hours(@import.total_tach_hours) %></div><div class="text-xs text-slate-500"><%= t(".tach_hours") %></div></div>
|
||||
<div><div class="text-2xl font-semibold text-amber-700"><%= @import.count(:warning) %></div><div class="text-xs text-slate-500"><%= t(".warnings_imported") %></div></div>
|
||||
<div><div class="text-2xl font-semibold text-red-700"><%= @import.count(:error) %></div><div class="text-xs text-slate-500"><%= t(".errors_skipped") %></div></div>
|
||||
<div><div class="text-2xl font-semibold text-slate-500"><%= @import.count(:duplicate) %></div><div class="text-xs text-slate-500"><%= t(".already_imported") %></div></div>
|
||||
</div>
|
||||
|
||||
<% if @import.importable.any? %>
|
||||
<%= form_with url: confirm_aircraft_flight_import_path(@aircraft), class: "space-y-3 border-t border-slate-100 p-4",
|
||||
data: { turbo_confirm: "Import #{@import.importable.size} flights?" } do |f| %>
|
||||
data: { turbo_confirm: t(".import_flights", importable: @import.importable.size) } do |f| %>
|
||||
<%= hidden_field_tag :token, @token %>
|
||||
<%= hidden_field_tag :filename, @filename %>
|
||||
<%= hidden_field_tag :starting_tach, @starting_tach %>
|
||||
@@ -27,35 +27,35 @@
|
||||
<% if last && last.tach_in > @aircraft.tach_time %>
|
||||
<label class="flex items-start gap-2 text-sm">
|
||||
<%= check_box_tag :update_aircraft_hours, "1", true, class: "mt-0.5 h-4 w-4" %>
|
||||
<span>Also update <%= @aircraft.tail_number %>'s tach from <%= hours(@aircraft.tach_time) %> to <strong><%= hours(last.tach_in) %></strong>
|
||||
<%= "and hobbs to #{hours(last.hobbs_in)}" if last.hobbs_in && last.hobbs_in >= @aircraft.hobbs_time %>.
|
||||
<span class="block text-xs text-slate-500">Works like a normal hours update: the difference (<%= hours(last.tach_in - @aircraft.tach_time) %> hrs) is added to in-service components. Leave unchecked if component times are already current.</span></span>
|
||||
<span><%= t(".also_update_s_tach_from_html", tail_number: @aircraft.tail_number, tach_time: (hours(@aircraft.tach_time)), tach_in: (hours(last.tach_in))) %>
|
||||
<%= t(".and_hobbs_to", hobbs_in: (hours(last.hobbs_in))) if last.hobbs_in && last.hobbs_in >= @aircraft.hobbs_time %>.
|
||||
<span class="block text-xs text-slate-500"><%= t(".works_like_a_normal_hours_html", tach_time: (hours(last.tach_in - @aircraft.tach_time))) %></span></span>
|
||||
</label>
|
||||
<% elsif last %>
|
||||
<p class="text-xs text-slate-500">The aircraft's tach (<%= hours(@aircraft.tach_time) %>) is already at or past the last reading (<%= hours(last.tach_in) %>), so its hours won't change.</p>
|
||||
<p class="text-xs text-slate-500"><%= t(".the_aircraft_s_tach_is_html", tach_time: (hours(@aircraft.tach_time)), tach_in: (hours(last.tach_in))) %></p>
|
||||
<% end %>
|
||||
<div class="flex gap-2">
|
||||
<%= f.submit "Import #{@import.importable.size} Flights", class: "btn-primary" %>
|
||||
<%= link_to "Upload a different file", new_aircraft_flight_import_path(@aircraft), class: "btn-secondary" %>
|
||||
<%= f.submit t(".import_flights_2", importable: @import.importable.size), class: "btn-primary" %>
|
||||
<%= link_to t(".upload_a_different_file"), new_aircraft_flight_import_path(@aircraft), class: "btn-secondary" %>
|
||||
</div>
|
||||
<% if @import.count(:error) > 0 %><p class="hint">Rows with errors are skipped. The next good row absorbs their time, so total hours stay correct. To include them, fix the spreadsheet and upload it again. Rows already imported are skipped automatically.</p><% end %>
|
||||
<% if @import.count(:error) > 0 %><p class="hint"><%= t(".rows_with_errors_are_skipped") %></p><% end %>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<p class="border-t border-slate-100 p-4 text-sm">Nothing to import. <%= link_to "Upload a different file", new_aircraft_flight_import_path(@aircraft), class: "link" %></p>
|
||||
<p class="border-t border-slate-100 p-4 text-sm"><%= t(".nothing_to_import_html", link: (link_to t(".upload_a_different_file"), new_aircraft_flight_import_path(@aircraft), class: "link")) %></p>
|
||||
<% end %>
|
||||
</section>
|
||||
|
||||
<% if problems.any? %>
|
||||
<section class="card mb-5">
|
||||
<div class="card-header"><h2 class="card-title">Rows needing attention</h2></div>
|
||||
<div class="card-header"><h2 class="card-title"><%= t(".rows_needing_attention") %></h2></div>
|
||||
<table class="table">
|
||||
<thead><tr><th>Row</th><th>Date</th><th>Route</th><th class="text-right">Tach</th><th>Issue</th></tr></thead>
|
||||
<thead><tr><th><%= t(".row") %></th><th><%= t(".date") %></th><th><%= t(".route") %></th><th class="text-right"><%= t(".tach") %></th><th><%= t(".issue") %></th></tr></thead>
|
||||
<tbody>
|
||||
<% problems.each do |r| %>
|
||||
<tr>
|
||||
<td><%= r.line %></td><td class="whitespace-nowrap"><%= r.date || "—" %></td>
|
||||
<td><%= [r.from, r.to].compact.join(" → ") %></td><td class="text-right"><%= r.tach_in %></td>
|
||||
<td><%= tag.span(r.status == :error ? "Skipped" : "Warning", class: r.status == :error ? "badge-red" : "badge-orange") %> <span class="text-xs"><%= r.messages.join("; ") %></span></td>
|
||||
<td><%= tag.span(r.status == :error ? t(".skipped") : t(".warning"), class: r.status == :error ? "badge-red" : "badge-orange") %> <span class="text-xs"><%= r.messages.join("; ") %></span></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
@@ -64,10 +64,10 @@
|
||||
<% end %>
|
||||
|
||||
<details class="card">
|
||||
<summary class="card-header cursor-pointer"><span class="card-title">All <%= rows.size %> rows</span></summary>
|
||||
<summary class="card-header cursor-pointer"><span class="card-title"><%= t(".all_rows_html", rows: rows.size) %></span></summary>
|
||||
<div class="overflow-x-auto">
|
||||
<table class="table">
|
||||
<thead><tr><th>Row</th><th>Date</th><th>From</th><th>To</th><th class="text-right">Tach</th><th class="text-right">Tach hrs</th><th class="text-right">Hobbs</th><th class="text-right">Hobbs hrs</th><th class="text-right">Oil</th><th class="text-right">Fuel</th><th></th></tr></thead>
|
||||
<thead><tr><th><%= t(".row") %></th><th><%= t(".date") %></th><th><%= t(".from") %></th><th><%= t(".to") %></th><th class="text-right"><%= t(".tach") %></th><th class="text-right"><%= t(".tach_hrs") %></th><th class="text-right"><%= t(".hobbs") %></th><th class="text-right"><%= t(".hobbs_hrs") %></th><th class="text-right"><%= t(".oil") %></th><th class="text-right"><%= t(".fuel") %></th><th></th></tr></thead>
|
||||
<tbody>
|
||||
<% rows.each do |r| %>
|
||||
<tr class="<%= 'opacity-50' unless r.importable? %>">
|
||||
|
||||
Reference in new issue
Block a user