Module: I18n::Backend::Metadata

Defined in:
lib/i18n/backend/metadata.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/i18n/backend/metadata.rb', line 23

def included(base)
  Object.class_eval do
    def 
      unless self.frozen?
        @translation_metadata ||= {}
      else
        {}
      end
    end

    def translation_metadata=()
      @translation_metadata =  unless self.frozen?
    end
  end unless Object.method_defined?(:translation_metadata)
end

Instance Method Details

#interpolate(locale, entry, values = EMPTY_HASH) ⇒ Object



52
53
54
55
# File 'lib/i18n/backend/metadata.rb', line 52

def interpolate(locale, entry, values = EMPTY_HASH)
   = entry..merge(:original => entry)
  () { super }
end

#pluralize(locale, entry, count) ⇒ Object



57
58
59
# File 'lib/i18n/backend/metadata.rb', line 57

def pluralize(locale, entry, count)
  (:count => count) { super }
end

#translate(locale, key, options = EMPTY_HASH) ⇒ Object



40
41
42
43
44
45
46
47
48
49
50
# File 'lib/i18n/backend/metadata.rb', line 40

def translate(locale, key, options = EMPTY_HASH)
   = {
    :locale    => locale,
    :key       => key,
    :scope     => options[:scope],
    :default   => options[:default],
    :separator => options[:separator],
    :values    => options.reject { |name, _value| RESERVED_KEYS.include?(name) }
  }
  () { super }
end