Skip to content

Commit 2818966

Browse files
committed
Fix missing translation
1 parent e5c7bf7 commit 2818966

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

app/services/socio_demographic_authorization_handler.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class SocioDemographicAuthorizationHandler < Decidim::AuthorizationHandler
1010
AGE_SLICE = %w(16-25 26-45 46-65 65+).freeze
1111

1212
validates :scope_id,
13-
format: { with: /\A\d+\z/, message: "Integer only", if: proc { |x| !x.scope_id.nil? && validate_scope } },
13+
format: { with: /\A\d+\z/, message: I18n.t("errors.messages.integer_only"), if: proc { |x| !x.scope_id.nil? && validate_scope } },
1414
presence: false
1515

1616
validates :gender,
@@ -28,6 +28,6 @@ def metadata
2828
private
2929

3030
def validate_scope
31-
errors[:scope_id] << "must be valid" if Decidim::Scope.where(id: scope_id).empty?
31+
errors.add(:scope_id, :invalid) if Decidim::Scope.where(id: scope_id).empty?
3232
end
3333
end

config/locales/en.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,6 @@ en:
1313
man: Man
1414
undefined: Undefined
1515
woman: Woman
16+
errors:
17+
messages:
18+
integer_only: Integer only

config/locales/fr.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,6 @@ fr:
1414
man: Homme
1515
undefined: Non défini
1616
woman: Femme
17+
errors:
18+
messages:
19+
integer_only: Integer only

0 commit comments

Comments
 (0)