Browse Source

feat: allow translation text and title text to display currency formatting even when not a log field

pull/1225/head
natdeanlewissoftwire 2 years ago
parent
commit
9271c969a0
  1. 4
      app/helpers/interruption_screen_helper.rb
  2. 1
      app/models/form/sales/pages/about_price_shared_ownership_value_check.rb
  3. 2
      config/locales/en.yml

4
app/helpers/interruption_screen_helper.rb

@ -10,7 +10,7 @@ module InterruptionScreenHelper
else
lettings_log.public_send(argument["key"])
end
translation_params[argument["i18n_template"].to_sym] = value
translation_params[argument["i18n_template"].to_sym] = argument["prefix"] == "£" ? "£#{ActionController::Base.helpers.number_to_currency(value, delimiter: ',', format: '%n')}" : value
end
begin
@ -33,7 +33,7 @@ module InterruptionScreenHelper
else
lettings_log.public_send(argument["key"])
end
translation_params[argument["i18n_template"].to_sym] = value
translation_params[argument["i18n_template"].to_sym] = argument["prefix"] == "£" ? "£#{ActionController::Base.helpers.number_to_currency(value, delimiter: ',', format: '%n')}" : value
end
I18n.t(title_text["translation"], **translation_params).to_s
end

1
app/models/form/sales/pages/about_price_shared_ownership_value_check.rb

@ -24,6 +24,7 @@ class Form::Sales::Pages::AboutPriceSharedOwnershipValueCheck < ::Form::Page
"key" => "purchase_price_soft_min_or_soft_max",
"label" => false,
"i18n_template" => "soft_min_or_soft_max",
"prefix" => "£",
},
{
"key" => "purchase_price_min_or_max_text",

2
config/locales/en.yml

@ -435,7 +435,7 @@ en:
hint_text: "The maximum rent expected for this type of property in this local authority is £%{soft_max_for_period}"
purchase_price:
title_text: "You told us the purchase price is %{value}"
hint_text: "The %{min_or_max} purchase price expected for this type of property in this local authority is £%{soft_min_or_soft_max}"
hint_text: "The %{min_or_max} purchase price expected for this type of property in this local authority is %{soft_min_or_soft_max}"
retirement:
min:
title: "You told us this person is under %{age} and retired"

Loading…
Cancel
Save