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

39 lines
2.3 KiB
ERB

<% content_for :title, @search.query.present? ? t(".search_2", query: @search.query) : t(".search") %>
<h1 class="mb-4 text-2xl font-bold"><%= t(".search") %></h1>
<%= form_with url: search_path, method: :get, class: "card card-body mb-5 flex flex-wrap items-end gap-2", data: { turbo_action: "advance" } do %>
<div class="min-w-0 flex-1">
<%= label_tag :q, t(".search_for"), class: "label" %>
<%= search_field_tag :q, @search.query, class: "input", autofocus: @search.query.blank?, placeholder: t(".e_g_magneto_koqu_2011") %>
</div>
<% if @fleet.size > 1 %>
<div>
<%= label_tag :aircraft_id, t(".aircraft"), class: "label" %>
<%= select_tag :aircraft_id, options_for_select([ [ t(".all_aircraft"), "" ] ] + @fleet.map { [ _1.tail_number, _1.id ] }, @aircraft&.id), class: "input" %>
</div>
<% end %>
<%= submit_tag t(".search"), class: "btn-primary", name: nil %>
<% end %>
<% if @search.query.present? && !@search.searchable? %>
<p class="text-sm text-slate-600"><%= t(".type_at_least_two_characters") %></p>
<% elsif @search.searchable? %>
<p class="mb-3 text-sm text-slate-600" role="status"><%= t(".for_html", count: @search.count, query: @search.query, aircraft: (t(".on_aircraft", tail_number: @aircraft.tail_number) if @aircraft)) %></p>
<div class="space-y-5">
<% @search.results.each do |kind, results| %>
<section class="card">
<div class="card-header"><h2 class="card-title"><%= SiteSearch::KINDS[kind] %> <span class="text-sm font-normal text-slate-500">(<%= results.size %><%= "+" if results.size >= SiteSearch::LIMIT %>)</span></h2></div>
<ul class="divide-y divide-slate-100">
<% results.each do |r| %>
<li class="px-4 py-2">
<%= link_to r.title, r.path, class: "link font-medium" %>
<% if @fleet.size > 1 && !@aircraft %><span class="badge-gray ml-1"><%= r.aircraft&.tail_number %></span><% end %>
<% if r.snippet %><p class="mt-0.5 text-sm text-slate-600"><%= highlight(r.snippet, @search.query, highlighter: '<mark class="rounded bg-amber-100 px-0.5 text-slate-900">\1</mark>') %></p><% end %>
</li>
<% end %>
</ul>
</section>
<% end %>
<% if @search.results.empty? %><div class="card"><%= empty_state t(".nothing_found_try_a_shorter") %></div><% end %>
</div>
<% end %>