nulogy-gettext_i18n_rails 0.5.0.3 → 0.5.3.1

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- gettext_i18n_rails (0.5.0.2)
4
+ gettext_i18n_rails (0.5.3)
5
5
  fast_gettext
6
6
 
7
7
  GEM
@@ -41,7 +41,7 @@ GEM
41
41
  builder (3.0.0)
42
42
  diff-lcs (1.1.2)
43
43
  erubis (2.7.0)
44
- fast_gettext (0.6.7)
44
+ fast_gettext (0.5.13)
45
45
  gettext (2.1.0)
46
46
  locale (>= 2.0.5)
47
47
  haml (3.1.4)
@@ -4,4 +4,25 @@ module ActiveModel
4
4
  _(@klass.humanize_class_name)
5
5
  end
6
6
  end
7
+
8
+ module Translation
9
+ # CarDealer.sales_count -> s_('CarDealer|Sales count') -> 'Sales count' if no translation was found
10
+ def human_attribute_name(attribute, *args)
11
+ s_(gettext_translation_for_attribute_name(attribute))
12
+ end
13
+
14
+ def gettext_translation_for_attribute_name(attribute)
15
+ attribute = attribute.to_s
16
+ if attribute.ends_with?('_id')
17
+ humanize_class_name(attribute)
18
+ else
19
+ "#{self}|#{attribute.split('.').map! {|a| a.humanize }.join('|')}"
20
+ end
21
+ end
22
+
23
+ def humanize_class_name(name=nil)
24
+ name ||= self.to_s
25
+ name.underscore.humanize
26
+ end
27
+ end
7
28
  end
@@ -1,25 +1,9 @@
1
1
  module GettextI18nRails::ActiveRecord
2
- # CarDealer.sales_count -> s_('CarDealer|Sales count') -> 'Sales count' if no translation was found
3
- def human_attribute_name(attribute, *args)
4
- s_(gettext_translation_for_attribute_name(attribute))
5
- end
6
-
7
- # method deprecated in Rails 3.1
8
- def human_name(*args)
9
- _(self.humanize_class_name)
10
- end
11
-
12
- def humanize_class_name(name=nil)
13
- name ||= self.to_s
14
- name.underscore.humanize
15
- end
2
+ include ActiveModel::Translation
16
3
 
17
- def gettext_translation_for_attribute_name(attribute)
18
- attribute = attribute.to_s
19
- if attribute.ends_with?('_id')
20
- humanize_class_name(attribute)
21
- else
22
- "#{self}|#{attribute.split('.').map! {|a| a.humanize }.join('|')}"
4
+ # method deprecated in Rails 3.1
5
+ def human_name(*args)
6
+ _(self.humanize_class_name)
23
7
  end
24
8
  end
25
9
  end
@@ -13,7 +13,6 @@ if defined?(Rails::Railtie)
13
13
  config.after_initialize do |app|
14
14
  if app.config.gettext_i18n_rails.use_for_active_record_attributes
15
15
  ActiveSupport.on_load :active_record do
16
- extend GettextI18nRails::ActiveRecord
17
16
  require 'gettext_i18n_rails/active_model.rb'
18
17
  end
19
18
  end
@@ -1,3 +1,3 @@
1
1
  module GettextI18nRails
2
- Version = VERSION = '0.5.0.3'
2
+ Version = VERSION = '0.5.3.1'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nulogy-gettext_i18n_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0.3
4
+ version: 0.5.3.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: