i18n_rails_helpers 1.4.2 → 1.4.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -36,7 +36,7 @@ module I18nHelpers
36
36
  # t_model(Account.new) => 'Konto'
37
37
  # t_model => 'Konto' # when called in patients_controller views
38
38
  #
39
- def t_model(model = nil)
39
+ def t_model(model = nil, options = {})
40
40
  if model.is_a? Class
41
41
  model_name = model.name.underscore
42
42
  elsif model.nil?
@@ -44,7 +44,10 @@ module I18nHelpers
44
44
  else
45
45
  model_name = model.class.name.underscore
46
46
  end
47
- I18n::translate(model_name, :scope => [:activerecord, :models])
47
+
48
+ options[:scope] = [:activerecord, :models]
49
+ options[:count] ||= 1
50
+ I18n::translate(model_name, *options)
48
51
  end
49
52
 
50
53
  # Returns translated title for current +action+ on +model+.
@@ -78,7 +81,7 @@ module I18nHelpers
78
81
  I18n::translate("#{context}.#{action}.title", :default => [:"crud.title.#{action}"], :model => t_model(model))
79
82
  end
80
83
  alias :t_crud :t_title
81
-
84
+
82
85
  # Returns translated string for current +action+.
83
86
  #
84
87
  # If no +action+ is given, it uses the current action.
@@ -94,7 +97,7 @@ module I18nHelpers
94
97
  action ||= action_name
95
98
  I18n::translate(action, :scope => 'crud.action', :model => t_model(model))
96
99
  end
97
-
100
+
98
101
  # Returns translated deletion confirmation for +record+.
99
102
  #
100
103
  # It uses +record+.to_s in the message.
@@ -2,5 +2,5 @@
2
2
 
3
3
  = boot_page_title
4
4
 
5
- = paginate collection
5
+ = paginate collection if defined?(paginate)
6
6
  = render "list"
@@ -1,3 +1,3 @@
1
1
  module I18nRailsHelpers
2
- VERSION = "1.4.2"
2
+ VERSION = "1.4.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: i18n_rails_helpers
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.2
4
+ version: 1.4.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: