Sha256: d42729d83032a565a894d87048c7824f0b59e0bdb44bbb9c1f510c83b98e71c4
Contents?: true
Size: 1.06 KB
Versions: 131
Compression:
Stored size: 1.06 KB
Contents
module GovukPublishingComponents module Presenters class AccordionHelper def initialise; end def translations { show_text: "common.show", hide_text: "common.hide", show_all_text: "components.accordion.show_all", hide_all_text: "components.accordion.hide_all", this_section_visually_hidden: "components.accordion.this_section_visually_hidden", } end def apply_translations shared_helper = GovukPublishingComponents::Presenters::SharedHelper.new({}) locales = {} data_attributes = {} translations.each do |key, translation| locales[key] = shared_helper.t_locale(translation) data_attributes[key] = I18n.translate(translation) end unique_locales = locales.values.uniq if unique_locales.length > 1 data_attributes[:locale] = locales elsif unique_locales[0] != I18n.locale data_attributes[:locale] = unique_locales[0] end data_attributes end end end end
Version data entries
131 entries across 131 versions & 1 rubygems