i18n-js 0.1.2 → 0.1.3

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.
@@ -48,7 +48,7 @@ module SimplesIdeias
48
48
  end
49
49
 
50
50
  # Copy configuration and JavaScript library files to
51
- # <tt>SimplesIdeias::I18n::CONFIG_FILE</tt> and <tt>public/i18n.js</tt>.
51
+ # <tt>config/i18n-js.yml</tt> and <tt>public/javascripts/i18n.js</tt>.
52
52
  def setup!
53
53
  FileUtils.cp File.dirname(__FILE__) + "/../source/i18n.js", javascript_file
54
54
  FileUtils.cp(File.dirname(__FILE__) + "/../source/i18n-js.yml", config_file) unless config?
@@ -69,7 +69,7 @@ module SimplesIdeias
69
69
  File.open(file, "w+") do |f|
70
70
  f << %(var I18n = I18n || {};\n)
71
71
  f << %(I18n.translations = );
72
- f << sorted_hash(translations, true).to_json
72
+ f << translations.to_json
73
73
  f << %(;)
74
74
  end
75
75
  end
@@ -118,21 +118,5 @@ module SimplesIdeias
118
118
  def deep_merge!(target, hash) # :nodoc:
119
119
  target.merge!(hash, &MERGER)
120
120
  end
121
-
122
- # Taken from http://seb.box.re/2010/1/15/deep-hash-ordering-with-ruby-1-8/
123
- def sorted_hash(object, deep = false) # :nodoc:
124
- if object.is_a?(Hash)
125
- res = ActiveSupport::OrderedHash.new.tap do |map|
126
- object.each {|k, v| map[k] = deep ? sorted_hash(v, deep) : v }
127
- end
128
- return res.class[res.sort {|a, b| a[0].to_s <=> b[0].to_s } ]
129
- elsif deep && object.is_a?(Array)
130
- array = Array.new
131
- object.each_with_index {|v, i| array[i] = sorted_hash(v, deep) }
132
- return array
133
- else
134
- return object
135
- end
136
- end
137
121
  end
138
122
  end
@@ -3,7 +3,7 @@ module SimplesIdeias
3
3
  module Version
4
4
  MAJOR = 0
5
5
  MINOR = 1
6
- PATCH = 2
6
+ PATCH = 3
7
7
  STRING = "#{MAJOR}.#{MINOR}.#{PATCH}"
8
8
  end
9
9
  end
@@ -131,18 +131,6 @@ class I18nJSTest < ActiveSupport::TestCase
131
131
  assert_equal target[:a], {:b => 1, :c => 2}
132
132
  end
133
133
 
134
- test "sorted hash" do
135
- assert_equal [:a, :b, :c], SimplesIdeias::I18n.sorted_hash(:b => 1, :a => 2, :c => 3).keys
136
- end
137
-
138
- test "sorted multi-levels hash" do
139
- hash = {
140
- :foo => {:b => 1, :a => 2, :c => 3}
141
- }
142
-
143
- assert_equal [:a, :b, :c], SimplesIdeias::I18n.sorted_hash(hash[:foo]).keys
144
- end
145
-
146
134
  test "update javascript library" do
147
135
  FakeWeb.register_uri(:get, "http://github.com/fnando/i18n-js/raw/master/lib/i18n.js", :body => "UPDATED")
148
136
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: i18n-js
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nando Vieira