Sha256: a7cd626241734e6a4aabb5cf1c0668bb99c5827f1781da42c114a20e2ca72500
Contents?: true
Size: 542 Bytes
Versions: 7
Compression:
Stored size: 542 Bytes
Contents
# frozen_string_literal: true module Decidim # Helper that provides convenient methods to deal with translated attributes. module TranslationsHelper # Public: Returns the translation of an attribute using the current locale, # if available. # # attribute - A Hash where keys (strings) are locales, and their values are # the translation for each locale. # # Returns a String with the translation. def translated_attribute(attribute) attribute.try(:[], I18n.locale.to_s) end end end
Version data entries
7 entries across 7 versions & 1 rubygems