gettext_i18n_rails_js 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +13 -9
- data/lib/gettext_i18n_rails_js.rb +4 -11
- data/lib/gettext_i18n_rails_js/parser/base.rb +3 -3
- data/lib/gettext_i18n_rails_js/task.rb +61 -39
- data/lib/gettext_i18n_rails_js/version.rb +1 -1
- metadata +36 -36
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c7e0fb2f88a6468a2479c4df020a0478e8d38f22
|
4
|
+
data.tar.gz: ec358e596d2e1623ff4943f7a99de0a6528ef616
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dfe431a8a0447e24ae7c05722a4086139af9efc5fe176a8bb4c843a5fb74abf681fe4e878fde4670460370e682c0aca63a9547ff68195dbf7cf208fc383fa10d
|
7
|
+
data.tar.gz: 8171393b8f7c459d858ec182a9642ddb6fa21aae74663cbb2f7f620d49d8a3c456315af594f5b68bdfedb586e0bc9ff61121b032c98927f7bd9f8692eab6f316
|
data/CHANGELOG.md
CHANGED
@@ -1,19 +1,23 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [1.0.3](https://github.com/webhippie/gettext_i18n_rails_js/releases/tag/v1.0.3) - 2015-11-03
|
4
|
+
|
5
|
+
* Stop using bundler within the core lib (@domcleal)
|
6
|
+
|
3
7
|
## [1.0.2](https://github.com/webhippie/gettext_i18n_rails_js/releases/tag/v1.0.2) - 2015-03-30
|
4
8
|
|
5
|
-
* Fixes exception when parsing empty js/coffee files
|
6
|
-
* Avoid methods defined in rake task exposing globally
|
7
|
-
* Added better configuration options
|
9
|
+
* Fixes exception when parsing empty js/coffee files (@tboerger)
|
10
|
+
* Avoid methods defined in rake task exposing globally (@tboerger)
|
11
|
+
* Added better configuration options (@tboerger)
|
8
12
|
|
9
13
|
## [1.0.1](https://github.com/webhippie/gettext_i18n_rails_js/releases/tag/v1.0.1) - 2015-02-24
|
10
14
|
|
11
|
-
* Added missing javascripts to the gemspec
|
15
|
+
* Added missing javascripts to the gemspec (@tboerger)
|
12
16
|
|
13
17
|
## [1.0.0](https://github.com/webhippie/gettext_i18n_rails_js/releases/tag/v1.0.0) - 2015-02-24
|
14
18
|
|
15
|
-
* Transfer from github.com/nubis/gettext_i18n_rails_js
|
16
|
-
* Added TravisCI, Rubocop and Coveralls
|
17
|
-
* Updated structure to my opinionated gem style
|
18
|
-
* Changed default handlebars function to ```__```
|
19
|
-
* Added extended ```gettext_i18n_rails_js.yml```
|
19
|
+
* Transfer from github.com/nubis/gettext_i18n_rails_js (@tboerger)
|
20
|
+
* Added TravisCI, Rubocop and Coveralls (@tboerger)
|
21
|
+
* Updated structure to my opinionated gem style (@tboerger)
|
22
|
+
* Changed default handlebars function to ```__``` (@tboerger)
|
23
|
+
* Added extended ```gettext_i18n_rails_js.yml``` (@tboerger)
|
@@ -23,17 +23,10 @@
|
|
23
23
|
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
24
24
|
#
|
25
25
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
Bundler.setup(:default)
|
31
|
-
else
|
32
|
-
gem "rails", version: ">= 3.2.0"
|
33
|
-
gem "gettext", version: ">= 3.0.2"
|
34
|
-
gem "gettext_i18n_rails", version: ">= 0.7.1"
|
35
|
-
gem "po_to_json", version: ">= 0.1.0"
|
36
|
-
end
|
26
|
+
gem "rails", version: ">= 3.2.0"
|
27
|
+
gem "gettext", version: ">= 3.0.2"
|
28
|
+
gem "gettext_i18n_rails", version: ">= 0.7.1"
|
29
|
+
gem "po_to_json", version: ">= 0.1.0"
|
37
30
|
|
38
31
|
require "rails"
|
39
32
|
require "gettext"
|
@@ -28,55 +28,67 @@ module GettextI18nRailsJs
|
|
28
28
|
extend self
|
29
29
|
|
30
30
|
def po_to_json
|
31
|
+
set_config
|
32
|
+
|
33
|
+
if files_list.empty?
|
34
|
+
puts "Couldn't find PO files in #{locale_path}, run 'rake gettext:find'"
|
35
|
+
else
|
36
|
+
files_iterate
|
37
|
+
print_footer
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
protected
|
42
|
+
|
43
|
+
def destination(lang)
|
44
|
+
path = output_path.join(lang)
|
45
|
+
path.mkpath
|
46
|
+
|
47
|
+
path.join("app.js").open("w") do |f|
|
48
|
+
f.rewind
|
49
|
+
f.write yield
|
50
|
+
end
|
51
|
+
|
52
|
+
puts "Created app.js in #{path}"
|
53
|
+
end
|
54
|
+
|
55
|
+
def lang_for(file)
|
56
|
+
file.dirname.basename.to_s
|
57
|
+
end
|
58
|
+
|
59
|
+
def json_for(file)
|
60
|
+
PoToJson.new(
|
61
|
+
file.to_s
|
62
|
+
).generate_for_jed(
|
63
|
+
lang_for(file),
|
64
|
+
GettextI18nRailsJs.config.jed_options
|
65
|
+
)
|
66
|
+
end
|
67
|
+
|
68
|
+
def set_config
|
31
69
|
GettextI18nRailsJs::Parser::Javascript
|
32
70
|
.gettext_function = GettextI18nRailsJs.config.javascript_function
|
33
71
|
|
34
72
|
GettextI18nRailsJs::Parser::Handlebars
|
35
73
|
.gettext_function = GettextI18nRailsJs.config.handlebars_function
|
74
|
+
end
|
36
75
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
# will be referred to as locales['zh-CN']. This is to adapt to the
|
45
|
-
# existing gettext_rails convention.
|
46
|
-
|
47
|
-
language = input.dirname.basename.to_s
|
48
|
-
language_code = language.gsub("_", "-")
|
49
|
-
|
50
|
-
destination = output_path.join(language)
|
51
|
-
destination.mkpath
|
52
|
-
|
53
|
-
json = PoToJson.new(
|
54
|
-
input.to_s
|
55
|
-
).generate_for_jed(
|
56
|
-
language_code,
|
57
|
-
GettextI18nRailsJs.config.jed_options
|
58
|
-
)
|
59
|
-
|
60
|
-
destination.join("app.js").open("w") do |f|
|
61
|
-
f.rewind
|
62
|
-
f.write(json)
|
63
|
-
end
|
64
|
-
|
65
|
-
puts "Created app.js in #{destination}"
|
66
|
-
end
|
76
|
+
def files_iterate
|
77
|
+
files_list.each do |input|
|
78
|
+
# Language is used for filenames, while language code is used as the
|
79
|
+
# in-app language code. So for instance, simplified chinese will live
|
80
|
+
# in app/assets/locale/zh_CN/app.js but inside the file the language
|
81
|
+
# will be referred to as locales['zh-CN']. This is to adapt to the
|
82
|
+
# existing gettext_rails convention.
|
67
83
|
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
puts "//= require gettext/all"
|
74
|
-
puts
|
84
|
+
destination(
|
85
|
+
lang_for(input)
|
86
|
+
) do
|
87
|
+
json_for(input)
|
88
|
+
end
|
75
89
|
end
|
76
90
|
end
|
77
91
|
|
78
|
-
protected
|
79
|
-
|
80
92
|
def files_list
|
81
93
|
require "gettext_i18n_rails/tasks"
|
82
94
|
|
@@ -94,5 +106,15 @@ module GettextI18nRailsJs
|
|
94
106
|
GettextI18nRailsJs.config.output_path
|
95
107
|
)
|
96
108
|
end
|
109
|
+
|
110
|
+
def print_footer
|
111
|
+
puts
|
112
|
+
puts "All files created, make sure they are being added to your assets."
|
113
|
+
puts "If they are not, you can add them with this line (configurable):"
|
114
|
+
puts
|
115
|
+
puts "//= require_tree ./locale"
|
116
|
+
puts "//= require gettext/all"
|
117
|
+
puts
|
118
|
+
end
|
97
119
|
end
|
98
120
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gettext_i18n_rails_js
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thomas Boerger
|
@@ -9,118 +9,118 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-03
|
12
|
+
date: 2015-11-03 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
requirements:
|
18
|
-
- -
|
18
|
+
- - ">="
|
19
19
|
- !ruby/object:Gem::Version
|
20
20
|
version: '0'
|
21
21
|
type: :development
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
|
-
- -
|
25
|
+
- - ">="
|
26
26
|
- !ruby/object:Gem::Version
|
27
27
|
version: '0'
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: rake
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
31
31
|
requirements:
|
32
|
-
- -
|
32
|
+
- - ">="
|
33
33
|
- !ruby/object:Gem::Version
|
34
34
|
version: '0'
|
35
35
|
type: :development
|
36
36
|
prerelease: false
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
|
-
- -
|
39
|
+
- - ">="
|
40
40
|
- !ruby/object:Gem::Version
|
41
41
|
version: '0'
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
43
|
name: yard
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
45
45
|
requirements:
|
46
|
-
- -
|
46
|
+
- - ">="
|
47
47
|
- !ruby/object:Gem::Version
|
48
48
|
version: '0'
|
49
49
|
type: :development
|
50
50
|
prerelease: false
|
51
51
|
version_requirements: !ruby/object:Gem::Requirement
|
52
52
|
requirements:
|
53
|
-
- -
|
53
|
+
- - ">="
|
54
54
|
- !ruby/object:Gem::Version
|
55
55
|
version: '0'
|
56
56
|
- !ruby/object:Gem::Dependency
|
57
57
|
name: rspec
|
58
58
|
requirement: !ruby/object:Gem::Requirement
|
59
59
|
requirements:
|
60
|
-
- -
|
60
|
+
- - ">="
|
61
61
|
- !ruby/object:Gem::Version
|
62
62
|
version: '0'
|
63
63
|
type: :development
|
64
64
|
prerelease: false
|
65
65
|
version_requirements: !ruby/object:Gem::Requirement
|
66
66
|
requirements:
|
67
|
-
- -
|
67
|
+
- - ">="
|
68
68
|
- !ruby/object:Gem::Version
|
69
69
|
version: '0'
|
70
70
|
- !ruby/object:Gem::Dependency
|
71
71
|
name: rails
|
72
72
|
requirement: !ruby/object:Gem::Requirement
|
73
73
|
requirements:
|
74
|
-
- -
|
74
|
+
- - ">="
|
75
75
|
- !ruby/object:Gem::Version
|
76
76
|
version: 3.2.0
|
77
77
|
type: :runtime
|
78
78
|
prerelease: false
|
79
79
|
version_requirements: !ruby/object:Gem::Requirement
|
80
80
|
requirements:
|
81
|
-
- -
|
81
|
+
- - ">="
|
82
82
|
- !ruby/object:Gem::Version
|
83
83
|
version: 3.2.0
|
84
84
|
- !ruby/object:Gem::Dependency
|
85
85
|
name: gettext
|
86
86
|
requirement: !ruby/object:Gem::Requirement
|
87
87
|
requirements:
|
88
|
-
- -
|
88
|
+
- - ">="
|
89
89
|
- !ruby/object:Gem::Version
|
90
90
|
version: 3.0.2
|
91
91
|
type: :runtime
|
92
92
|
prerelease: false
|
93
93
|
version_requirements: !ruby/object:Gem::Requirement
|
94
94
|
requirements:
|
95
|
-
- -
|
95
|
+
- - ">="
|
96
96
|
- !ruby/object:Gem::Version
|
97
97
|
version: 3.0.2
|
98
98
|
- !ruby/object:Gem::Dependency
|
99
99
|
name: gettext_i18n_rails
|
100
100
|
requirement: !ruby/object:Gem::Requirement
|
101
101
|
requirements:
|
102
|
-
- -
|
102
|
+
- - ">="
|
103
103
|
- !ruby/object:Gem::Version
|
104
104
|
version: 0.7.1
|
105
105
|
type: :runtime
|
106
106
|
prerelease: false
|
107
107
|
version_requirements: !ruby/object:Gem::Requirement
|
108
108
|
requirements:
|
109
|
-
- -
|
109
|
+
- - ">="
|
110
110
|
- !ruby/object:Gem::Version
|
111
111
|
version: 0.7.1
|
112
112
|
- !ruby/object:Gem::Dependency
|
113
113
|
name: po_to_json
|
114
114
|
requirement: !ruby/object:Gem::Requirement
|
115
115
|
requirements:
|
116
|
-
- -
|
116
|
+
- - ">="
|
117
117
|
- !ruby/object:Gem::Version
|
118
118
|
version: 1.0.0
|
119
119
|
type: :runtime
|
120
120
|
prerelease: false
|
121
121
|
version_requirements: !ruby/object:Gem::Requirement
|
122
122
|
requirements:
|
123
|
-
- -
|
123
|
+
- - ">="
|
124
124
|
- !ruby/object:Gem::Version
|
125
125
|
version: 1.0.0
|
126
126
|
description: |2
|
@@ -136,28 +136,28 @@ extensions: []
|
|
136
136
|
extra_rdoc_files: []
|
137
137
|
files:
|
138
138
|
- CHANGELOG.md
|
139
|
-
- README.md
|
140
139
|
- LICENSE
|
141
|
-
-
|
142
|
-
- lib/gettext_i18n_rails_js.rb
|
140
|
+
- README.md
|
143
141
|
- lib/assets/javascripts/gettext/all.js
|
144
|
-
- lib/gettext_i18n_rails_js
|
142
|
+
- lib/gettext_i18n_rails_js.rb
|
145
143
|
- lib/gettext_i18n_rails_js/config.rb
|
146
144
|
- lib/gettext_i18n_rails_js/engine.rb
|
147
|
-
- lib/gettext_i18n_rails_js/
|
145
|
+
- lib/gettext_i18n_rails_js/parser.rb
|
148
146
|
- lib/gettext_i18n_rails_js/parser/base.rb
|
149
147
|
- lib/gettext_i18n_rails_js/parser/handlebars.rb
|
150
148
|
- lib/gettext_i18n_rails_js/parser/javascript.rb
|
151
|
-
- lib/gettext_i18n_rails_js/
|
152
|
-
-
|
153
|
-
-
|
149
|
+
- lib/gettext_i18n_rails_js/task.rb
|
150
|
+
- lib/gettext_i18n_rails_js/version.rb
|
151
|
+
- lib/tasks/gettext_i18n_rails_js_tasks.rake
|
154
152
|
- spec/fixtures/example.coffee
|
155
|
-
- spec/fixtures/example.js
|
156
153
|
- spec/fixtures/example.handlebars
|
157
|
-
- spec/
|
158
|
-
- spec/gettext_i18n_rails_js_spec.rb
|
154
|
+
- spec/fixtures/example.js
|
159
155
|
- spec/gettext_i18n_rails_js/parser/handlebars_spec.rb
|
160
156
|
- spec/gettext_i18n_rails_js/parser/javascript_spec.rb
|
157
|
+
- spec/gettext_i18n_rails_js_spec.rb
|
158
|
+
- spec/spec_helper.rb
|
159
|
+
- spec/support/with_file.rb
|
160
|
+
- vendor/assets/javascripts/gettext/jed.js
|
161
161
|
homepage: https://github.com/webhippie/gettext_i18n_rails_js
|
162
162
|
licenses:
|
163
163
|
- MIT
|
@@ -168,28 +168,28 @@ require_paths:
|
|
168
168
|
- lib
|
169
169
|
required_ruby_version: !ruby/object:Gem::Requirement
|
170
170
|
requirements:
|
171
|
-
- -
|
171
|
+
- - ">="
|
172
172
|
- !ruby/object:Gem::Version
|
173
173
|
version: 1.9.3
|
174
174
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
175
175
|
requirements:
|
176
|
-
- -
|
176
|
+
- - ">="
|
177
177
|
- !ruby/object:Gem::Version
|
178
178
|
version: '0'
|
179
179
|
requirements: []
|
180
180
|
rubyforge_project:
|
181
|
-
rubygems_version: 2.
|
181
|
+
rubygems_version: 2.4.5.1
|
182
182
|
signing_key:
|
183
183
|
specification_version: 4
|
184
184
|
summary: Extends gettext_i18n_rails making your .po files available to client side
|
185
185
|
javascript as JSON
|
186
186
|
test_files:
|
187
|
-
- spec/spec_helper.rb
|
188
187
|
- spec/fixtures/example.coffee
|
189
|
-
- spec/fixtures/example.js
|
190
188
|
- spec/fixtures/example.handlebars
|
191
|
-
- spec/
|
192
|
-
- spec/gettext_i18n_rails_js_spec.rb
|
189
|
+
- spec/fixtures/example.js
|
193
190
|
- spec/gettext_i18n_rails_js/parser/handlebars_spec.rb
|
194
191
|
- spec/gettext_i18n_rails_js/parser/javascript_spec.rb
|
192
|
+
- spec/gettext_i18n_rails_js_spec.rb
|
193
|
+
- spec/spec_helper.rb
|
194
|
+
- spec/support/with_file.rb
|
195
195
|
has_rdoc:
|