Add some missing translations and limit locale selection only to available locales (#313)

This commit is contained in:
Riccardo Graziosi
2024-03-16 16:24:00 +01:00
committed by GitHub
parent d1f04ef2ed
commit d47c70f576
3 changed files with 13 additions and 6 deletions

View File

@@ -18,6 +18,7 @@ class Tenant < ApplicationRecord
validates :site_name, presence: true
validates :subdomain, presence: true, uniqueness: true
validates :locale, inclusion: { in: I18n.available_locales.map(&:to_s) }
accepts_nested_attributes_for :tenant_setting, update_only: true

View File

@@ -13,6 +13,13 @@
<%= f.email_field :email, autocomplete: "email", class: "form-control" %>
</div>
<% if devise_mapping.confirmable? && resource.pending_reconfirmation? %>
<div>
<b><%= t('common.forms.auth.waiting_confirmation', email: resource.unconfirmed_email) %></b>
<br /><br />
</div>
<% end %>
<div class="form-group">
<%= f.label :notifications_enabled, t('common.forms.auth.notifications_enabled') %>
&nbsp;
@@ -22,15 +29,11 @@
</small>
</div>
<% if devise_mapping.confirmable? && resource.pending_reconfirmation? %>
<div>Currently waiting confirmation for: <%= resource.unconfirmed_email %></div>
<% end %>
<div class="form-group">
<%= f.label :password, t('common.forms.auth.password') %>
<%= f.password_field :password, autocomplete: "new-password", class: "form-control" %>
<small id="passwordEditHelp" class="form-text text-muted">
leave blank if you don't want to change your password
<%= t('common.forms.auth.password_leave_blank_help') %>
</small>
</div>
@@ -43,7 +46,7 @@
<%= f.label :current_password, t('common.forms.auth.current_password') %>
<%= f.password_field :current_password, autocomplete: "current-password", class: "form-control" %>
<small id="currentPasswordHelp" class="form-text text-muted">
we need your current password to confirm your changes
<%= t('common.forms.auth.current_password_required_help') %>
</small>
</div>

View File

@@ -17,6 +17,9 @@ en:
current_password: 'Current password'
notifications_enabled: 'Notifications enabled'
notifications_enabled_help: "if disabled, you won't receive any notification"
waiting_confirmation: 'Currently waiting confirmation for %{email}'
password_leave_blank_help: "leave blank if you don't want to change your password"
current_password_required_help: 'we need your current password to confirm your changes'
remember_me: 'Remember me'
log_in: 'Log in'
sign_up: 'Sign up'