Sha256: 554857c3b0a84f1f35f9553caa7769372183ca7370ac0a0fd82275d70ec041e8

Contents?: true

Size: 491 Bytes

Versions: 15

Compression:

Stored size: 491 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.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

15 entries across 15 versions & 2 rubygems

Version Path
zena-0.16.9 vendor/plugins/gettext_i18n_rails/lib/gettext_i18n_rails/active_record.rb
zena-0.16.8 vendor/plugins/gettext_i18n_rails/lib/gettext_i18n_rails/active_record.rb
zena-0.16.7 vendor/plugins/gettext_i18n_rails/lib/gettext_i18n_rails/active_record.rb
gettext_i18n_rails-0.1.1 lib/gettext_i18n_rails/active_record.rb
gettext_i18n_rails-0.1.0 lib/gettext_i18n_rails/active_record.rb
zena-0.16.6 vendor/plugins/gettext_i18n_rails/lib/gettext_i18n_rails/active_record.rb
zena-0.16.5 vendor/plugins/gettext_i18n_rails/lib/gettext_i18n_rails/active_record.rb
zena-0.16.4 vendor/plugins/gettext_i18n_rails/lib/gettext_i18n_rails/active_record.rb
zena-0.16.3 vendor/plugins/gettext_i18n_rails/lib/gettext_i18n_rails/active_record.rb
zena-0.16.2 vendor/plugins/gettext_i18n_rails/lib/gettext_i18n_rails/active_record.rb
zena-0.16.1 vendor/plugins/gettext_i18n_rails/lib/gettext_i18n_rails/active_record.rb
zena-0.16.0 vendor/plugins/gettext_i18n_rails/lib/gettext_i18n_rails/active_record.rb
zena-0.15.2 vendor/plugins/gettext_i18n_rails/lib/gettext_i18n_rails/active_record.rb
zena-0.15.1 vendor/plugins/gettext_i18n_rails/lib/gettext_i18n_rails/active_record.rb
zena-0.15.0 vendor/plugins/gettext_i18n_rails/lib/gettext_i18n_rails/active_record.rb