air18n 0.1.46 → 0.1.47

Sign up to get free protection for your applications and to get access to all the features.
@@ -55,15 +55,25 @@ module Air18n
55
55
  # => '%{smart_count} Review||||%{smart_count} Reviews'
56
56
  def pluralize(count, singular, plural=nil)
57
57
  raise TypeError if count.is_a?(String)
58
- default_text = "%{smart_count} #{singular}#{SmartCount::DELIMITER}%{smart_count} #{plural || singular.pluralize}"
59
- key = "shared.pluralize.#{singular}"
58
+ default_text = "%{smart_count} #{singular}#{SmartCount::DELIMITER}" +
59
+ "%{smart_count} #{plural || singular.pluralize}"
60
60
  if count == nil
61
- translate(key, :default => default_text, :suppress_ct => true)
61
+ translate(pluralize_key(singular),
62
+ :default => default_text,
63
+ :suppress_ct => true)
62
64
  else
63
- translate(key, :default => default_text, :smart_count => count, :suppress_ct => true)
65
+ translate(pluralize_key(singular),
66
+ :default => default_text,
67
+ :smart_count => count,
68
+ :suppress_ct => true)
64
69
  end
65
70
  end
66
71
 
72
+ # Returns the phrase key used by pluralize().
73
+ def pluralize_key(singular)
74
+ "shared.pluralize.#{singular}"
75
+ end
76
+
67
77
  # For given locale (like :en, :en-GB, :pt-PT, or "en", "en-GB", "pt-PT"),
68
78
  # returns the "language" part (like :en or :pt).
69
79
  # If locale is invalid or nil, returns the default language.
@@ -1,3 +1,3 @@
1
1
  module Air18n
2
- VERSION = "0.1.46"
2
+ VERSION = "0.1.47"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: air18n
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.46
4
+ version: 0.1.47
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: