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
@@ -1,10 +1,10 @@
|
||||
<%= form_with model: [:admin, user], class: "card card-body space-y-4 max-w-md" do |f| %>
|
||||
<%= f.errors_summary %>
|
||||
<%= f.field :name %>
|
||||
<%= f.field :email_address, as: :email, label: "Email", required: true %>
|
||||
<%= f.field :password, as: :password, hint: (user.persisted? ? "Leave blank to keep current password." : "At least #{User::PASSWORD_MIN} characters; not one known from a data breach."), autocomplete: "new-password" %>
|
||||
<%= f.field :email_address, as: :email, label: t(".email"), required: true %>
|
||||
<%= f.field :password, as: :password, hint: (user.persisted? ? t(".leave_blank_to_keep_current") : t(".at_least_characters_not_one", _: (User::PASSWORD_MIN))), autocomplete: "new-password" %>
|
||||
<%= f.field :password_confirmation, as: :password %>
|
||||
<%= f.field :admin, as: :checkbox, label: "Administrator", hint: "Admins can see and edit every aircraft and manage users." %>
|
||||
<div class="flex gap-2"><%= f.submit "Save" %><%= link_to "Cancel", admin_users_path, class: "btn-secondary" %></div>
|
||||
<%= f.field :admin, as: :checkbox, label: t(".administrator"), hint: t(".admins_can_see_and_edit") %>
|
||||
<div class="flex gap-2"><%= f.submit t(".save") %><%= link_to t(".cancel"), admin_users_path, class: "btn-secondary" %></div>
|
||||
<% end %>
|
||||
<% if user.persisted? && user != current_user %><div class="mt-4"><%= delete_button "Delete user", admin_user_path(user) %></div><% end %>
|
||||
<% if user.persisted? && user != current_user %><div class="mt-4"><%= delete_button t(".delete_user"), admin_user_path(user) %></div><% end %>
|
||||
@@ -1,2 +1,2 @@
|
||||
<h1 class="mb-4 text-2xl font-bold">Edit User</h1>
|
||||
<h1 class="mb-4 text-2xl font-bold"><%= t(".edit_user") %></h1>
|
||||
<%= render "form", user: @user %>
|
||||
@@ -1,18 +1,18 @@
|
||||
<% content_for :title, "Users" %>
|
||||
<div class="mb-4 flex items-center justify-between"><h1 class="text-2xl font-bold">Users</h1><%= link_to "+ New User", new_admin_user_path, class: "btn-primary" %></div>
|
||||
<% content_for :title, t(".users") %>
|
||||
<div class="mb-4 flex items-center justify-between"><h1 class="text-2xl font-bold"><%= t(".users") %></h1><%= link_to t(".new_user"), new_admin_user_path, class: "btn-primary" %></div>
|
||||
<section class="card"><table class="table">
|
||||
<thead><tr><th>Name</th><th>Email</th><th>Aircraft</th><th>Last sign-in</th><th></th></tr></thead>
|
||||
<thead><tr><th><%= t(".name") %></th><th><%= t(".email") %></th><th><%= t(".aircraft") %></th><th><%= t(".last_sign_in") %></th><th></th></tr></thead>
|
||||
<tbody><% @users.each do |u| %><tr>
|
||||
<td><%= u.name %> <% if u.admin? %><span class="badge-blue">Admin</span><% end %><% if u.sso_uid? %> <span class="badge-gray" title="Signs in with <%= Sso.label %>"><%= Sso.label %></span><% end %><% if u.otp_enabled? %> <span class="badge-green" title="Authenticator app on">2FA</span><% end %><% if u.locked? %> <span class="badge-red" title="Too many failed sign-ins">Locked</span><% end %></td>
|
||||
<td><%= u.name %> <% if u.admin? %><span class="badge-blue"><%= t(".admin") %></span><% end %><% if u.sso_uid? %> <span class="badge-gray" title="Signs in with <%= Sso.label %>"><%= Sso.label %></span><% end %><% if u.otp_enabled? %> <span class="badge-green" title="<%= t(".authenticator_app_on") %>"><%= t(".n2fa") %></span><% end %><% if u.locked? %> <span class="badge-red" title="<%= t(".too_many_failed_sign_ins") %>"><%= t(".locked") %></span><% end %></td>
|
||||
<td><%= u.email_address %><% if u.certificates.any? %><div class="text-xs text-slate-500"><%= u.certificates.map { "#{_1.short_label} #{_1.number}" }.join(", ") %></div><% end %></td>
|
||||
<td class="text-xs"><%= u.aircraft_roles.map { "#{_1.aircraft.tail_number} (#{_1.role})" }.join(", ").presence || "—" %></td>
|
||||
<td class="text-xs text-slate-500"><%= u.last_signed_in_at ? "#{time_ago_in_words(u.last_signed_in_at)} ago" : "never" %></td>
|
||||
<td class="whitespace-nowrap text-right">
|
||||
<% if u.disabled? %><span class="badge-red mr-1">Disabled</span><%= button_to "Enable", enable_admin_user_path(u), method: :patch, class: "btn-secondary btn-sm", form: { class: "inline" } %>
|
||||
<% elsif u != current_user %><%= button_to "Disable", disable_admin_user_path(u), method: :patch, class: "btn-secondary btn-sm", form: { class: "inline", data: { turbo_confirm: "Disable #{u.email_address}? They'll be signed out and can't sign in or sign entries. Their past signatures are kept." } } %><% end %>
|
||||
<% if u.locked? %><%= button_to "Unlock", unlock_admin_user_path(u), method: :patch, class: "btn-secondary btn-sm", form: { class: "inline" } %><% end %>
|
||||
<% if u.otp_enabled? %><%= button_to "Reset 2FA", reset_two_factor_admin_user_path(u), method: :patch, class: "btn-secondary btn-sm", title: "Turn off their authenticator app (lost phone)", form: { class: "inline", data: { turbo_confirm: "Turn off two-factor for #{u.email_address}? Only do this after confirming it's really them." } } %><% end %>
|
||||
<%= link_to "Edit", edit_admin_user_path(u), class: "btn-secondary btn-sm" %></td>
|
||||
<% if u.disabled? %><span class="badge-red mr-1"><%= t(".disabled") %></span><%= button_to t(".enable"), enable_admin_user_path(u), method: :patch, class: "btn-secondary btn-sm", form: { class: "inline" } %>
|
||||
<% elsif u != current_user %><%= button_to t(".disable"), disable_admin_user_path(u), method: :patch, class: "btn-secondary btn-sm", form: { class: "inline", data: { turbo_confirm: t(".disable_they_ll_be_signed", email_address: u.email_address) } } %><% end %>
|
||||
<% if u.locked? %><%= button_to t(".unlock"), unlock_admin_user_path(u), method: :patch, class: "btn-secondary btn-sm", form: { class: "inline" } %><% end %>
|
||||
<% if u.otp_enabled? %><%= button_to t(".reset_2fa"), reset_two_factor_admin_user_path(u), method: :patch, class: "btn-secondary btn-sm", title: t(".turn_off_their_authenticator_app"), form: { class: "inline", data: { turbo_confirm: t(".turn_off_two_factor_for", email_address: u.email_address) } } %><% end %>
|
||||
<%= link_to t(".edit"), edit_admin_user_path(u), class: "btn-secondary btn-sm" %></td>
|
||||
</tr><% end %></tbody>
|
||||
</table></section>
|
||||
<p class="hint mt-3">After creating an account, an aircraft owner can grant access from the aircraft's “Access & Sharing” tab.</p>
|
||||
<p class="hint mt-3"><%= t(".after_creating_an_account_an") %></p>
|
||||
@@ -1,2 +1,2 @@
|
||||
<h1 class="mb-4 text-2xl font-bold">New User</h1>
|
||||
<h1 class="mb-4 text-2xl font-bold"><%= t(".new_user") %></h1>
|
||||
<%= render "form", user: @user %>
|
||||
Reference in new issue
Block a user