mirror of
https://github.com/rickbarrette/simple-aircraft-manager-rails.git
synced 2026-11-17 15:50:36 -05:00
- 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>
59 lines
3.0 KiB
ERB
59 lines
3.0 KiB
ERB
<% content_for :title, t(".import_logbook_pages", tail_number: @aircraft.tail_number) %>
|
|
<%= render "shared/aircraft_header", aircraft: @aircraft %>
|
|
<% ai = LogbookImport.ai_available? %>
|
|
<%= form_with url: aircraft_logbook_imports_path(@aircraft), multipart: true, class: "card card-body max-w-3xl space-y-5" do |f| %>
|
|
<div>
|
|
<h2 class="card-title"><%= t(".import_scanned_logbook_pages") %></h2>
|
|
<p class="hint mt-1">
|
|
<%= t(".the_pages_are_saved_as") %>
|
|
<% if ai %><%= t(".claude_can_also_read_them") %><% else %>
|
|
<%= t(".to_have_entries_transcribed_automatically_html") %><% end %>
|
|
</p>
|
|
</div>
|
|
|
|
<div>
|
|
<%= f.label :pages, t(".scanned_pages"), class: "label" %>
|
|
<%= f.file_field :pages, multiple: true, required: true, accept: "image/jpeg,image/png,image/gif,image/webp,application/pdf",
|
|
class: "block text-sm text-slate-600 file:mr-3 file:rounded-md file:border-0 file:bg-slate-100 file:px-3 file:py-1.5 file:text-sm file:font-medium hover:file:bg-slate-200" %>
|
|
<p class="hint mt-1"><%= t(".jpeg_png_webp_or_pdf") %></p>
|
|
</div>
|
|
|
|
<div class="grid gap-4 sm:grid-cols-2">
|
|
<div>
|
|
<%= f.label :collection_id, t(".collection"), class: "label" %>
|
|
<%= f.select :collection_id, [ [ t(".new_collection"), "new" ] ] + @collections.map { [ _1.name, _1.id ] },
|
|
{ selected: params[:collection_id] || @collections.find { _1.name.match?(/log/i) }&.id || "new" }, class: "input" %>
|
|
</div>
|
|
<div>
|
|
<%= f.label :collection_name, t(".new_collection_name"), class: "label" %>
|
|
<%= f.text_field :collection_name, value: params[:collection_name], placeholder: t(".airframe_log_2"), class: "input" %>
|
|
</div>
|
|
<div>
|
|
<%= f.label :document_name, t(".document_name"), class: "label" %>
|
|
<%= f.text_field :document_name, value: params[:document_name], placeholder: t(".same_as_the_collection"), class: "input" %>
|
|
</div>
|
|
<div>
|
|
<%= f.label :doc_type, t(".document_type"), class: "label" %>
|
|
<%= f.select :doc_type, Document::TYPES.invert, { selected: params[:doc_type] || "LOG" }, class: "input" %>
|
|
</div>
|
|
</div>
|
|
|
|
<fieldset class="space-y-3 rounded-md p-3 ring-1 ring-slate-200 <%= 'opacity-60' unless ai %>">
|
|
<label class="flex items-start gap-2 text-sm">
|
|
<%= f.check_box :transcribe, { checked: ai, disabled: !ai, class: "mt-0.5" }, "1", "0" %>
|
|
<span><%= t(".transcribe_with_claude_html") %>
|
|
<span class="hint"><%= t(".each_entry_becomes_a_logbook") %></span></span>
|
|
</label>
|
|
<div class="max-w-xs">
|
|
<%= f.label :log_type, t(".log"), class: "label" %>
|
|
<%= f.select :log_type, [ [ t(".detect_for_each_entry"), "" ] ] + LogbookEntry::LOG_TYPES.invert.to_a, { selected: params[:log_type] }, class: "input", disabled: !ai %>
|
|
<p class="hint mt-1"><%= t(".pick_one_when_the_whole") %></p>
|
|
</div>
|
|
</fieldset>
|
|
|
|
<div class="flex gap-2">
|
|
<%= f.submit ai ? t(".upload_transcribe") : t(".upload_pages"), class: "btn-primary" %>
|
|
<%= link_to t(".cancel"), aircraft_logbook_entries_path(@aircraft), class: "btn-secondary" %>
|
|
</div>
|
|
<% end %>
|