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:
rickyandClaude Opus 5.5 committed 2026-11-13 22:08:20 -05:00
1 parent 3f45b557c2
commit 89ed0a76f9
313 files changed
+6387 -2653

No files matched your search

+11 -11
View File
@@ -18,10 +18,10 @@ class LogbookEntriesController < ApplicationController
# Someone has checked a transcribed entry against the scan.
def verify
@entry.update!(verified: true)
log_event("logbook", "Transcribed logbook entry verified: #{@entry.date}")
log_event("logbook", t("flash.logbook_entries.transcribed_logbook_entry_verified", date: @entry.date))
next_entry = @aircraft.logbook_entries.unverified.order(:date, :id).first
redirect_to next_entry ? aircraft_logbook_entry_path(@aircraft, next_entry) : aircraft_logbook_entries_path(@aircraft),
notice: next_entry ? "Verified. Here's the next one to check." : "Verified. All transcribed entries are checked."
notice: next_entry ? t("flash.logbook_entries.verified_next") : t("flash.logbook_entries.verified_all")
end
def show; end
@@ -36,11 +36,11 @@ class LogbookEntriesController < ApplicationController
@entry.supersedes = correctable(params.dig(:logbook_entry, :supersedes_id))
@entry.assign_parts(parts_params, @aircraft)
if @entry.save
log_event("logbook", "Logbook entry #{@entry.supersedes ? 'correction ' : ''}added (#{@entry.date})")
log_event("logbook", t(@entry.supersedes ? "flash.logbook_entries.correction_added_event" : "flash.logbook_entries.logbook_entry_added", date: @entry.date))
record_parts_service
record_inspections
redirect_to aircraft_logbook_entry_path(@aircraft, @entry),
notice: @entry.supersedes ? "Correction saved. Sign it to supersede the original entry." : "Logbook entry added."
notice: @entry.supersedes ? t("flash.logbook_entries.correction_saved") : t("flash.logbook_entries.added")
else
render :new, status: :unprocessable_entity
end
@@ -52,8 +52,8 @@ class LogbookEntriesController < ApplicationController
@entry.assign_attributes(entry_params)
@entry.assign_parts(parts_params, @aircraft)
if @entry.save
log_event("logbook", "Logbook entry updated (#{@entry.date})")
redirect_to aircraft_logbook_entry_path(@aircraft, @entry), notice: "Logbook entry updated."
log_event("logbook", t("flash.logbook_entries.logbook_entry_updated_2", date: @entry.date))
redirect_to aircraft_logbook_entry_path(@aircraft, @entry), notice: t("flash.logbook_entries.logbook_entry_updated")
else
render :edit, status: :unprocessable_entity
end
@@ -61,8 +61,8 @@ class LogbookEntriesController < ApplicationController
def destroy
@entry.destroy!
log_event("logbook", "Logbook entry deleted (#{@entry.date})")
redirect_to aircraft_logbook_entries_path(@aircraft), notice: "Logbook entry deleted."
log_event("logbook", t("flash.logbook_entries.logbook_entry_deleted_2", date: @entry.date))
redirect_to aircraft_logbook_entries_path(@aircraft), notice: t("flash.logbook_entries.logbook_entry_deleted")
end
private
@@ -70,7 +70,7 @@ class LogbookEntriesController < ApplicationController
# Signed entries are locked (AC 120-78B 2.1.2.8): changes go in a correction.
def require_unsigned
return unless @entry.signed?
redirect_to aircraft_logbook_entry_path(@aircraft, @entry), alert: "This entry is signed, so it can't be changed or deleted. Make a correction entry instead."
redirect_to aircraft_logbook_entry_path(@aircraft, @entry), alert: t("flash.logbook_entries.this_entry_is_signed")
end
# A signed, not yet superseded entry of this aircraft.
@@ -99,7 +99,7 @@ class LogbookEntriesController < ApplicationController
part = @entry.parts.find { _1.component_id == id.to_i } or next
component = part.component
component.service_from_entry!(date: @entry.date, hours_at_entry: part.hours_at_entry, flown_since: flown, replaced: p["service"] == "replaced")
log_event("component", "#{p['service'] == 'replaced' ? 'Replaced' : 'Serviced'}: #{component} (logbook entry #{@entry.date})")
log_event("component", t(p["service"] == "replaced" ? "flash.logbook_entries.replaced_event" : "flash.logbook_entries.serviced_event", component: component, date: @entry.date))
end
end
@@ -110,7 +110,7 @@ class LogbookEntriesController < ApplicationController
@aircraft.applicable_inspection_types.where(id: ids).find_each do |type|
@aircraft.inspection_records.create!(inspection_type: type, logbook_entry: @entry, date: @entry.date,
aircraft_hours: @entry.aircraft_hours_at_entry)
log_event("inspection", "Inspection completed: #{type.name} (logbook entry #{@entry.date})")
log_event("inspection", t("flash.logbook_entries.inspection_completed_logbook_entry", name: type.name, date: @entry.date))
end
end