From cdc7dc963df611564ccd3af3f99025c23d59802b Mon Sep 17 00:00:00 2001 From: Sylvain Date: Wed, 4 Jan 2023 16:17:37 +0100 Subject: [PATCH] (i18n) translate new errors --- app/models/cart_item/prepaid_pack.rb | 2 +- app/models/cart_item/reservation.rb | 2 +- app/models/cart_item/subscription.rb | 2 +- config/locales/en.yml | 2 ++ 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/models/cart_item/prepaid_pack.rb b/app/models/cart_item/prepaid_pack.rb index 73333f536..aa57a666a 100644 --- a/app/models/cart_item/prepaid_pack.rb +++ b/app/models/cart_item/prepaid_pack.rb @@ -41,7 +41,7 @@ class CartItem::PrepaidPack < CartItem::BaseItem return false end if pack.group_id != customer.group_id - errors.add(:group, "pack is reserved for members of group #{pack.group.name}") + errors.add(:group, I18n.t('cart_item_validation.pack_group', { GROUP: pack.group.name })) return false end true diff --git a/app/models/cart_item/reservation.rb b/app/models/cart_item/reservation.rb index 68ad770a0..36d137b7e 100644 --- a/app/models/cart_item/reservation.rb +++ b/app/models/cart_item/reservation.rb @@ -72,7 +72,7 @@ class CartItem::Reservation < CartItem::BaseItem end if slot.full? - errors.add(:slot, I18n.t('cart_item_validation.full') + errors.add(:slot, I18n.t('cart_item_validation.full')) return false end diff --git a/app/models/cart_item/subscription.rb b/app/models/cart_item/subscription.rb index e816452b7..50b297e9e 100644 --- a/app/models/cart_item/subscription.rb +++ b/app/models/cart_item/subscription.rb @@ -38,7 +38,7 @@ class CartItem::Subscription < CartItem::BaseItem return false end if plan.group_id != customer.group_id - errors.add(:group, "plan is reserved for members of group #{plan.group.name}") + errors.add(:group, I18n.t('cart_item_validation.plan_group', { GROUP: plan.group.name })) return false end true diff --git a/config/locales/en.yml b/config/locales/en.yml index 83c57c0bc..3297408fc 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -517,8 +517,10 @@ en: deadline: "You can't reserve a slot %{MINUTES} minutes prior to its start" restricted: "This availability is restricted for subscribers" plan: "This subscription plan is disabled" + plan_group: "This subscription plan is reserved for members of group %{GROUP}" reserved: "This slot is already reserved" pack: "This prepaid pack is disabled" + pack_group: "This prepaid pack is reserved for members of group %{GROUP}" space: "This space is disabled" machine: "This machine is disabled" reservable: "This machine is not reservable"