Browse Source

potential variation on how to achieve pluralisation

pull/1326/head
Arthur Campbell 3 years ago
parent
commit
5294783636
  1. 5
      app/helpers/copy_helper.rb
  2. 8
      app/models/form/sales/questions/buyer_previous.rb
  3. 8
      config/locales/en.yml

5
app/helpers/copy_helper.rb

@ -0,0 +1,5 @@
module CopyHelper
def translate(key, pluralise_condition: false)
I18n.t(key, count: pluralise_condition ? 2 : 1)
end
end

8
app/models/form/sales/questions/buyer_previous.rb

@ -1,9 +1,13 @@
class Form::Sales::Questions::BuyerPrevious < ::Form::Question
include CopyHelper
def initialize(id, hsh, page, joint_purchase:)
super(id, hsh, page)
@id = "soctenant"
@check_answer_label = "#{joint_purchase ? 'Any buyers were' : 'Buyer was a'} registered provider#{'s' if joint_purchase}, housing association or local authority tenant#{'s' if joint_purchase} immediately before this sale?"
@header = "#{joint_purchase ? 'Were any of the buyers' : 'Was the buyer a'} private registered provider#{'s' if joint_purchase}, housing association or local authority tenant#{'s' if joint_purchase} immediately before this sale?"
@check_answer_label = translate("check_answer_labels.soctenant", pluralise_condition: joint_purchase)
# @check_answer_label = I18n.t("check_answer_labels.soctenant", count: joint_purchase ? 2 : 1)
@header = translate("questions.soctenant", pluralise_condition: joint_purchase)
# @header = I18n.t("questions.soctenant", count: joint_purchase ? 2 : 1)
@type = "radio"
@answer_options = ANSWER_OPTIONS
end

8
config/locales/en.yml

@ -538,6 +538,9 @@ en:
W: "Suitable for someone who uses a wheelchair and offers the full use of all rooms and facilities."
A: "Fitted with stairlifts, ramps, level access showers or grab rails."
N: "Not designed to wheelchair-user standards or fitted with any equipment or adaptations."
soctenant:
one: "Was the buyer a private registered provider, housing association or local authority tenant immediately before this sale?"
other: "Were any of the buyers private registered providers, housing association or local authority tenants immediately before this sale?"
hints:
location:
@ -551,6 +554,11 @@ en:
bulk_upload:
needstype: "General needs housing includes both self-contained and shared housing without support or specific adaptations. Supported housing can include direct access hostels, group homes, residential care and nursing homes."
check_answer_labels:
soctenant:
one: "Buyer was a registered provider, housing association or local authority tenant immediately before this sale?"
other: "Any buyers were registered providers, housing association or local authority tenants immediately before this sale?"
warnings:
location:
deactivate:

Loading…
Cancel
Save