whowish_word 0.5.4 → 0.5.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -31,10 +31,28 @@ module WhowishWord
31
31
 
32
32
  I18n::MissingTranslation::Base.class_eval do
33
33
  def html_message
34
- key = keys.last.to_s.gsub('_', ' ').gsub(/\b('?[a-z])/) { $1.capitalize }
34
+ key = keys.last.to_s.gsub('_', ' ').gsub(/\b('?[a-z])/) { $1 }
35
35
  key
36
36
  end
37
37
  end
38
+
39
+ I18n.class_eval do
40
+ class << self
41
+ def interpolate_hash(string, values)
42
+ string.gsub(I18n::INTERPOLATION_PATTERN) do |match|
43
+ if match == '%%'
44
+ '%'
45
+ else
46
+ key = ($1 || $2).to_sym
47
+ value = values.key?(key) ? values[key] : "%{#{key}}" #raise(MissingInterpolationArgument.new(values, string))
48
+ value = value.call(values) if value.respond_to?(:call)
49
+ $3 ? sprintf("%#{$3}", value) : value
50
+ end
51
+ end
52
+ end
53
+ end
54
+ end
55
+
38
56
  end
39
57
 
40
58
  extend self
data/whowish_word.gemspec CHANGED
@@ -3,7 +3,7 @@ $:.push File.expand_path("../lib", __FILE__)
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "whowish_word"
6
- s.version = "0.5.4"
6
+ s.version = "0.5.5"
7
7
  s.platform = Gem::Platform::RUBY
8
8
  s.authors = ["Tanin Na Nakorn"]
9
9
  s.email = ["tanin47@yahoo.com"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: whowish_word
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.4
4
+ version: 0.5.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-06-24 00:00:00.000000000 Z
12
+ date: 2012-07-14 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Inline internationlization for Rails 3.2.*
15
15
  email: