babelish 0.3.3 → 0.3.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/.babelish.sample +2 -1
- data/.travis.yml +1 -1
- data/README.md +14 -14
- data/babelish.gemspec +1 -1
- data/lib/babelish/commandline.rb +1 -0
- data/lib/babelish/csv2base.rb +5 -2
- data/lib/babelish/version.rb +1 -1
- data/test/babelish/test_csv2base.rb +7 -0
- data/test/data/test_data_with_semicolon.csv +3 -0
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
OGYzYzgwY2Y1NWU1MjVjMWY1YmI1YjhhMjc5M2VmZDlkODU5ODUxNg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
OTg3NjllNjQ4ZTRkM2UzMTBmZDFhMjNjZjdhMWVmOTY3NTczMjA0Mw==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
YzE3MjhiZjc3YmJiMThjNGMyNmY1OGU0YWFiZTE5MWMxMDdkMGVkZGZkZGRk
|
10
|
+
NWQ5NWQ3MDc1NmJkZWEyY2JiODNlNjBjODhhOWQ4YTZjOTdmZTZkMzliOTFk
|
11
|
+
MzJjYTQ1ZWNhMDQ2YTJiZTZmMDEzMDk4ZGMxZWFiOGZiYjIxYWY=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MTU1YmNiMDFjODRmMjQ0Y2UyYTE5Zjk1YjQxYjRlYWY5ODcyNzIwZjZkZTNh
|
14
|
+
MDFkNDVkYTIyMGExZTZmNTYzN2NhZTJjMDVhNGY0ZDJkN2ZkYTMwZDVhMjgy
|
15
|
+
ZjRiYmM5ZDQ4Zjk5Y2YxOGMwZmYwY2ZmNWYzMThjMmRhNTU3NDc=
|
data/.babelish.sample
CHANGED
@@ -30,4 +30,5 @@ langs: # Languages to convert. i.e. English:en
|
|
30
30
|
# ignore_lang_path: true # does not care about lang component path. i.e: en.lproj/
|
31
31
|
# sheet: 0 # Index of worksheet to download. First index is 0.
|
32
32
|
# macros_filename: Babelish.h # File to output the defines of localized strings
|
33
|
-
# stripping: false # Strips values inside the spreadsheet
|
33
|
+
# stripping: false # Strips values inside the spreadsheet
|
34
|
+
# csv_separator: ',' # CSV column separator character, uses ',' by default
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -16,31 +16,31 @@ It can also fetch the csv file from GoogleDrive.
|
|
16
16
|
|
17
17
|
`gem install babelish`
|
18
18
|
|
19
|
-
Requires Ruby 1.9.
|
19
|
+
Requires Ruby 1.9.3 or above.
|
20
20
|
|
21
21
|
# Usage
|
22
22
|
|
23
23
|
```
|
24
24
|
› babelish help
|
25
25
|
Commands:
|
26
|
-
babelish android2csv
|
27
|
-
babelish csv2android
|
28
|
-
babelish csv2json
|
29
|
-
babelish csv2php
|
30
|
-
babelish csv2strings
|
31
|
-
babelish csv_download
|
32
|
-
babelish help [COMMAND]
|
33
|
-
babelish json2csv
|
34
|
-
babelish
|
35
|
-
babelish
|
36
|
-
babelish
|
37
|
-
|
26
|
+
babelish android2csv # Convert .xml files to CSV file
|
27
|
+
babelish csv2android # Convert CSV file to .xml
|
28
|
+
babelish csv2json # Convert CSV file to .json
|
29
|
+
babelish csv2php # Convert CSV file to .php
|
30
|
+
babelish csv2strings # Convert CSV file to .strings
|
31
|
+
babelish csv_download # Download Google Spreadsheet containing translations
|
32
|
+
babelish help [COMMAND] # Describe available commands or one specific command
|
33
|
+
babelish json2csv # Convert .json files to CSV file
|
34
|
+
babelish open FILE # Open local csv file in default editor or Google Spreadsheet containing translations in default browser
|
35
|
+
babelish php2csv # Convert .php files to CSV file
|
36
|
+
babelish strings2csv # Convert .strings files to CSV file
|
37
|
+
babelish version # Display current version
|
38
38
|
Options:
|
39
39
|
[--verbose], [--no-verbose]
|
40
40
|
```
|
41
41
|
|
42
42
|
You can use a **configuration file** to hold all your commandline arguments into a file.
|
43
|
-
Place a `.babelish` file (YAML) in your repo where you will run the command.
|
43
|
+
Place a `.babelish` file (YAML) in your repo where you will run the command. In case you need to reset the Google Drive token you have to delete the .babelish.token file.
|
44
44
|
See [.babelish.sample](.babelish.sample) file in the doc folder. as the possible values.
|
45
45
|
|
46
46
|
*For previous CSV-to-iOS-Localizable.strings-converter, rename your `.csvconverter` into `.babelish`.*
|
data/babelish.gemspec
CHANGED
@@ -6,7 +6,7 @@ require 'babelish/version'
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = 'babelish'
|
8
8
|
s.version = Babelish::VERSION
|
9
|
-
s.date = '
|
9
|
+
s.date = '2015-03-16'
|
10
10
|
s.summary = "CSV converter for localization files"
|
11
11
|
s.description = "This set of commands converts a CSV file to the following formats:
|
12
12
|
- .strings (iOS)
|
data/lib/babelish/commandline.rb
CHANGED
@@ -21,6 +21,7 @@ class Commandline < Thor
|
|
21
21
|
method_option :state_column, :type => :numeric, :aliases => "-s", :desc => "Position of column for state if any"
|
22
22
|
method_option :keys_column, :type => :numeric, :aliases => "-k", :desc => "Position of column for keys"
|
23
23
|
method_option :default_lang, :type => :string, :aliases => "-l", :desc => "Default language to use for empty values if any"
|
24
|
+
method_option :csv_separator, :type => :string, :aliases => "-cs", :desc => "CSV column separator character, uses ',' by default"
|
24
25
|
method_option :output_dir, :type => :string, :aliases => "-d", :desc => "Path of output files"
|
25
26
|
method_option :output_basenames, :type => :array, :aliases => "-o", :desc => "Basename of output files"
|
26
27
|
method_option :stripping, :type => :boolean, :aliases => "-N", :default => false, :desc => "Strips values of spreadsheet"
|
data/lib/babelish/csv2base.rb
CHANGED
@@ -6,6 +6,7 @@ module Babelish
|
|
6
6
|
attr_accessor :langs
|
7
7
|
attr_accessor :csv_filename
|
8
8
|
attr_accessor :default_lang
|
9
|
+
attr_accessor :csv_separator
|
9
10
|
attr_accessor :excluded_states, :state_column, :keys_column
|
10
11
|
attr_accessor :languages
|
11
12
|
|
@@ -13,7 +14,8 @@ module Babelish
|
|
13
14
|
default_args = {
|
14
15
|
:excluded_states => [],
|
15
16
|
:state_column => nil,
|
16
|
-
:keys_column => 0
|
17
|
+
:keys_column => 0,
|
18
|
+
:csv_separator => ","
|
17
19
|
}
|
18
20
|
|
19
21
|
args = default_args.merge!(args)
|
@@ -33,6 +35,7 @@ module Babelish
|
|
33
35
|
@state_column = args[:state_column]
|
34
36
|
@keys_column = args[:keys_column]
|
35
37
|
@default_lang = args[:default_lang]
|
38
|
+
@csv_separator = args[:csv_separator]
|
36
39
|
@ignore_lang_path = args[:ignore_lang_path]
|
37
40
|
@stripping = args[:stripping]
|
38
41
|
@languages = []
|
@@ -89,7 +92,7 @@ module Babelish
|
|
89
92
|
excludedCols = []
|
90
93
|
defaultCol = 0
|
91
94
|
|
92
|
-
CSV.foreach(name, :quote_char => '"', :col_sep =>
|
95
|
+
CSV.foreach(name, :quote_char => '"', :col_sep => @csv_separator, :row_sep => :auto) do |row|
|
93
96
|
|
94
97
|
if rowIndex == 0
|
95
98
|
#check there's at least two columns
|
data/lib/babelish/version.rb
CHANGED
@@ -22,6 +22,13 @@ class TestCsv2Base < Test::Unit::TestCase
|
|
22
22
|
converter = Babelish::Csv2Base.new("file.csv", {"English" => ["en"]})
|
23
23
|
assert_not_nil converter.csv_filename
|
24
24
|
end
|
25
|
+
|
26
|
+
def test_initialize_with_custom_separator
|
27
|
+
converter = Babelish::Csv2Base.new("file.csv", {"English" => ["en"]}, {
|
28
|
+
:csv_separator => ";"
|
29
|
+
})
|
30
|
+
assert_not_nil converter.csv_filename
|
31
|
+
end
|
25
32
|
|
26
33
|
def test_create_file_from_path
|
27
34
|
test_file = "test_file.txt"
|
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.3.
|
4
|
+
version: 0.3.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- François Benaiteau
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2015-03-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: thor
|
@@ -202,6 +202,7 @@ files:
|
|
202
202
|
- test/data/test_data_multiple_langs.csv
|
203
203
|
- test/data/test_data_with_percent.csv
|
204
204
|
- test/data/test_data_with_percent_space.csv
|
205
|
+
- test/data/test_data_with_semicolon.csv
|
205
206
|
- test/data/test_data_with_spaces.csv
|
206
207
|
- test/data/test_en.strings
|
207
208
|
- test/data/test_fr.strings
|
@@ -230,7 +231,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
230
231
|
version: '0'
|
231
232
|
requirements: []
|
232
233
|
rubyforge_project:
|
233
|
-
rubygems_version: 2.4.
|
234
|
+
rubygems_version: 2.4.5
|
234
235
|
signing_key:
|
235
236
|
specification_version: 4
|
236
237
|
summary: CSV converter for localization files
|