# File lib/confstruct/hash_with_struct_access.rb, line 21 def self.i18n key=nil, &block raise NameError, "I18n handler not loaded" unless Object.const_defined? :I18n # ensure the Rails I18n handler is loaded Deferred.new do |hwsa| val = block_given? ? eval_or_yield(hwsa, &block) : key if val.is_a?(Date) or val.is_a?(Time) or val.is_a?(DateTime) ::I18n.localize val else ::I18n.translate val end end end