Sha256: 067299a97edb904b7629c4ea02126e1fccac0a7a89dbd2bf1bb77ca2bb9511f4
Contents?: true
Size: 886 Bytes
Versions: 4
Compression:
Stored size: 886 Bytes
Contents
module RailsStuff module Helpers module Translation # Translates & caches actions within `helpers.actions` scope. def translate_action(action) @translate_action ||= Hash.new do |h, key| h[key] = I18n.t("helpers.actions.#{key}") end @translate_action[action] end # Translates & caches confirmations within `helpers.confirmations` scope. def translate_confirmation(action) @translate_confirmation ||= Hash.new do |h, key| h[key] = I18n.t("helpers.confirmations.#{key}", default: [:'helpers.confirm']) end @translate_confirmation[action] end # Translates boolean values. def yes_no(val) @translate_yes_no ||= Hash.new do |h, key| h[key] = I18n.t("helpers.yes_no.#{key}") end @translate_yes_no[val.to_s] end end end end
Version data entries
4 entries across 4 versions & 1 rubygems