Module: GOVUKDesignSystemFormBuilder::Traits::Localisation
- Included in:
- Elements::Caption, Elements::CheckBoxes::Label, Elements::Date, Elements::Hint, Elements::Label, Elements::Legend
- Defined in:
- lib/govuk_design_system_formbuilder/traits/localisation.rb
Constant Summary collapse
- BASE_NAME_REGEXP =
starts with an letter that is followed by other word characters or spaces, zero or more times
%r{[[:alpha:]](?:[\w\s]*)}
Instance Method Summary collapse
Instance Method Details
#localised_text(context, segment = nil) ⇒ Object
8 9 10 11 12 13 14 |
# File 'lib/govuk_design_system_formbuilder/traits/localisation.rb', line 8 def localised_text(context, segment = nil) return unless @object_name.present? && @attribute_name.present? full_context = [schema(context), segment].compact.join('.') localise(full_context) || localise_html(full_context) end |