module TranslationHelpers
def translated(field, locale: I18n.locale)
It is intended to be used to avoid the implementation details, so that the
locale defaults to the application's default one.
Gives the localized version of the attribute for the given locale. The
def translated(field, locale: I18n.locale) return field if field.is_a?(String) return if field.nil? field[locale.to_s] || field.dig("machine_translations", locale.to_s) end