Sha256: bcb68c23850d5b01179166440c4c8b9d5e7ac74f090000f732ef06e48a1a1388

Contents?: true

Size: 581 Bytes

Versions: 25

Compression:

Stored size: 581 Bytes

Contents

class ActiveRecord::Base
  # CarDealer.sales_count -> s_('CarDealer|Sales count') -> 'Sales count' if no translation was found
  def self.human_attribute_name(attribute, *args)
    s_(gettext_translation_for_attribute_name(attribute))
  end

  # CarDealer -> _('car dealer')
  def self.human_name(*args)
    _(self.human_name_without_translation)
  end

  def self.human_name_without_translation
    self.to_s.underscore.gsub('_',' ')
  end

  private

  def self.gettext_translation_for_attribute_name(attribute)
    "#{self}|#{attribute.to_s.gsub('_',' ').capitalize}"
  end
end

Version data entries

25 entries across 25 versions & 2 rubygems

Version Path
zena-1.0.0.rc2 vendor/plugins/gettext_i18n_rails/lib/gettext_i18n_rails/active_record.rb
zena-1.0.0.rc1 vendor/plugins/gettext_i18n_rails/lib/gettext_i18n_rails/active_record.rb
gettext_i18n_rails-0.2.15 lib/gettext_i18n_rails/active_record.rb
gettext_i18n_rails-0.2.14 lib/gettext_i18n_rails/active_record.rb
gettext_i18n_rails-0.2.13 lib/gettext_i18n_rails/active_record.rb
gettext_i18n_rails-0.2.12 lib/gettext_i18n_rails/active_record.rb
gettext_i18n_rails-0.2.11 lib/gettext_i18n_rails/active_record.rb
gettext_i18n_rails-0.2.10 lib/gettext_i18n_rails/active_record.rb
gettext_i18n_rails-0.2.9 lib/gettext_i18n_rails/active_record.rb
gettext_i18n_rails-0.2.8 lib/gettext_i18n_rails/active_record.rb
gettext_i18n_rails-0.2.7 lib/gettext_i18n_rails/active_record.rb
gettext_i18n_rails-0.2.6 lib/gettext_i18n_rails/active_record.rb
gettext_i18n_rails-0.2.5 lib/gettext_i18n_rails/active_record.rb
gettext_i18n_rails-0.2.4 lib/gettext_i18n_rails/active_record.rb
zena-1.0.0.beta3 vendor/plugins/gettext_i18n_rails/lib/gettext_i18n_rails/active_record.rb
gettext_i18n_rails-0.2.3 lib/gettext_i18n_rails/active_record.rb
gettext_i18n_rails-0.2.2 lib/gettext_i18n_rails/active_record.rb
zena-1.0.0.beta2 vendor/plugins/gettext_i18n_rails/lib/gettext_i18n_rails/active_record.rb
zena-1.0.0.beta1 vendor/plugins/gettext_i18n_rails/lib/gettext_i18n_rails/active_record.rb
gettext_i18n_rails-0.2.1 lib/gettext_i18n_rails/active_record.rb