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

50 lines
4.0 KiB
ERB

<% content_for :title, t(".loading_setup", tail_number: @aircraft.tail_number) %>
<%= render "shared/aircraft_header", aircraft: @aircraft %>
<% stations = @setup.stations + Array.new([ 8 - @setup.stations.size, 2 ].max) { nil } %>
<% points = @setup.entered_envelope + Array.new([ 10 - @setup.envelope.size, 2 ].max) { nil } %>
<%= form_with url: aircraft_loading_setup_path(@aircraft), method: :patch, class: "card card-body max-w-3xl space-y-5" do %>
<div>
<h2 class="card-title"><%= t(".loading_setup_2") %></h2>
<p class="mt-1 text-sm text-slate-600"><%= t(".from_the_poh_s_weight") %></p>
</div>
<% if @setup.errors.any? %>
<div class="rounded-md bg-red-50 p-3 text-sm text-red-700 ring-1 ring-red-200" role="alert"><ul class="list-disc pl-5"><% @setup.errors.full_messages.each do |m| %><li><%= m %></li><% end %></ul></div>
<% end %>
<fieldset>
<legend class="label"><%= t(".stations") %></legend>
<div class="grid grid-cols-[1fr_5rem_5rem_3.5rem] gap-2 text-xs text-slate-500 sm:grid-cols-[1fr_6rem_6rem_4rem]"><span><%= t(".name") %></span><span><%= t(".arm_in") %></span><span><%= t(".max_lb_gal") %></span><span class="text-center"><%= t(".fuel") %></span></div>
<% stations.each_with_index do |st, i| %>
<div class="mt-1 grid grid-cols-[1fr_5rem_5rem_3.5rem] items-center gap-2 sm:grid-cols-[1fr_6rem_6rem_4rem]">
<%= text_field_tag "setup[stations][#{i}][name]", st&.name, class: "input", placeholder: (t(".front_seats") if i.zero?), "aria-label": t(".station_name", i: (i + 1)) %>
<%= text_field_tag "setup[stations][#{i}][arm]", st&.arm&.to_s&.sub(/\.0\z/, ""), class: "input", inputmode: "decimal", "aria-label": t(".station_arm", i: (i + 1)) %>
<%= text_field_tag "setup[stations][#{i}][max]", st&.max&.to_s&.sub(/\.0\z/, ""), class: "input", inputmode: "decimal", "aria-label": t(".station_maximum", i: (i + 1)) %>
<%= check_box_tag "setup[stations][#{i}][fuel]", "1", st&.fuel, class: "mx-auto block h-4 w-4", "aria-label": t(".station_is_fuel", i: (i + 1)) %>
</div>
<% end %>
<p class="hint"><%= t(".tick_fuel_for_fuel_tanks") %></p>
</fieldset>
<div class="max-w-xs">
<%= label_tag "setup[fuel_lb_per_gal]", t(".fuel_weight_lb_per_gallon"), class: "label" %>
<%= text_field_tag "setup[fuel_lb_per_gal]", @setup.fuel_lb_per_gal.to_s.sub(/\.0\z/, ""), class: "input", inputmode: "decimal" %>
<p class="hint"><%= t(".n6_for_avgas_6_7") %></p>
</div>
<fieldset>
<legend class="label"><%= t(".cg_envelope") %></legend>
<p class="hint !mt-0 mb-2"><%= t(".the_corners_of_the_normal") %></p>
<div class="mb-3 max-w-xs">
<%= label_tag "setup[envelope_unit]", t(".envelope_values_are"), class: "label" %>
<%= select_tag "setup[envelope_unit]", options_for_select(LoadingSetup::ENVELOPE_UNITS.invert, @setup.envelope_unit), class: "input" %>
<p class="hint"><%= t(".use_the_same_units_as") %></p>
</div>
<div class="grid max-w-md grid-cols-3 gap-2 text-xs text-slate-500"><span><%= t(".weight_lb") %></span><span><%= @setup.moment? ? t(".moment_lb_in_1000") : t(".cg_in_2") %></span><span><%= t(".cg_in") if @setup.moment? %></span></div>
<% points.each_with_index do |pt, i| %>
<div class="mt-1 grid max-w-md grid-cols-3 items-center gap-2">
<%= text_field_tag "setup[envelope][#{i}][weight]", pt&.first&.to_s&.sub(/\.0\z/, ""), class: "input", inputmode: "decimal", "aria-label": t(".envelope_point_weight", i: (i + 1)) %>
<%= text_field_tag "setup[envelope][#{i}][cg]", pt&.last&.to_s&.sub(/\.0\z/, ""), class: "input", inputmode: "decimal", "aria-label": t(".envelope_point", i: (i + 1), moment: (@setup.moment? ? 'moment' : 'CG')) %>
<span class="text-sm text-slate-600"><%= "#{@setup.envelope[i].last.round(2)} in" if @setup.moment? && @setup.envelope[i] %></span>
</div>
<% end %>
</fieldset>
<div class="flex gap-2"><%= submit_tag t(".save"), class: "btn-primary" %><%= link_to t(".cancel"), aircraft_weight_balance_records_path(@aircraft), class: "btn-secondary" %></div>
<% end %>