Class: I18n::Backend::ActiveRecord::Translation

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
lib/active_support/vendor/i18n-0.3.7/i18n/backend/active_record/translation.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.available_localesObject



69
70
71
# File 'lib/active_support/vendor/i18n-0.3.7/i18n/backend/active_record/translation.rb', line 69

def self.available_locales
  Translation.find(:all, :select => 'DISTINCT locale').map { |t| t.locale.to_sym }
end

Instance Method Details

#interpolates?(key) ⇒ Boolean

Returns:

  • (Boolean)


73
74
75
# File 'lib/active_support/vendor/i18n-0.3.7/i18n/backend/active_record/translation.rb', line 73

def interpolates?(key)
  self.interpolations.include?(key) if self.interpolations
end

#valueObject



77
78
79
80
81
82
83
84
# File 'lib/active_support/vendor/i18n-0.3.7/i18n/backend/active_record/translation.rb', line 77

def value
  if is_proc
    Kernel.eval(read_attribute(:value))
  else
    value = read_attribute(:value)
    value == 'f' ? false : value
  end
end