ministryofjustice / govuk_elements_form_builder

Form builder helper methods to develop GOV.UK elements styled applications in Ruby on Rails
https://govuk-elements-rails-guide.herokuapp.com/
MIT License
6 stars 14 forks source link

Add ability to specify HTML safe label translations #66

Closed csutter closed 8 years ago

csutter commented 8 years ago

It's a common pattern on some applications to use (limited) HTML markup inside labels. Rails has a pattern where it assumes that translations are html_safe when they end in _html. This PR adds the ability to add html_safe labels to forms by having the translation code look for fieldname_html in the translations before falling back to the default, and if it finds that, assuming the resulting translation is html_safe.

image

robmckinnon commented 8 years ago

Looks good.

For reference, here's a link to the using safe HTML translations section in the Rails guide which explains the convention.