po_to_json 0.1.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/po_to_json.rb +4 -4
- data/lib/po_to_json/version.rb +2 -2
- data/spec/fixtures/test.po +5 -5
- data/spec/po_to_json_spec.rb +16 -16
- metadata +19 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1aee0b68cf67192ce248eec6d24495e4dad42bb5
|
4
|
+
data.tar.gz: 5075e170a26556b4523e630281dc11284b908bd4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 11910e0ed416033b1ca7ebafabe2528530cb28b902091451f826abf9be0f97a6647322a8a8b4d49cba627f61bb0934c8f6d0157bf38e96239a19b7955861c310
|
7
|
+
data.tar.gz: 06db938002cf111188f1a0838631895fdd6e6f847905b669573c829d7e061db50fb796f0b8716fb20552252560e6156e2c21ba4119fa8c2e0940ee725adc1c2c
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [1.0.0](https://github.com/webhippie/po_to_json/releases/tag/v0.1.0) - 2015-03-19
|
4
|
+
|
5
|
+
* BREAKING: Made result compatible to current Jed (#4)
|
6
|
+
|
3
7
|
## [0.1.0](https://github.com/webhippie/po_to_json/releases/tag/v0.1.0) - 2015-02-19
|
4
8
|
|
5
9
|
* Transfer from github.com/nubis/po_to_json
|
data/lib/po_to_json.rb
CHANGED
@@ -98,7 +98,7 @@ class PoToJson
|
|
98
98
|
def parse_header
|
99
99
|
return if reject_header
|
100
100
|
|
101
|
-
values[""][
|
101
|
+
values[""][0].split("\\n").each do |line|
|
102
102
|
next if line.empty?
|
103
103
|
build_header_for(line)
|
104
104
|
end
|
@@ -107,7 +107,7 @@ class PoToJson
|
|
107
107
|
end
|
108
108
|
|
109
109
|
def reject_header
|
110
|
-
if values[""].nil? || values[""][
|
110
|
+
if values[""].nil? || values[""][0].nil?
|
111
111
|
values[""] = {}
|
112
112
|
true
|
113
113
|
else
|
@@ -173,11 +173,11 @@ class PoToJson
|
|
173
173
|
trans[$1.to_i] = string if key.to_s.match(/^msgstr_(\d+)/)
|
174
174
|
end
|
175
175
|
|
176
|
-
trans.unshift(detect_plural)
|
176
|
+
# trans.unshift(detect_plural) if detect_plural
|
177
177
|
end
|
178
178
|
|
179
179
|
def assign_trans
|
180
|
-
values[detect_ctxt] = trans if trans.size >
|
180
|
+
values[detect_ctxt] = trans if trans.size > 0
|
181
181
|
end
|
182
182
|
|
183
183
|
def push_buffer(value, key = nil)
|
data/lib/po_to_json/version.rb
CHANGED
data/spec/fixtures/test.po
CHANGED
@@ -12,17 +12,17 @@ msgstr ""
|
|
12
12
|
"MIME-Version: 1.0\n"
|
13
13
|
"Content-Type: text/plain; charset=UTF-8\n"
|
14
14
|
"Content-Transfer-Encoding: 8bit\n"
|
15
|
-
"Plural-Forms: nplurals=
|
15
|
+
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
16
16
|
|
17
17
|
#: app/helpers/translation_helper.rb:3
|
18
18
|
msgid "%{relative_time} ago"
|
19
19
|
msgstr "vor %{relative_time}"
|
20
20
|
|
21
21
|
#: app/views/cars/show.html.erb:5
|
22
|
-
msgid "Axis"
|
23
|
-
msgid_plural "Axis"
|
24
|
-
msgstr[0] "Achse"
|
25
|
-
msgstr[1] "Achsen"
|
22
|
+
msgid "1 Axis"
|
23
|
+
msgid_plural "%{num} Axis"
|
24
|
+
msgstr[0] "1 Achse"
|
25
|
+
msgstr[1] "%{num} Achsen"
|
26
26
|
|
27
27
|
#: app/controllers/cars_controller.rb:47
|
28
28
|
msgid "Car was successfully created."
|
data/spec/po_to_json_spec.rb
CHANGED
@@ -45,71 +45,71 @@ describe PoToJson do
|
|
45
45
|
|
46
46
|
it "should parse embedded variables" do
|
47
47
|
expect(subject["%{relative_time} ago"]).to(
|
48
|
-
eq([
|
48
|
+
eq(["vor %{relative_time}"])
|
49
49
|
)
|
50
50
|
end
|
51
51
|
|
52
52
|
it "should match pluralizations" do
|
53
|
-
expect(subject["Axis"]).to(
|
54
|
-
eq(["
|
53
|
+
expect(subject["1 Axis"]).to(
|
54
|
+
eq(["1 Achse", "%{num} Achsen"])
|
55
55
|
)
|
56
56
|
end
|
57
57
|
|
58
58
|
it "should match glued values" do
|
59
59
|
expect(subject["Car|Model"]).to(
|
60
|
-
eq([
|
60
|
+
eq(["Modell"])
|
61
61
|
)
|
62
62
|
end
|
63
63
|
|
64
64
|
it "should match embedded glue" do
|
65
65
|
expect(subject["Car|Wheels count"]).to(
|
66
|
-
eq([
|
66
|
+
eq(["Räderzahl"])
|
67
67
|
)
|
68
68
|
end
|
69
69
|
|
70
70
|
it "should return empty strings as well" do
|
71
71
|
expect(subject["Untranslated"]).to(
|
72
|
-
eq([
|
72
|
+
eq([""])
|
73
73
|
)
|
74
74
|
end
|
75
75
|
|
76
76
|
it "should match german umlauts" do
|
77
77
|
expect(subject["Umläüte"]).to(
|
78
|
-
eq([
|
78
|
+
eq(["Umlaute"])
|
79
79
|
)
|
80
80
|
end
|
81
81
|
|
82
82
|
it "should match escaped values" do
|
83
83
|
expect(subject["You should escape '\\\\' as '\\\\\\\\'."]).to(
|
84
|
-
eq([
|
84
|
+
eq(["Du solltest '\\\\' als '\\\\\\\\' escapen."])
|
85
85
|
)
|
86
86
|
end
|
87
87
|
|
88
88
|
it "should match multiline translations" do
|
89
89
|
expect(subject["this is a dynamic translation which was found!"]).to(
|
90
|
-
eq([
|
90
|
+
eq(["Dies ist eine dynamische Übersetzung, die gefunden wurde!"])
|
91
91
|
)
|
92
92
|
end
|
93
93
|
|
94
94
|
it "should match simple strings" do
|
95
95
|
expect(subject["Car was successfully created."]).to(
|
96
|
-
eq([
|
96
|
+
eq(["Auto wurde erfolgreich gespeichert"])
|
97
97
|
)
|
98
98
|
|
99
99
|
expect(subject["Car was successfully updated."]).to(
|
100
|
-
eq([
|
100
|
+
eq(["Auto wurde erfolgreich aktualisiert"])
|
101
101
|
)
|
102
102
|
|
103
103
|
expect(subject["Created"]).to(
|
104
|
-
eq([
|
104
|
+
eq(["Erstellt"])
|
105
105
|
)
|
106
106
|
|
107
107
|
expect(subject["Month"]).to(
|
108
|
-
eq([
|
108
|
+
eq(["Monat"])
|
109
109
|
)
|
110
110
|
|
111
111
|
expect(subject["car"]).to(
|
112
|
-
eq([
|
112
|
+
eq(["Auto"])
|
113
113
|
)
|
114
114
|
end
|
115
115
|
end
|
@@ -139,7 +139,7 @@ describe PoToJson do
|
|
139
139
|
end
|
140
140
|
|
141
141
|
it "should include pluralization" do
|
142
|
-
val = '"plural_forms":"nplurals=
|
142
|
+
val = '"plural_forms":"nplurals=2; plural=(n != 1);"'
|
143
143
|
expect(
|
144
144
|
subject.include? val
|
145
145
|
).to be_truthy
|
@@ -176,7 +176,7 @@ describe PoToJson do
|
|
176
176
|
end
|
177
177
|
|
178
178
|
it "should include pluralization" do
|
179
|
-
val = '"plural_forms": "nplurals=
|
179
|
+
val = '"plural_forms": "nplurals=2; plural=(n != 1);"'
|
180
180
|
expect(
|
181
181
|
subject.include? val
|
182
182
|
).to be_truthy
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: po_to_json
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thomas Boerger
|
@@ -9,76 +9,76 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-
|
12
|
+
date: 2015-03-19 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: json
|
72
72
|
requirement: !ruby/object:Gem::Requirement
|
73
73
|
requirements:
|
74
|
-
- -
|
74
|
+
- - ">="
|
75
75
|
- !ruby/object:Gem::Version
|
76
76
|
version: 1.6.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: 1.6.0
|
84
84
|
description: |2
|
@@ -92,13 +92,13 @@ extensions: []
|
|
92
92
|
extra_rdoc_files: []
|
93
93
|
files:
|
94
94
|
- CHANGELOG.md
|
95
|
-
- README.md
|
96
95
|
- LICENSE
|
96
|
+
- README.md
|
97
97
|
- lib/po_to_json.rb
|
98
98
|
- lib/po_to_json/version.rb
|
99
|
-
- spec/spec_helper.rb
|
100
99
|
- spec/fixtures/test.po
|
101
100
|
- spec/po_to_json_spec.rb
|
101
|
+
- spec/spec_helper.rb
|
102
102
|
homepage: https://github.com/webhippie/po_to_json
|
103
103
|
licenses:
|
104
104
|
- MIT
|
@@ -109,22 +109,22 @@ require_paths:
|
|
109
109
|
- lib
|
110
110
|
required_ruby_version: !ruby/object:Gem::Requirement
|
111
111
|
requirements:
|
112
|
-
- -
|
112
|
+
- - ">="
|
113
113
|
- !ruby/object:Gem::Version
|
114
|
-
version:
|
114
|
+
version: 1.9.3
|
115
115
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
116
116
|
requirements:
|
117
|
-
- -
|
117
|
+
- - ">="
|
118
118
|
- !ruby/object:Gem::Version
|
119
119
|
version: '0'
|
120
120
|
requirements: []
|
121
121
|
rubyforge_project:
|
122
|
-
rubygems_version: 2.
|
122
|
+
rubygems_version: 2.4.5
|
123
123
|
signing_key:
|
124
124
|
specification_version: 4
|
125
125
|
summary: Convert gettext PO files to JSON
|
126
126
|
test_files:
|
127
|
-
- spec/spec_helper.rb
|
128
127
|
- spec/fixtures/test.po
|
129
128
|
- spec/po_to_json_spec.rb
|
129
|
+
- spec/spec_helper.rb
|
130
130
|
has_rdoc:
|