csv2strings 0.2.3 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -13
- data/.travis.yml +7 -4
- data/README.md +5 -0
- data/csv2strings.gemspec +4 -3
- data/lib/csvconverter/strings2csv.rb +11 -5
- data/test/csvconverter/commands/test_command_strings2csv.rb +18 -0
- metadata +48 -18
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
ODRkNGU1Y2Q3MDliZTRjMWViZDdmZjc5MWZmNzlmNTE0NjBiMDgxMQ==
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 4dc1c0140bf5689ded0989dbca6197e2c509d190
|
4
|
+
data.tar.gz: 44b37ddf3b302ebb2b06ed29c4174d737dc49d3c
|
7
5
|
SHA512:
|
8
|
-
metadata.gz:
|
9
|
-
|
10
|
-
MjE1YzI4ZTlhYzRlNzA3Njk0N2M2NWFhY2QxYzdiZmE3NGEyYWI5YjUxYjIz
|
11
|
-
NDA4YmE4YzI1MjZhY2VjZDlmNGY1YTAyMDIzZmFlZGRiYzMzZTA=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
OTg2ZGE0YzNiZDAzN2FmODM3NmZkN2IxMzIxNDk0YzNjOWEzNmIwZmI3NDgx
|
14
|
-
ODI5NmVkZjc1NjgwYzUxZTU3MDk3MTgwM2ZkYTAyZTg0N2IxMTdmYzY2NjA4
|
15
|
-
NWRhZjI2OTU3MDA1MTQyMDBiYjZiZTE4YWFlY2VjNzkxMmMyZDU=
|
6
|
+
metadata.gz: e0a5a0dba0bb07d84dc7191c78f01e6fbcc8f6e97b26421cf076aff0206bef79ba3bd03031d64fcdb6c180424877f4383275a8ee97e8af92532a648055488d91
|
7
|
+
data.tar.gz: d519a2b459aa342f8b976376539a2f85f31419d8157813657721e94a719b64cf6d73c22e1a86047cabc23bf16ddb45e0be6832e4093583eb933963bc4e1d0eaa
|
data/.travis.yml
CHANGED
@@ -1,9 +1,12 @@
|
|
1
1
|
language: ruby
|
2
|
+
before_install:
|
3
|
+
- sudo apt-get install libtool
|
4
|
+
- sudo apt-get install libmagic-dev
|
5
|
+
- sudo apt-get install libicu-dev
|
2
6
|
rvm:
|
3
|
-
- 1.9.
|
4
|
-
- 1.9.
|
5
|
-
-
|
6
|
-
- 2.0.0
|
7
|
+
- 1.9.2
|
8
|
+
- 1.9.3
|
9
|
+
- 2.0.0
|
7
10
|
deploy:
|
8
11
|
provider: rubygems
|
9
12
|
api_key:
|
data/README.md
CHANGED
@@ -4,6 +4,11 @@
|
|
4
4
|
# Introduction
|
5
5
|
This script converts a csv file of translations into iOS .strings files and vice-versa.
|
6
6
|
|
7
|
+
# Requirements
|
8
|
+
|
9
|
+
* Ruby 1.9.2 or adbove
|
10
|
+
* Needs [ICU](http://site.icu-project.org/). Via `brew install icu4c` on Mac or `apt-get install libicu-dev` on Linux
|
11
|
+
|
7
12
|
# Setup
|
8
13
|
|
9
14
|
`gem install csv2strings`
|
data/csv2strings.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'csv2strings'
|
3
|
-
s.version = '0.2.
|
4
|
-
s.date = '
|
3
|
+
s.version = '0.2.4'
|
4
|
+
s.date = '2014-03-12'
|
5
5
|
s.summary = "CSV to iOS Localizable.strings converter"
|
6
6
|
s.description = "ruby script converts a CSV file of translations to Localizable.strings files and vice-versa"
|
7
7
|
s.authors = ["François Benaiteau"]
|
@@ -20,7 +20,8 @@ Gem::Specification.new do |s|
|
|
20
20
|
else
|
21
21
|
s.add_dependency "google_drive"
|
22
22
|
end
|
23
|
-
|
23
|
+
# utf8 encoding
|
24
|
+
s.add_dependency "charlock_holmes"
|
24
25
|
# google_drive dependency to ask for mail and password
|
25
26
|
s.add_dependency "highline"
|
26
27
|
|
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'charlock_holmes'
|
1
2
|
class Strings2CSV
|
2
3
|
# default_lang is the the column to refer to if a value is missing
|
3
4
|
# actually default_lang = default_filename
|
@@ -28,12 +29,17 @@ class Strings2CSV
|
|
28
29
|
# Load all strings of a given file
|
29
30
|
def load_strings(strings_filename)
|
30
31
|
strings = ORDERED_HASH_CLASS.new
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
32
|
+
|
33
|
+
# Make sure we use correct encoding
|
34
|
+
contents = File.open(strings_filename).read
|
35
|
+
detection = CharlockHolmes::EncodingDetector.detect(contents)
|
36
|
+
utf8_encoded_content = CharlockHolmes::Converter.convert contents, detection[:encoding], 'UTF-8'
|
37
|
+
|
38
|
+
utf8_encoded_content.each_line do |line|
|
39
|
+
hash = self.parse_dotstrings_line(line)
|
40
|
+
strings.merge!(hash) if hash
|
36
41
|
end
|
42
|
+
|
37
43
|
strings
|
38
44
|
end
|
39
45
|
|
@@ -74,4 +74,22 @@ class TestCommand < Test::Unit::TestCase
|
|
74
74
|
#clean up
|
75
75
|
system("rm -f test_with_nil.csv")
|
76
76
|
end
|
77
|
+
|
78
|
+
def test_strings2csv_utf16
|
79
|
+
options = {
|
80
|
+
:filenames => ["test/data/test_utf16.strings"],
|
81
|
+
:csv_filename => "test_utf16.csv"
|
82
|
+
}
|
83
|
+
# -i, -o
|
84
|
+
|
85
|
+
|
86
|
+
assert_nothing_raised do
|
87
|
+
Strings2CSVCommand.new([], options).strings2csv
|
88
|
+
end
|
89
|
+
|
90
|
+
#clean up
|
91
|
+
system("rm -f test_utf16.csv")
|
92
|
+
|
93
|
+
end
|
94
|
+
|
77
95
|
end
|
metadata
CHANGED
@@ -1,97 +1,111 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: csv2strings
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- François Benaiteau
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-03-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - '>='
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - '>='
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: google_drive
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - '>='
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: charlock_holmes
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '>='
|
39
53
|
- !ruby/object:Gem::Version
|
40
54
|
version: '0'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: highline
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
44
58
|
requirements:
|
45
|
-
- -
|
59
|
+
- - '>='
|
46
60
|
- !ruby/object:Gem::Version
|
47
61
|
version: '0'
|
48
62
|
type: :runtime
|
49
63
|
prerelease: false
|
50
64
|
version_requirements: !ruby/object:Gem::Requirement
|
51
65
|
requirements:
|
52
|
-
- -
|
66
|
+
- - '>='
|
53
67
|
- !ruby/object:Gem::Version
|
54
68
|
version: '0'
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: rake
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
58
72
|
requirements:
|
59
|
-
- -
|
73
|
+
- - '>='
|
60
74
|
- !ruby/object:Gem::Version
|
61
75
|
version: '0'
|
62
76
|
type: :development
|
63
77
|
prerelease: false
|
64
78
|
version_requirements: !ruby/object:Gem::Requirement
|
65
79
|
requirements:
|
66
|
-
- -
|
80
|
+
- - '>='
|
67
81
|
- !ruby/object:Gem::Version
|
68
82
|
version: '0'
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
84
|
name: test-unit
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
72
86
|
requirements:
|
73
|
-
- -
|
87
|
+
- - '>='
|
74
88
|
- !ruby/object:Gem::Version
|
75
89
|
version: '0'
|
76
90
|
type: :development
|
77
91
|
prerelease: false
|
78
92
|
version_requirements: !ruby/object:Gem::Requirement
|
79
93
|
requirements:
|
80
|
-
- -
|
94
|
+
- - '>='
|
81
95
|
- !ruby/object:Gem::Version
|
82
96
|
version: '0'
|
83
97
|
- !ruby/object:Gem::Dependency
|
84
98
|
name: simplecov
|
85
99
|
requirement: !ruby/object:Gem::Requirement
|
86
100
|
requirements:
|
87
|
-
- -
|
101
|
+
- - '>='
|
88
102
|
- !ruby/object:Gem::Version
|
89
103
|
version: '0'
|
90
104
|
type: :development
|
91
105
|
prerelease: false
|
92
106
|
version_requirements: !ruby/object:Gem::Requirement
|
93
107
|
requirements:
|
94
|
-
- -
|
108
|
+
- - '>='
|
95
109
|
- !ruby/object:Gem::Version
|
96
110
|
version: '0'
|
97
111
|
description: ruby script converts a CSV file of translations to Localizable.strings
|
@@ -130,6 +144,7 @@ files:
|
|
130
144
|
- test/data/test_data_multiple_langs.csv
|
131
145
|
- test/data/test_en.strings
|
132
146
|
- test/data/test_fr.strings
|
147
|
+
- test/data/test_utf16.strings
|
133
148
|
- test/data/test_with_nil.csv
|
134
149
|
- test/data/test_with_nil.strings
|
135
150
|
- test/test_helper.rb
|
@@ -143,18 +158,33 @@ require_paths:
|
|
143
158
|
- lib
|
144
159
|
required_ruby_version: !ruby/object:Gem::Requirement
|
145
160
|
requirements:
|
146
|
-
- -
|
161
|
+
- - '>='
|
147
162
|
- !ruby/object:Gem::Version
|
148
163
|
version: '0'
|
149
164
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
150
165
|
requirements:
|
151
|
-
- -
|
166
|
+
- - '>='
|
152
167
|
- !ruby/object:Gem::Version
|
153
168
|
version: '0'
|
154
169
|
requirements: []
|
155
170
|
rubyforge_project:
|
156
|
-
rubygems_version: 2.
|
171
|
+
rubygems_version: 2.0.3
|
157
172
|
signing_key:
|
158
173
|
specification_version: 4
|
159
174
|
summary: CSV to iOS Localizable.strings converter
|
160
|
-
test_files:
|
175
|
+
test_files:
|
176
|
+
- test/csvconverter/commands/test_command_csv2strings.rb
|
177
|
+
- test/csvconverter/commands/test_command_strings2csv.rb
|
178
|
+
- test/csvconverter/test_bins.rb
|
179
|
+
- test/csvconverter/test_csv2strings.rb
|
180
|
+
- test/csvconverter/test_strings2csv.rb
|
181
|
+
- test/data/test_data.csv
|
182
|
+
- test/data/test_data.strings
|
183
|
+
- test/data/test_data_multiple_langs.csv
|
184
|
+
- test/data/test_en.strings
|
185
|
+
- test/data/test_fr.strings
|
186
|
+
- test/data/test_utf16.strings
|
187
|
+
- test/data/test_with_nil.csv
|
188
|
+
- test/data/test_with_nil.strings
|
189
|
+
- test/test_helper.rb
|
190
|
+
has_rdoc:
|