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,7 +1,7 @@
|
||||
<%= form_with model: [aircraft, record], class: "card card-body space-y-4 max-w-3xl" do |f| %>
|
||||
<%= f.errors_summary %>
|
||||
<div class="grid gap-4 sm:grid-cols-3">
|
||||
<%= f.field :record_type, as: :select, label: "Type", collection: MajorRecord::RECORD_TYPES.invert %>
|
||||
<%= f.field :record_type, as: :select, label: t(".type"), collection: MajorRecord::RECORD_TYPES.invert %>
|
||||
<%= f.field :date_performed, as: :date %>
|
||||
<%= f.field :aircraft_hours, as: :number, step: 0.1 %>
|
||||
</div>
|
||||
@@ -9,16 +9,16 @@
|
||||
<%= f.field :description, as: :textarea, rows: 4 %>
|
||||
<div class="grid gap-4 sm:grid-cols-2">
|
||||
<%= f.field :performed_by %>
|
||||
<%= f.field :component_id, as: :select, label: "Component", collection: component_options(aircraft) %>
|
||||
<%= f.field :form_337_document_id, as: :select, label: "Form 337 document", collection: document_options(aircraft) %>
|
||||
<%= f.field :logbook_entry_id, as: :select, label: "Logbook entry", collection: logbook_options(aircraft) %>
|
||||
<%= f.field :stc_number, label: "STC number" %>
|
||||
<%= f.field :stc_holder, label: "STC holder" %>
|
||||
<%= f.field :stc_document_id, as: :select, label: "STC document", collection: document_options(aircraft) %>
|
||||
<%= f.field :component_id, as: :select, label: t(".component"), collection: component_options(aircraft) %>
|
||||
<%= f.field :form_337_document_id, as: :select, label: t(".form_337_document"), collection: document_options(aircraft) %>
|
||||
<%= f.field :logbook_entry_id, as: :select, label: t(".logbook_entry"), collection: logbook_options(aircraft) %>
|
||||
<%= f.field :stc_number, label: t(".stc_number") %>
|
||||
<%= f.field :stc_holder, label: t(".stc_holder") %>
|
||||
<%= f.field :stc_document_id, as: :select, label: t(".stc_document"), collection: document_options(aircraft) %>
|
||||
</div>
|
||||
<%= f.field :has_ica, as: :checkbox, label: "Includes Instructions for Continued Airworthiness" %>
|
||||
<%= f.field :ica_notes, as: :textarea, rows: 2, label: "ICA notes" %>
|
||||
<%= f.field :has_ica, as: :checkbox, label: t(".includes_instructions_for_continued_airworthines") %>
|
||||
<%= f.field :ica_notes, as: :textarea, rows: 2, label: t(".ica_notes") %>
|
||||
<%= f.field :notes, as: :textarea, rows: 2 %>
|
||||
<div class="flex gap-2"><%= f.submit "Save" %><%= link_to "Cancel", aircraft_major_records_path(aircraft), class: "btn-secondary" %></div>
|
||||
<div class="flex gap-2"><%= f.submit t(".save") %><%= link_to t(".cancel"), aircraft_major_records_path(aircraft), class: "btn-secondary" %></div>
|
||||
<% end %>
|
||||
<% if record.persisted? %><div class="mt-4"><%= delete_button "Delete record", aircraft_major_record_path(aircraft, record) %></div><% end %>
|
||||
<% if record.persisted? %><div class="mt-4"><%= delete_button t(".delete_record"), aircraft_major_record_path(aircraft, record) %></div><% end %>
|
||||
@@ -1,13 +1,13 @@
|
||||
<% content_for :title, "#{@aircraft.tail_number} Major Records" %>
|
||||
<% content_for :title, t(".major_records", tail_number: @aircraft.tail_number) %>
|
||||
<%= render "shared/aircraft_header", aircraft: @aircraft %>
|
||||
<section class="card">
|
||||
<div class="card-header"><h2 class="card-title">Major Repairs & Alterations</h2>
|
||||
<div class="card-header"><h2 class="card-title"><%= t(".major_repairs_alterations") %></h2>
|
||||
<% if owner? %><div class="flex gap-2">
|
||||
<%= link_to "+ Repair", new_aircraft_major_record_path(@aircraft, type: "repair"), class: "btn-secondary" %>
|
||||
<%= link_to "+ Alteration", new_aircraft_major_record_path(@aircraft, type: "alteration"), class: "btn-primary" %></div><% end %></div>
|
||||
<%= link_to t(".repair"), new_aircraft_major_record_path(@aircraft, type: "repair"), class: "btn-secondary" %>
|
||||
<%= link_to t(".alteration"), new_aircraft_major_record_path(@aircraft, type: "alteration"), class: "btn-primary" %></div><% end %></div>
|
||||
<% if @records.any? %>
|
||||
<table class="table">
|
||||
<thead><tr><th>Date</th><th>Type</th><th>Title</th><th>Performed by</th><th>STC</th><th>ICA</th></tr></thead>
|
||||
<thead><tr><th><%= t(".date") %></th><th><%= t(".type") %></th><th><%= t(".title") %></th><th><%= t(".performed_by") %></th><th><%= t(".stc") %></th><th><%= t(".ica") %></th></tr></thead>
|
||||
<tbody>
|
||||
<% @records.each do |r| %>
|
||||
<tr>
|
||||
@@ -22,6 +22,6 @@
|
||||
</tbody>
|
||||
</table>
|
||||
<% else %>
|
||||
<%= empty_state "No major repairs or alterations recorded." %>
|
||||
<%= empty_state t(".no_major_repairs_or_alterations") %>
|
||||
<% end %>
|
||||
</section>
|
||||
@@ -1,36 +1,36 @@
|
||||
<%= render "shared/aircraft_header", aircraft: @aircraft %>
|
||||
<section class="card max-w-4xl">
|
||||
<div class="card-header"><h2 class="card-title"><%= @record.type_label %>: <%= @record.title %></h2>
|
||||
<% if owner? %><%= link_to "Edit", edit_aircraft_major_record_path(@aircraft, @record), class: "btn-secondary btn-sm" %><% end %></div>
|
||||
<% if owner? %><%= link_to t(".edit"), edit_aircraft_major_record_path(@aircraft, @record), class: "btn-secondary btn-sm" %><% end %></div>
|
||||
<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">Date</dt><dd><%= fmt_date(@record.date_performed) %></dd>
|
||||
<dt class="text-slate-500">Aircraft hours</dt><dd><%= hours(@record.aircraft_hours) %></dd>
|
||||
<dt class="text-slate-500">Performed by</dt><dd><%= @record.performed_by.presence || "—" %></dd>
|
||||
<dt class="text-slate-500">Component</dt><dd><%= @record.component || "—" %></dd>
|
||||
<dt class="text-slate-500">Form 337</dt><dd><%= @record.form_337_document ? link_to(@record.form_337_document.name, aircraft_document_path(@aircraft, @record.form_337_document), class: "link") : "—" %></dd>
|
||||
<dt class="text-slate-500">STC</dt><dd><%= [@record.stc_number, @record.stc_holder].compact_blank.join(" · ").presence || "—" %>
|
||||
<%= link_to("(docs)", aircraft_document_path(@aircraft, @record.stc_document), class: "link") if @record.stc_document %></dd>
|
||||
<dt class="text-slate-500">Logbook</dt><dd><%= @record.logbook_entry ? link_to(@record.logbook_entry.date, aircraft_logbook_entry_path(@aircraft, @record.logbook_entry), class: "link") : "—" %></dd>
|
||||
<dt class="text-slate-500">Weight & balance</dt>
|
||||
<dt class="text-slate-500"><%= t(".date") %></dt><dd><%= fmt_date(@record.date_performed) %></dd>
|
||||
<dt class="text-slate-500"><%= t(".aircraft_hours") %></dt><dd><%= hours(@record.aircraft_hours) %></dd>
|
||||
<dt class="text-slate-500"><%= t(".performed_by") %></dt><dd><%= @record.performed_by.presence || "—" %></dd>
|
||||
<dt class="text-slate-500"><%= t(".component") %></dt><dd><%= @record.component || "—" %></dd>
|
||||
<dt class="text-slate-500"><%= t(".form_337") %></dt><dd><%= @record.form_337_document ? link_to(@record.form_337_document.name, aircraft_document_path(@aircraft, @record.form_337_document), class: "link") : "—" %></dd>
|
||||
<dt class="text-slate-500"><%= t(".stc") %></dt><dd><%= [@record.stc_number, @record.stc_holder].compact_blank.join(" · ").presence || "—" %>
|
||||
<%= link_to(t(".docs"), aircraft_document_path(@aircraft, @record.stc_document), class: "link") if @record.stc_document %></dd>
|
||||
<dt class="text-slate-500"><%= t(".logbook") %></dt><dd><%= @record.logbook_entry ? link_to(@record.logbook_entry.date, aircraft_logbook_entry_path(@aircraft, @record.logbook_entry), class: "link") : "—" %></dd>
|
||||
<dt class="text-slate-500"><%= t(".weight_balance") %></dt>
|
||||
<dd>
|
||||
<% if (wb = @aircraft.weight_balance_records.where(major_record: @record).recent_first.first) %>
|
||||
<%= link_to "#{fmt_date(wb.date)}: #{number_with_precision(wb.empty_weight, precision: 1)} lb @ #{number_with_precision(wb.empty_arm, precision: 2)} in", aircraft_weight_balance_records_path(@aircraft), class: "link" %>
|
||||
<%= link_to t(".lb_in", date: fmt_date(wb.date), weight: number_with_precision(wb.empty_weight, precision: 1), arm: number_with_precision(wb.empty_arm, precision: 2)), aircraft_weight_balance_records_path(@aircraft), class: "link" %>
|
||||
<% elsif owner? %>
|
||||
<%= link_to "Record the new W&B", new_aircraft_weight_balance_record_path(@aircraft, major_record_id: @record.id), class: "link" %>
|
||||
<%= link_to t(".record_the_new_w_b"), new_aircraft_weight_balance_record_path(@aircraft, major_record_id: @record.id), class: "link" %>
|
||||
<% else %>—<% end %>
|
||||
</dd>
|
||||
<dt class="text-slate-500">ICAs</dt>
|
||||
<dt class="text-slate-500"><%= t(".icas") %></dt>
|
||||
<dd>
|
||||
<%= @record.has_ica? ? "Yes" : "No" %>
|
||||
<%= @record.has_ica? ? t(".yes") : t(".no") %>
|
||||
<% if (ica = @record.ica_inspection_type) %>
|
||||
<% row = Compliance.inspection_rows(@aircraft).find { _1.type == ica } %>
|
||||
· Inspection: <%= link_to ica.name, aircraft_inspections_path(@aircraft), class: "link" %> <%= compliance_badge(row.status) if row %>
|
||||
<%= t(".inspection_html", link: (link_to ica.name, aircraft_inspections_path(@aircraft), class: "link"), row: (compliance_badge(row.status) if row)) %>
|
||||
<% elsif @record.has_ica? && owner? %>
|
||||
· <%= link_to "Add the ICA's recurring inspection", new_aircraft_inspection_type_path(@aircraft, major_record_id: @record.id), class: "link" %>
|
||||
· <%= link_to t(".add_the_ica_s_recurring"), new_aircraft_inspection_type_path(@aircraft, major_record_id: @record.id), class: "link" %>
|
||||
<% end %>
|
||||
</dd>
|
||||
</dl>
|
||||
<% [["Description", @record.description], ["ICA notes", @record.ica_notes], ["Notes", @record.notes]].each do |title, text| %>
|
||||
<% [[t(".description"), @record.description], [t(".ica_notes"), @record.ica_notes], [t(".notes"), @record.notes]].each do |title, text| %>
|
||||
<% if text.present? %><div class="border-t border-slate-100 px-4 py-3 text-sm"><h3 class="mb-1 font-medium"><%= title %></h3><%= simple_format text %></div><% end %>
|
||||
<% end %>
|
||||
</section>
|
||||
Reference in new issue
Block a user