Included Modules

Wicked::Wizard::Translated

Public Instance Methods

wizard_translate(step_name) click to toggle source

takes a canonical wizard value and translates to correct language

es.yml wicked:

first: "uno"

wizard_translate("first") # => :uno
# File lib/wicked/wizard/translated.rb, line 43
def wizard_translate(step_name)
  I18n.t("wicked.#{step_name}")
end
wizard_translations() click to toggle source

creates a hash where keys are translated steps, values are the name of the view file

es:
  hello: "hola mundo"
  wicked:
    first: "uno"
    second: "dos"

 steps :first, :second

{:uno => :first, :dos => :second} # spanish {:first => :first, :second => :second} # english

# File lib/wicked/wizard/translated.rb, line 27
def wizard_translations
  @wizard_translations ||= steps.inject(ActiveSupport::OrderedHash.new) do |hash, step|
    step              = step.to_s.split(".").last
    translation       = wizard_translate(step)
    hash[translation] = step.to_s
    hash
  end
end
wizard_value(step_name) click to toggle source

takes an already translated value and converts to a canonical wizard value

es.yml wicked:

first: "uno"

wizard_value("uno") # => :first
# File lib/wicked/wizard/translated.rb, line 55
def wizard_value(step_name)
  wizard_translations["#{step_name}"]
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.