babelish 0.5.1 → 0.5.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -13
- data/.travis.yml +1 -1
- data/CONTRIBUTING.md +12 -0
- data/Dockerfile +6 -0
- data/README.md +14 -8
- data/babelish.gemspec +2 -0
- data/lib/babelish/commandline.rb +6 -1
- data/lib/babelish/csv2android.rb +4 -1
- data/lib/babelish/version.rb +1 -1
- data/test/babelish/test_commandline.rb +16 -0
- data/test/babelish/test_csv2android.rb +13 -0
- metadata +48 -29
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
Nzk4MTgwOTExZWQwNjc5NDUwMDU3YjVhYzZmN2FkNmNmY2RiNzBkZQ==
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: fc2f01e77a4bf12791af0fe06d52e21e7f0fcffb
|
4
|
+
data.tar.gz: 2238a556f99720f380edcab4cbd45719fdd05285
|
7
5
|
SHA512:
|
8
|
-
metadata.gz:
|
9
|
-
|
10
|
-
YzBkYmI3MDFjMGI2MGE5MmJiMTQzZTgyNzY3NzkwOTJmYjFmMjRkMGM2MmMy
|
11
|
-
MGViODA3M2I3NGZiNTU5NzM4MTk3NDNiMTY0ZTU3ZDZjYzJhZjA=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
ZDZjNjA2YTg1OThmZTE5Y2RjOTJiOWEzMDgwNTIxMDQ2M2VmNmJmNDYwM2Zj
|
14
|
-
MjVhMmFlYjE5OTFlMTg3ZjA3ZDA4MzRhOTRkMTQyZDBhYTcwZjk4NmYxNDBk
|
15
|
-
NmY0ZGUyMjdjMTEzMjk2YWQ5OWYxZjk2YmNiODQ0ZTQxMDE5ZTE=
|
6
|
+
metadata.gz: c6fdead31265c94b0f00374fd922b1e3e8a88ccabaf62a22574627bd20a7f20c8c193b0c56f232416c39364e1ef48521623198cfd346fe4a17073c075a3065f6
|
7
|
+
data.tar.gz: a3704fff4a8d7a3d3b3cf6f9b9f3ff7a6f62b629a0e420fec70f1fac3219225638fbdc991764125bc4123390a6ca9c9321cb14e5cdfd8f759f523bad6b402e76
|
data/.travis.yml
CHANGED
data/CONTRIBUTING.md
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
# Contributing
|
2
|
+
|
3
|
+
Want to add another support for a new format or/and usage? Add a new feature? Fix a bug?
|
4
|
+
|
5
|
+
1. Create a pull request with a branch like `feature/<nameofbranch>` or `hotfix/<nameofbranch>`.
|
6
|
+
2. Don't forget to explain the issue or the benefits of the feature you want to be merged.
|
7
|
+
3. Write unit tests covering the feature and/or fix the ones the feature/issue breaks.
|
8
|
+
|
9
|
+
And in any case feel free to ask for help in any of those steps.
|
10
|
+
|
11
|
+
|
12
|
+
|
data/Dockerfile
ADDED
data/README.md
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
[![Code Climate](https://codeclimate.com/github/netbe/Babelish.png)](https://codeclimate.com/github/netbe/Babelish)[![Coverage Status](https://coveralls.io/repos/netbe/Babelish/badge.png)](https://coveralls.io/r/netbe/Babelish)
|
3
3
|
[![Gem Version](https://badge.fury.io/rb/babelish.svg)](http://badge.fury.io/rb/babelish)
|
4
4
|
|
5
|
+
![Docker](http://dockeri.co/image/netbe/babelish)
|
5
6
|
|
6
7
|
**Babelish : Chaotically confused, like Babel**
|
7
8
|
|
@@ -21,10 +22,12 @@ Requires Ruby 2.0.0 or above.
|
|
21
22
|
|
22
23
|
Or download [Latest Release](https://github.com/netbe/Babelish/releases/latest).
|
23
24
|
|
25
|
+
Or via docker: `docker run netbe/Babelish babelish help`
|
26
|
+
|
24
27
|
# Usage
|
25
28
|
|
26
29
|
```
|
27
|
-
› babelish help
|
30
|
+
› babelish help 18:21:30
|
28
31
|
Commands:
|
29
32
|
babelish android2csv # Convert .xml files to CSV file
|
30
33
|
babelish csv2android # Convert CSV file to .xml
|
@@ -33,13 +36,17 @@ Commands:
|
|
33
36
|
babelish csv2strings # Convert CSV file to .strings
|
34
37
|
babelish csv_download # Download Google Spreadsheet containing translations
|
35
38
|
babelish help [COMMAND] # Describe available commands or one specific command
|
39
|
+
babelish init # Create a configuration file from template
|
36
40
|
babelish json2csv # Convert .json files to CSV file
|
37
41
|
babelish open FILE # Open local csv file in default editor or Google Spreadsheet containing translations in default browser
|
38
42
|
babelish php2csv # Convert .php files to CSV file
|
39
43
|
babelish strings2csv # Convert .strings files to CSV file
|
40
44
|
babelish version # Display current version
|
45
|
+
|
41
46
|
Options:
|
42
|
-
|
47
|
+
[--verbose], [--no-verbose]
|
48
|
+
-c, [--config=CONFIG] # Read configuration from given file
|
49
|
+
# Default: .babelish
|
43
50
|
```
|
44
51
|
|
45
52
|
You can use a **configuration file** to hold all your commandline arguments into a file.
|
@@ -48,15 +55,14 @@ See [.babelish.sample](.babelish.sample) file in the doc folder. as the possible
|
|
48
55
|
|
49
56
|
*For previous CSV-to-iOS-Localizable.strings-converter, rename your `.csvconverter` into `.babelish`.*
|
50
57
|
|
58
|
+
**Note for docker:** In order to export the output of a conversion, you will need to pipe the result out of the container. An example would be
|
59
|
+
```
|
60
|
+
› docker run netbe/Babelish babelish csv2json >> some_file.json
|
61
|
+
```
|
62
|
+
|
51
63
|
**For more details, check the documentation:**
|
52
64
|
https://github.com/netbe/Babelish/wiki/How-to-Use
|
53
65
|
|
54
|
-
# Contributing
|
55
|
-
|
56
|
-
Want to add another support for a new format or/and usage? Add a new feature? Fix a bug?
|
57
|
-
|
58
|
-
Just create a pull request with a branch like `feature/<nameofbranch>` or `hotfix/<nameofbranch>`.
|
59
|
-
|
60
66
|
|
61
67
|
## Development
|
62
68
|
|
data/babelish.gemspec
CHANGED
data/lib/babelish/commandline.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'thor'
|
2
|
+
require 'yaml'
|
2
3
|
class Commandline < Thor
|
3
4
|
include Thor::Actions
|
4
5
|
class_option :verbose, :type => :boolean
|
@@ -54,7 +55,11 @@ class Commandline < Thor
|
|
54
55
|
method_option :headers, :type => :array, :aliases => "-h", :desc => "override headers of columns, default is name of input files and 'Variables' for reference"
|
55
56
|
method_option :dryrun, :type => :boolean, :aliases => "-n", :desc => "prints out content of hash without writing file"
|
56
57
|
define_method("#{klass[:name].downcase}") do
|
57
|
-
|
58
|
+
begin
|
59
|
+
base2csv(klass[:name])
|
60
|
+
rescue Errno::ENOENT => e
|
61
|
+
warn e.message
|
62
|
+
end
|
58
63
|
end
|
59
64
|
end
|
60
65
|
|
data/lib/babelish/csv2android.rb
CHANGED
@@ -6,11 +6,14 @@ module Babelish
|
|
6
6
|
super(filename, langs, args)
|
7
7
|
|
8
8
|
@file_path = args[:output_dir].to_s
|
9
|
+
@output_basename = args[:output_basename].to_s
|
9
10
|
end
|
10
11
|
|
11
12
|
def language_filepaths(language)
|
12
13
|
require 'pathname'
|
13
|
-
|
14
|
+
output_name = "strings.xml"
|
15
|
+
output_name = "#{@output_basename}.xml" unless @output_basename.empty?
|
16
|
+
filepath = Pathname.new(@file_path) + "values-#{language.code}" + output_name
|
14
17
|
return filepath ? [filepath] : []
|
15
18
|
end
|
16
19
|
|
data/lib/babelish/version.rb
CHANGED
@@ -78,6 +78,22 @@ class TestCommandLine < Test::Unit::TestCase
|
|
78
78
|
system("rm -f .babelish")
|
79
79
|
end
|
80
80
|
|
81
|
+
def test_base2csv_with_config_with_non_existent_filenames_fails
|
82
|
+
options = {:filenames => ['foo']}
|
83
|
+
config_file = File.new(".babelish", "w")
|
84
|
+
config_file.write options.to_yaml
|
85
|
+
config_file.close
|
86
|
+
|
87
|
+
_, stderr = capture_output do
|
88
|
+
Commandline.new.strings2csv
|
89
|
+
end
|
90
|
+
assert_match(/No such file or directory/, stderr)
|
91
|
+
assert_match(/foo/, stderr)
|
92
|
+
|
93
|
+
# clean up
|
94
|
+
system("rm -f .babelish")
|
95
|
+
end
|
96
|
+
|
81
97
|
def test_csv_download_without_gd_filename_fails
|
82
98
|
options = {}
|
83
99
|
config_file = File.new(".babelish", "w")
|
@@ -56,4 +56,17 @@ class TestCSV2Android < Test::Unit::TestCase
|
|
56
56
|
# clean up
|
57
57
|
system("rm -rf values-fr")
|
58
58
|
end
|
59
|
+
|
60
|
+
def test_converting_with_basename
|
61
|
+
csv_file = "test/data/test_data.csv"
|
62
|
+
converter = Babelish::CSV2Android.new(csv_file,
|
63
|
+
{ "English" => "en" },
|
64
|
+
{ output_basename: "super_strings" })
|
65
|
+
converter.convert
|
66
|
+
exist = File.exist?("values-en/super_strings.xml")
|
67
|
+
assert exist, "the ouptut file does not exist"
|
68
|
+
|
69
|
+
# clean up
|
70
|
+
system("rm -rf ./values-en")
|
71
|
+
end
|
59
72
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: babelish
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- François Benaiteau
|
@@ -9,137 +9,154 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2017-06-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: thor
|
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: :runtime
|
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: google_drive
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
31
31
|
requirements:
|
32
|
-
- - ~>
|
32
|
+
- - "~>"
|
33
33
|
- !ruby/object:Gem::Version
|
34
34
|
version: 1.0.1
|
35
35
|
type: :runtime
|
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: 1.0.1
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
43
|
name: nokogiri
|
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: :runtime
|
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: highline
|
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: :runtime
|
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
|
+
- !ruby/object:Gem::Dependency
|
71
|
+
name: rack
|
72
|
+
requirement: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - '='
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: 1.6.4
|
77
|
+
type: :runtime
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - '='
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: 1.6.4
|
70
84
|
- !ruby/object:Gem::Dependency
|
71
85
|
name: json
|
72
86
|
requirement: !ruby/object:Gem::Requirement
|
73
87
|
requirements:
|
74
|
-
- -
|
88
|
+
- - ">="
|
75
89
|
- !ruby/object:Gem::Version
|
76
90
|
version: '0'
|
77
91
|
type: :runtime
|
78
92
|
prerelease: false
|
79
93
|
version_requirements: !ruby/object:Gem::Requirement
|
80
94
|
requirements:
|
81
|
-
- -
|
95
|
+
- - ">="
|
82
96
|
- !ruby/object:Gem::Version
|
83
97
|
version: '0'
|
84
98
|
- !ruby/object:Gem::Dependency
|
85
99
|
name: rake
|
86
100
|
requirement: !ruby/object:Gem::Requirement
|
87
101
|
requirements:
|
88
|
-
- -
|
102
|
+
- - ">="
|
89
103
|
- !ruby/object:Gem::Version
|
90
104
|
version: '0'
|
91
105
|
type: :development
|
92
106
|
prerelease: false
|
93
107
|
version_requirements: !ruby/object:Gem::Requirement
|
94
108
|
requirements:
|
95
|
-
- -
|
109
|
+
- - ">="
|
96
110
|
- !ruby/object:Gem::Version
|
97
111
|
version: '0'
|
98
112
|
- !ruby/object:Gem::Dependency
|
99
113
|
name: test-unit
|
100
114
|
requirement: !ruby/object:Gem::Requirement
|
101
115
|
requirements:
|
102
|
-
- -
|
116
|
+
- - ">="
|
103
117
|
- !ruby/object:Gem::Version
|
104
118
|
version: '0'
|
105
119
|
type: :development
|
106
120
|
prerelease: false
|
107
121
|
version_requirements: !ruby/object:Gem::Requirement
|
108
122
|
requirements:
|
109
|
-
- -
|
123
|
+
- - ">="
|
110
124
|
- !ruby/object:Gem::Version
|
111
125
|
version: '0'
|
112
126
|
- !ruby/object:Gem::Dependency
|
113
127
|
name: simplecov
|
114
128
|
requirement: !ruby/object:Gem::Requirement
|
115
129
|
requirements:
|
116
|
-
- -
|
130
|
+
- - ">="
|
117
131
|
- !ruby/object:Gem::Version
|
118
132
|
version: '0'
|
119
133
|
type: :development
|
120
134
|
prerelease: false
|
121
135
|
version_requirements: !ruby/object:Gem::Requirement
|
122
136
|
requirements:
|
123
|
-
- -
|
137
|
+
- - ">="
|
124
138
|
- !ruby/object:Gem::Version
|
125
139
|
version: '0'
|
126
140
|
- !ruby/object:Gem::Dependency
|
127
141
|
name: yard
|
128
142
|
requirement: !ruby/object:Gem::Requirement
|
129
143
|
requirements:
|
130
|
-
- -
|
144
|
+
- - ">="
|
131
145
|
- !ruby/object:Gem::Version
|
132
146
|
version: '0'
|
133
147
|
type: :development
|
134
148
|
prerelease: false
|
135
149
|
version_requirements: !ruby/object:Gem::Requirement
|
136
150
|
requirements:
|
137
|
-
- -
|
151
|
+
- - ">="
|
138
152
|
- !ruby/object:Gem::Version
|
139
153
|
version: '0'
|
140
|
-
description:
|
141
|
-
|
142
|
-
|
154
|
+
description: |-
|
155
|
+
This set of commands converts a CSV file to the following formats:
|
156
|
+
- .strings (iOS)
|
157
|
+
- .xml (Android)
|
158
|
+
- .json
|
159
|
+
- .php
|
143
160
|
email:
|
144
161
|
- francois.benaiteau@gmail.com
|
145
162
|
- markus.paeschke@gmail.com
|
@@ -148,10 +165,12 @@ executables:
|
|
148
165
|
extensions: []
|
149
166
|
extra_rdoc_files: []
|
150
167
|
files:
|
151
|
-
- .babelish.sample
|
152
|
-
- .gitignore
|
153
|
-
- .hound.yml
|
154
|
-
- .travis.yml
|
168
|
+
- ".babelish.sample"
|
169
|
+
- ".gitignore"
|
170
|
+
- ".hound.yml"
|
171
|
+
- ".travis.yml"
|
172
|
+
- CONTRIBUTING.md
|
173
|
+
- Dockerfile
|
155
174
|
- Gemfile
|
156
175
|
- LICENSE.txt
|
157
176
|
- README.md
|
@@ -229,12 +248,12 @@ require_paths:
|
|
229
248
|
- lib
|
230
249
|
required_ruby_version: !ruby/object:Gem::Requirement
|
231
250
|
requirements:
|
232
|
-
- -
|
251
|
+
- - ">="
|
233
252
|
- !ruby/object:Gem::Version
|
234
253
|
version: '0'
|
235
254
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
236
255
|
requirements:
|
237
|
-
- -
|
256
|
+
- - ">="
|
238
257
|
- !ruby/object:Gem::Version
|
239
258
|
version: '0'
|
240
259
|
requirements: []
|