i18n-js 2.0.0 → 2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +2 -2
- data/i18n-js.gemspec +1 -1
- data/lib/i18n-js.rb +12 -6
- data/lib/i18n-js/version.rb +1 -1
- data/spec/i18n_spec.rb +7 -0
- data/spec/resources/js_file_per_locale.yml +3 -0
- metadata +24 -22
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
i18n-js (2.0.
|
4
|
+
i18n-js (2.0.1)
|
5
5
|
i18n
|
6
6
|
|
7
7
|
GEM
|
@@ -45,7 +45,7 @@ DEPENDENCIES
|
|
45
45
|
activesupport (>= 3.0.0)
|
46
46
|
fakeweb
|
47
47
|
i18n-js!
|
48
|
-
rake
|
48
|
+
rake
|
49
49
|
rspec (~> 2.6)
|
50
50
|
ruby-debug19
|
51
51
|
spec-js (~> 0.1.0.beta.0)
|
data/i18n-js.gemspec
CHANGED
@@ -23,6 +23,6 @@ Gem::Specification.new do |s|
|
|
23
23
|
s.add_development_dependency "rspec", "~> 2.6"
|
24
24
|
s.add_development_dependency "ruby-debug19"
|
25
25
|
s.add_development_dependency "spec-js", "~> 0.1.0.beta.0"
|
26
|
-
s.add_development_dependency "rake"
|
26
|
+
s.add_development_dependency "rake"
|
27
27
|
s.add_development_dependency "ruby-debug19"
|
28
28
|
end
|
data/lib/i18n-js.rb
CHANGED
@@ -32,13 +32,19 @@ module SimplesIdeias
|
|
32
32
|
def export!
|
33
33
|
if config?
|
34
34
|
for options in config[:translations]
|
35
|
-
options
|
36
|
-
|
37
|
-
|
38
|
-
|
35
|
+
if options[:file] =~ ::I18n::INTERPOLATION_PATTERN
|
36
|
+
::I18n.available_locales.each do |locale|
|
37
|
+
result = scoped_translations("#{locale}.#{options[:only]}")
|
38
|
+
save result, ::I18n.interpolate(options[:file],{:locale => locale}) unless result.empty?
|
39
|
+
end
|
39
40
|
else
|
40
|
-
|
41
|
-
|
41
|
+
options.reverse_merge!(:only => "*")
|
42
|
+
if options[:only] == "*"
|
43
|
+
save translations, options[:file]
|
44
|
+
else
|
45
|
+
result = scoped_translations(options[:only])
|
46
|
+
save result, options[:file] unless result.empty?
|
47
|
+
end
|
42
48
|
end
|
43
49
|
end
|
44
50
|
else
|
data/lib/i18n-js/version.rb
CHANGED
data/spec/i18n_spec.rb
CHANGED
@@ -88,6 +88,13 @@ describe SimplesIdeias::I18n do
|
|
88
88
|
File.should be_file(Rails.root.join("public/javascripts/tudo.js"))
|
89
89
|
end
|
90
90
|
|
91
|
+
it "exports to a JS file per available locale" do
|
92
|
+
set_config "js_file_per_locale.yml"
|
93
|
+
SimplesIdeias::I18n.export!
|
94
|
+
|
95
|
+
File.should be_file(Rails.root.join("public/javascripts/i18n/en.js"))
|
96
|
+
end
|
97
|
+
|
91
98
|
it "exports with multiple conditions" do
|
92
99
|
set_config "multiple_conditions.yml"
|
93
100
|
SimplesIdeias::I18n.export!
|
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: 2.0.
|
4
|
+
version: 2.0.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-09-
|
12
|
+
date: 2011-09-29 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: i18n
|
16
|
-
requirement: &
|
16
|
+
requirement: &70095310296720 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70095310296720
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: fakeweb
|
27
|
-
requirement: &
|
27
|
+
requirement: &70095310295900 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70095310295900
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: activesupport
|
38
|
-
requirement: &
|
38
|
+
requirement: &70095310294720 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: 3.0.0
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70095310294720
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: rspec
|
49
|
-
requirement: &
|
49
|
+
requirement: &70095310293520 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ~>
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: '2.6'
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70095310293520
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: ruby-debug19
|
60
|
-
requirement: &
|
60
|
+
requirement: &70095310293060 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ! '>='
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: '0'
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *70095310293060
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: spec-js
|
71
|
-
requirement: &
|
71
|
+
requirement: &70095310292000 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ~>
|
@@ -76,21 +76,21 @@ dependencies:
|
|
76
76
|
version: 0.1.0.beta.0
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *70095310292000
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: rake
|
82
|
-
requirement: &
|
82
|
+
requirement: &70095310290820 !ruby/object:Gem::Requirement
|
83
83
|
none: false
|
84
84
|
requirements:
|
85
|
-
- -
|
85
|
+
- - ! '>='
|
86
86
|
- !ruby/object:Gem::Version
|
87
|
-
version: 0
|
87
|
+
version: '0'
|
88
88
|
type: :development
|
89
89
|
prerelease: false
|
90
|
-
version_requirements: *
|
90
|
+
version_requirements: *70095310290820
|
91
91
|
- !ruby/object:Gem::Dependency
|
92
92
|
name: ruby-debug19
|
93
|
-
requirement: &
|
93
|
+
requirement: &70095310288840 !ruby/object:Gem::Requirement
|
94
94
|
none: false
|
95
95
|
requirements:
|
96
96
|
- - ! '>='
|
@@ -98,7 +98,7 @@ dependencies:
|
|
98
98
|
version: '0'
|
99
99
|
type: :development
|
100
100
|
prerelease: false
|
101
|
-
version_requirements: *
|
101
|
+
version_requirements: *70095310288840
|
102
102
|
description: It's a small library to provide the Rails I18n translations on the Javascript.
|
103
103
|
email:
|
104
104
|
- fnando.vieira@gmail.com
|
@@ -124,6 +124,7 @@ files:
|
|
124
124
|
- spec/i18n_spec.rb
|
125
125
|
- spec/resources/custom_path.yml
|
126
126
|
- spec/resources/default.yml
|
127
|
+
- spec/resources/js_file_per_locale.yml
|
127
128
|
- spec/resources/locales.yml
|
128
129
|
- spec/resources/multiple_conditions.yml
|
129
130
|
- spec/resources/multiple_files.yml
|
@@ -145,7 +146,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
145
146
|
version: '0'
|
146
147
|
segments:
|
147
148
|
- 0
|
148
|
-
hash:
|
149
|
+
hash: 3561709874973960636
|
149
150
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
150
151
|
none: false
|
151
152
|
requirements:
|
@@ -154,7 +155,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
154
155
|
version: '0'
|
155
156
|
segments:
|
156
157
|
- 0
|
157
|
-
hash:
|
158
|
+
hash: 3561709874973960636
|
158
159
|
requirements: []
|
159
160
|
rubyforge_project:
|
160
161
|
rubygems_version: 1.8.10
|
@@ -166,6 +167,7 @@ test_files:
|
|
166
167
|
- spec/i18n_spec.rb
|
167
168
|
- spec/resources/custom_path.yml
|
168
169
|
- spec/resources/default.yml
|
170
|
+
- spec/resources/js_file_per_locale.yml
|
169
171
|
- spec/resources/locales.yml
|
170
172
|
- spec/resources/multiple_conditions.yml
|
171
173
|
- spec/resources/multiple_files.yml
|