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
@@ -2,6 +2,7 @@
|
||||
# the time-in-service delta (tach or Hobbs, per the aircraft's maintenance
|
||||
# clock) to every IN-USE component.
|
||||
class HoursService
|
||||
H = "services.hours_service"
|
||||
def initialize(aircraft, user: Current.user)
|
||||
@aircraft = aircraft
|
||||
@user = user
|
||||
@@ -30,8 +31,8 @@ class HoursService
|
||||
@aircraft.save!
|
||||
cascade_to_components(delta, clamp: true)
|
||||
@aircraft.log_event!("hours",
|
||||
"Hours #{tach_delta >= 0 ? 'updated' : 'corrected'} to #{tach}",
|
||||
user: @user, notes: "Previous: #{old}, delta: #{tach_delta >= 0 ? '+' : ''}#{tach_delta}")
|
||||
I18n.t(tach_delta >= 0 ? "#{H}.hours_updated" : "#{H}.hours_corrected", tach: tach),
|
||||
user: @user, notes: I18n.t("#{H}.hours_notes", old: old, delta: "#{'+' if tach_delta >= 0}#{tach_delta}"))
|
||||
end
|
||||
tach_delta
|
||||
end
|
||||
@@ -55,13 +56,13 @@ class HoursService
|
||||
@aircraft.consumable_records.create!(
|
||||
record_type: type, flight_log: flight, date: flight.date, quantity_added: qty,
|
||||
level_after: level, consumable_type: kind, flight_hours: @aircraft.tach_time,
|
||||
notes: "Auto-created from flight log")
|
||||
@aircraft.log_event!(type, "#{type.capitalize} added: #{qty} #{ConsumableRecord::UNITS[type]}",
|
||||
user: @user, notes: "From flight log")
|
||||
notes: I18n.t("services.hours_service.auto_created_from_flight_log"))
|
||||
@aircraft.log_event!(type, I18n.t("#{H}.consumable_added", type: ConsumableRecord::TYPES[type], quantity: qty, unit: ConsumableRecord::UNITS[type]),
|
||||
user: @user, notes: I18n.t("services.hours_service.from_flight_log"))
|
||||
end
|
||||
|
||||
route = flight.route_summary.presence
|
||||
@aircraft.log_event!("flight", "Flight logged: #{flight.tach_time} hrs#{" (#{route})" if route}", user: @user)
|
||||
@aircraft.log_event!("flight", I18n.t(route ? "#{H}.flight_logged_route" : "#{H}.flight_logged", hours: flight.tach_time, route: route), user: @user)
|
||||
end
|
||||
flight
|
||||
end
|
||||
|
||||
Reference in new issue
Block a user