module I18n::MissingTranslation::Base - i18n-0.6.11 Documentation

# module I18n::MissingTranslation::Base

### Attributes

key[R]
locale[R]
options[R]

### Public Class Methods

new(locale, key, options = nil) click to toggle source

    # File lib/i18n/exceptions.rb, line 56
    def initialize(locale, key, options = nil)
      @key, @locale, @options = key, locale, options.dup || {}
      options.each { |k, v| self.options[k] = v.inspect if v.is_a?(Proc) }
    end

### Public Instance Methods

html_message() click to toggle source

    # File lib/i18n/exceptions.rb, line 61
    def html_message
      key  = CGI.escapeHTML titleize(keys.last)
      path = CGI.escapeHTML keys.join('.')
      %Q(<span class="translation_missing" title="translation missing: #{path}">#{key}</span>)
    end

keys() click to toggle source

    # File lib/i18n/exceptions.rb, line 67
    def keys
      @keys ||= I18n.normalize_keys(locale, key, options[:scope]).tap do |keys|
        keys << 'no key' if keys.size < 2
      end
    end

message() click to toggle source

    # File lib/i18n/exceptions.rb, line 73
    def message
      "translation missing: #{keys.join('.')}"
    end

Also aliased as: to_s
to_exception() click to toggle source

    # File lib/i18n/exceptions.rb, line 78
    def to_exception
      MissingTranslationData.new(locale, key, options)
    end

to_s()
Alias for: message

### Protected Instance Methods

titleize(key) click to toggle source

TODO : remove when html_message is removed

    # File lib/i18n/exceptions.rb, line 85
    def titleize(key)
      key.to_s.gsub('_', ' ').gsub(/\b('?[a-z])/) { $1.capitalize }
    end