lib/generators/dry_crud/templates/app/helpers/standard_helper.rb
def translate_inheritable(key, variables = {})
    defaults = []
    partial = @virtual_path ? @virtual_path.gsub(%r{.*/_?}, "") : nil
    current = controller.class
    while current < ActionController::Base
      folder = current.controller_path
      if folder.present?
        defaults << :"#{folder}.#{partial}.#{key}" if partial
        defaults << :"#{folder}.#{action_name}.#{key}"
        defaults << :"#{folder}.global.#{key}"
      end
      current = current.superclass
    end
    defaults << :"global.#{key}"

    variables[:default] ||= defaults
    t(defaults.shift, variables)
  end
# Translates the passed key by looking it up over the controller hierarchy.
# The key is searched in the following order:
#  - {controller}.{current_partial}.{key}
#  - {controller}.{current_action}.{key}
#  - {controller}.global.{key}
#  - {parent_controller}.{current_partial}.{key}
#  - {parent_controller}.{current_action}.{key}
#  - {parent_controller}.global.{key}
#  - ...
#  - global.{key}
Translates the passed key by looking it up over the controller hierarchy.
Translates the passed key by looking it up over the controller hierarchy .
def translate_inheritable(key, variables = {})
    defaults = []
    partial = @virtual_path ? @virtual_path.gsub(%r{.*/_?}, "") : nil
    current = controller.class
    while current < ActionController::Base
      folder = current.controller_path
      if folder.present?
        defaults << :"#{folder}.#{partial}.#{key}" if partial
        defaults << :"#{folder}.#{action_name}.#{key}"
        defaults << :"#{folder}.global.#{key}"
      end
      current = current.superclass
    end
    defaults << :"global.#{key}"
    variables[:default] ||= defaults
    t(defaults.shift, variables)
  end
def translate_inheritable ( key , variables = { } ) defaults = [ ] partial = @virtual_path ? @virtual_path . gsub ( %r{ .*/_? } , "" ) : nil current = controller . class while current < ActionController :: Base folder = current . controller_path if folder . present? defaults << :" #{ folder } . #{ partial } . #{ key } " if partial defaults << :" #{ folder } . #{ action_name } . #{ key } " defaults << :" #{ folder } .global. #{ key } " end current = current . superclass end defaults << :" global. #{ key } " variables [ :default ] ||= defaults t ( defaults . shift , variables ) end
Translates the passed key by looking it up over the controller hierarchy.
Translates the passed key by looking it up over the controller hierarchy .
key
variables