babelish_rnc 1.0.0.pre → 1.0.0.rc

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 721202378c4739d8503cf53580037e795d8afc60
4
- data.tar.gz: dc2fdbd8b5a4d7b298f453c1e7689ac6f8a90041
3
+ metadata.gz: c4880d1496c7016b0c4907b19d074aaad0d6dfb4
4
+ data.tar.gz: '08d2237a14fd60de611eeb9441fafb9e637436bc'
5
5
  SHA512:
6
- metadata.gz: c316be815f90a02faa480c06f33b13766b219afff696068c83781528b9743eddeb30d78028bf38e3d4f171fa3c153798063d99cf5e2af42591661c8b2342f420
7
- data.tar.gz: e6c57ab212a69d39c985a3862eb6e4b942b203feea095c94f63508eb051d29597b5744546b99d98e2e0c6a801ea0b7183f6d664b91a9da1ad8fcd52708145314
6
+ metadata.gz: dc57ec5b0cd847d10eac13393ef1820e320f2f5dfe996fbb6e8afaa805a3915c10cfb00a0376ea513f008eea71d75ced2ae4f4b35dc6774223d22088edaabef5
7
+ data.tar.gz: 918d7d044f4aea54997cd85f3f496e2458f5c0a28cf29ed001466a9ccd116fd291fa415083d2782aa86755c08cc9782c383011851f85cadcefb93f2334339ec2
data/.gitignore CHANGED
@@ -32,3 +32,10 @@ doc
32
32
 
33
33
 
34
34
  .DS_Store
35
+
36
+ /.bundle/
37
+
38
+ # tests output files
39
+ /en/
40
+ myApp.php
41
+
data/.travis.yml CHANGED
@@ -8,8 +8,8 @@ deploy:
8
8
  provider: rubygems
9
9
  api_key:
10
10
  secure: Xjq+v+jEU6wK4BtyfnV1elegNcxK6Ah/O99Sn9c2IlkCmJ1wxLBouqzEiSorSJ4IOMa5H2y3gwo5GXOr6Y7d8huyGrPuBeCSGqAmH77wNCIv7G+jnLiYb1sRZbtKcPW2QaN6JF81qDIelwyspMfo6/ug1qN1x323UaxZl7f7nUE=
11
- gem: babelish
11
+ gem: babelish_rnc
12
12
  on:
13
13
  tags: true
14
- repo: netbe/Babelish
14
+ repo: rbrovko/babelish_rnc
15
15
  all_branches: true
data/Gemfile CHANGED
@@ -4,5 +4,5 @@ source "http://rubygems.org"
4
4
  gemspec
5
5
 
6
6
  group :test do
7
- gem 'coveralls', :require => false, :platforms => [:ruby_19, :ruby_20]
7
+ gem 'coveralls', :require => false
8
8
  end
data/README.md CHANGED
@@ -1,10 +1,11 @@
1
- [![Build Status](https://secure.travis-ci.org/netbe/Babelish.png?branch=master)](http://travis-ci.org/netbe/Babelish)
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
- [![Gem Version](https://badge.fury.io/rb/babelish.svg)](http://badge.fury.io/rb/babelish)
1
+ [![Build Status](https://secure.travis-ci.org/rbrovko/babelish_rnc.png?branch=master)](http://travis-ci.org/rbrovko/babelish_rnc)
2
+ [![Code Climate](https://codeclimate.com/github/rbrovko/babelish_rnc.png)](https://codeclimate.com/github/rbrovko/babelish_rnc)
3
+ [![Coverage Status](https://coveralls.io/repos/github/rbrovko/babelish_rnc/badge.svg?branch=master)](https://coveralls.io/github/rbrovko/babelish_rnc?branch=master)
4
+ [![Gem Version](https://badge.fury.io/rb/babelish_rnc.svg)](http://badge.fury.io/rb/babelish_rnc)
4
5
 
5
- ![Docker](http://dockeri.co/image/netbe/babelish)
6
+ ![Docker](http://dockeri.co/image/rbrovko/babelish_rnc)
6
7
 
7
- **Babelish : Chaotically confused, like Babel**
8
+ **babelish_rnc : Chaotically confused, like Babel**
8
9
 
9
10
  Originally created to deal with localizedStrings files (aka *CSV-to-iOS-Localizable.strings-converter*), this command tool now converts a csv file of translations into the below file formats and vice-versa:
10
11
  * .strings (iOS)
@@ -16,32 +17,32 @@ It can also fetch the csv file from GoogleDrive.
16
17
 
17
18
  # Installation
18
19
 
19
- `gem install babelish`
20
+ `gem install babelish_rnc`
20
21
 
21
22
  Requires Ruby 2.0.0 or above.
22
23
 
23
- Or download [Latest Release](https://github.com/netbe/Babelish/releases/latest).
24
+ Or download [Latest Release](https://github.com/rbrovko/babelish_rnc/releases/latest).
24
25
 
25
- Or via docker: `docker run netbe/Babelish babelish help`
26
+ Or via docker: `docker run rbrovko/babelish_rnc babelish_rnc help`
26
27
 
27
28
  # Usage
28
29
 
29
30
  ```
30
- babelish help 18:21:30
31
+ babelish_rnc help 18:21:30
31
32
  Commands:
32
- babelish android2csv # Convert .xml files to CSV file
33
- babelish csv2android # Convert CSV file to .xml
34
- babelish csv2json # Convert CSV file to .json
35
- babelish csv2php # Convert CSV file to .php
36
- babelish csv2strings # Convert CSV file to .strings
37
- babelish csv_download # Download Google Spreadsheet containing translations
38
- babelish help [COMMAND] # Describe available commands or one specific command
39
- babelish init # Create a configuration file from template
40
- babelish json2csv # Convert .json files to CSV file
41
- babelish open FILE # Open local csv file in default editor or Google Spreadsheet containing translations in default browser
42
- babelish php2csv # Convert .php files to CSV file
43
- babelish strings2csv # Convert .strings files to CSV file
44
- babelish version # Display current version
33
+ babelish_rnc android2csv # Convert .xml files to CSV file
34
+ babelish_rnc csv2android # Convert CSV file to .xml
35
+ babelish_rnc csv2json # Convert CSV file to .json
36
+ babelish_rnc csv2php # Convert CSV file to .php
37
+ babelish_rnc csv2strings # Convert CSV file to .strings
38
+ babelish_rnc csv_download # Download Google Spreadsheet containing translations
39
+ babelish_rnc help [COMMAND] # Describe available commands or one specific command
40
+ babelish_rnc init # Create a configuration file from template
41
+ babelish_rnc json2csv # Convert .json files to CSV file
42
+ babelish_rnc open FILE # Open local csv file in default editor or Google Spreadsheet containing translations in default browser
43
+ babelish_rnc php2csv # Convert .php files to CSV file
44
+ babelish_rnc strings2csv # Convert .strings files to CSV file
45
+ babelish_rnc version # Display current version
45
46
 
46
47
  Options:
47
48
  [--verbose], [--no-verbose]
@@ -57,11 +58,11 @@ See [.babelish.sample](.babelish.sample) file in the doc folder. as the possible
57
58
 
58
59
  **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
  ```
60
- › docker run netbe/Babelish babelish csv2json >> some_file.json
61
+ › docker run rbrovko/babelish_rnc babelish_rnc csv2json >> some_file.json
61
62
  ```
62
63
 
63
64
  **For more details, check the documentation:**
64
- https://github.com/netbe/Babelish/wiki/How-to-Use
65
+ https://github.com/rbrovko/babelish_rnc/wiki/How-to-Use
65
66
 
66
67
 
67
68
  ## Development
@@ -88,7 +88,7 @@ module BabelishRnc
88
88
  return value.to_utf8
89
89
  end
90
90
 
91
- def get_row_format(row_key, row_value, comment = nil, indentation = 0)
91
+ def get_row_format(row_key, row_value, comment = nil, indentation = 0, defaultlang = "")
92
92
  # ignoring comment by default
93
93
  "\"#{row_key}\"" + " " * indentation + " = \"#{row_value}\""
94
94
  end
@@ -179,8 +179,9 @@ module BabelishRnc
179
179
  if content && content.size > 0
180
180
  content.each do |key, value|
181
181
  comment = @comments[key]
182
- defaultlang = @languages[1].content[key]
183
- output += get_row_format(key, value, comment, indentation - key.length, defaultlang)
182
+ defaultlang = @languages[1]
183
+ default_value = defaultlang ? defaultlang.content[key] : ""
184
+ output += get_row_format(key, value, comment, indentation - key.length, default_value)
184
185
  end
185
186
  end
186
187
  return output
@@ -14,7 +14,7 @@ module BabelishRnc
14
14
  return filepath ? [filepath] : []
15
15
  end
16
16
 
17
- def get_row_format(row_key, row_value, comment = nil, indentation = 0)
17
+ def get_row_format(row_key, row_value, comment = nil, indentation = 0, defaultlang = "")
18
18
  "$" + @php_tag + "['#{row_key}']" + " " * indentation + " = \"#{row_value}\";\n"
19
19
  end
20
20
 
@@ -15,10 +15,10 @@ module BabelishRnc
15
15
  filepaths
16
16
  end
17
17
 
18
- def get_row_format(row_key, row_value, comment = nil, indentation = 0, huy)
18
+ def get_row_format(row_key, row_value, comment = nil, indentation = 0, defaultlang = "")
19
19
  entry = comment.to_s.empty? ? "" : "\n/* #{comment} */\n"
20
20
 
21
- row_value = row_value.to_s.empty? ? huy : row_value
21
+ row_value = row_value.to_s.empty? ? defaultlang : row_value
22
22
 
23
23
  entry + "\"#{row_key}\"" + " " * indentation + " = \"#{row_value}\";\n"
24
24
  end
@@ -1,3 +1,3 @@
1
1
  module BabelishRnc
2
- VERSION = "1.0.0.pre"
2
+ VERSION = "1.0.0.rc"
3
3
  end
@@ -37,7 +37,7 @@ module BabelishRnc
37
37
  //
38
38
  // This file was generated by babelish_rnc
39
39
  //
40
- // https://github.com/netbe/babelish
40
+ // https://github.com/rbrovko/babelish_rnc
41
41
  //
42
42
  EOS
43
43
  header.gsub! "file_path", File.basename(file_path)
@@ -41,7 +41,7 @@ class TestCSV2Strings < Test::Unit::TestCase
41
41
  def test_converting_csv_to_dotstrings_with_no_default_lang_is_empty
42
42
  expected_output = String.new(<<-EOS)
43
43
  "GREETINGS" = "Buenos dias";
44
- "ANOTHER_STRING" = "";
44
+ "ANOTHER_STRING" = "testEN";
45
45
  EOS
46
46
  csv_file = "test/data/test_data_multiple_langs.csv"
47
47
  spanish_file = "es.lproj/Localizable.strings"
@@ -82,30 +82,30 @@ class TestStrings2CSV < Test::Unit::TestCase
82
82
  def test_load_strings_with_comments
83
83
  expected_output = [{"MY_CONSTANT"=>"This 'is' ok"}, {"MY_CONSTANT"=> "this is a comment"}]
84
84
 
85
- output = Babelish::Strings2CSV.new.load_strings "test/data/test_comments.strings"
85
+ output = BabelishRnc::Strings2CSV.new.load_strings "test/data/test_comments.strings"
86
86
  assert_equal expected_output, output
87
87
  end
88
88
 
89
89
  def test_load_strings_with_empty_lines
90
90
  assert_nothing_raised do
91
- output = Babelish::Strings2CSV.new.load_strings "test/data/test_with_nil.strings"
91
+ output = BabelishRnc::Strings2CSV.new.load_strings "test/data/test_with_nil.strings"
92
92
  end
93
93
  end
94
94
 
95
95
  def test_load_strings_with_empty_lines_and_comments
96
96
  assert_nothing_raised do
97
- output = Babelish::Strings2CSV.new.load_strings "test/data/xcode_empty.strings"
97
+ output = BabelishRnc::Strings2CSV.new.load_strings "test/data/xcode_empty.strings"
98
98
  end
99
99
  end
100
100
 
101
101
  def test_load_strings_with_genstrings_file
102
102
  assert_nothing_raised do
103
- output = Babelish::Strings2CSV.new.load_strings "test/data/genstrings.strings"
103
+ output = BabelishRnc::Strings2CSV.new.load_strings "test/data/genstrings.strings"
104
104
  end
105
105
  end
106
106
 
107
107
  def test_dotstrings_to_csv
108
- converter = Babelish::Strings2CSV.new(:filenames => ["test/data/test_data.strings"])
108
+ converter = BabelishRnc::Strings2CSV.new(:filenames => ["test/data/test_data.strings"])
109
109
  keys, strings = converter.convert(false)
110
110
  assert_equal ["ERROR_HANDLER_WARNING_DISMISS", "ANOTHER_STRING"], keys
111
111
 
@@ -116,7 +116,7 @@ class TestStrings2CSV < Test::Unit::TestCase
116
116
  filename = "test_data"
117
117
  strings = {filename => {"ERROR_HANDLER_WARNING_DISMISS" => "OK", "ANOTHER_STRING" => "hello"}}
118
118
 
119
- converter = Babelish::Strings2CSV.new(:headers => %w{variables english}, :filenames => [filename])
119
+ converter = BabelishRnc::Strings2CSV.new(:headers => %w{variables english}, :filenames => [filename])
120
120
 
121
121
  converter.send :create_csv_file, keys, strings
122
122
  assert File.exist?(converter.csv_filename)
@@ -129,7 +129,7 @@ class TestStrings2CSV < Test::Unit::TestCase
129
129
  csv_filename = "file.csv"
130
130
  filenames = %w{french.strings english.strings}
131
131
  headers = %w{constants french english}
132
- converter = Babelish::Strings2CSV.new({
132
+ converter = BabelishRnc::Strings2CSV.new({
133
133
  :csv_filename => csv_filename,
134
134
  :headers => headers,
135
135
  :filenames => filenames })
@@ -140,7 +140,7 @@ class TestStrings2CSV < Test::Unit::TestCase
140
140
  end
141
141
 
142
142
  def test_initialize_with_default_values
143
- converter = Babelish::Strings2CSV.new
143
+ converter = BabelishRnc::Strings2CSV.new
144
144
  assert_not_nil converter.csv_filename
145
145
  end
146
146
 
@@ -3,7 +3,7 @@ class TestXcodeMacros < Test::Unit::TestCase
3
3
  def test_process
4
4
  keys = ["login.title", "login.button"]
5
5
  table = "Localizable"
6
- xcode_macros = Babelish::XcodeMacros.new
6
+ xcode_macros = BabelishRnc::XcodeMacros.new
7
7
  content = xcode_macros.process(table, keys)
8
8
  expected_output = String.new(<<-EOS)
9
9
  #define LS_LOGIN_TITLE NSLocalizedStringFromTable(@"login.title",@"Localizable",@"")
@@ -15,14 +15,14 @@ class TestXcodeMacros < Test::Unit::TestCase
15
15
  def test_write_macros_class_method
16
16
  keys = ["login.title", "login.button"]
17
17
  table = "Localizable"
18
- Babelish::XcodeMacros.write_macros("Babelish.h", table, keys)
18
+ BabelishRnc::XcodeMacros.write_macros("Babelish.h", table, keys)
19
19
  expected_output = String.new(<<-EOS)
20
20
  //
21
21
  // Babelish.h
22
22
  //
23
- // This file was generated by Babelish
23
+ // This file was generated by babelish_rnc
24
24
  //
25
- // https://github.com/netbe/babelish
25
+ // https://github.com/rbrovko/babelish_rnc
26
26
  //
27
27
  #define LS_LOGIN_TITLE NSLocalizedStringFromTable(@"login.title",@"Localizable",@"")
28
28
  #define LS_LOGIN_BUTTON NSLocalizedStringFromTable(@"login.button",@"Localizable",@"")
@@ -37,16 +37,16 @@ class TestXcodeMacros < Test::Unit::TestCase
37
37
  def test_write_macros_process
38
38
  keys = ["login.title", "login.button"]
39
39
  table = "Localizable"
40
- macros = Babelish::XcodeMacros.new
40
+ macros = BabelishRnc::XcodeMacros.new
41
41
  macros.process(table, keys)
42
42
  macros.write_content("Babelish.h")
43
43
  expected_output = String.new(<<-EOS)
44
44
  //
45
45
  // Babelish.h
46
46
  //
47
- // This file was generated by Babelish
47
+ // This file was generated by babelish_rnc
48
48
  //
49
- // https://github.com/netbe/babelish
49
+ // https://github.com/rbrovko/babelish_rnc
50
50
  //
51
51
  #define LS_LOGIN_TITLE NSLocalizedStringFromTable(@"login.title",@"Localizable",@"")
52
52
  #define LS_LOGIN_BUTTON NSLocalizedStringFromTable(@"login.button",@"Localizable",@"")
@@ -61,16 +61,16 @@ class TestXcodeMacros < Test::Unit::TestCase
61
61
  def test_write_macros_process_with_special_characters
62
62
  keys = ["%d blabla", "login!", "HEY!!"]
63
63
  table = "Localizable"
64
- macros = Babelish::XcodeMacros.new
64
+ macros = BabelishRnc::XcodeMacros.new
65
65
  macros.process(table, keys)
66
66
  macros.write_content("Babelish.h")
67
67
  expected_output = String.new(<<-EOS)
68
68
  //
69
69
  // Babelish.h
70
70
  //
71
- // This file was generated by Babelish
71
+ // This file was generated by babelish_rnc
72
72
  //
73
- // https://github.com/netbe/babelish
73
+ // https://github.com/rbrovko/babelish_rnc
74
74
  //
75
75
  #define LS_DBLABLA NSLocalizedStringFromTable(@"%d blabla",@"Localizable",@"")
76
76
  #define LS_LOGIN NSLocalizedStringFromTable(@"login!",@"Localizable",@"")
@@ -87,16 +87,16 @@ class TestXcodeMacros < Test::Unit::TestCase
87
87
  keys = ["login.title", "login.button"]
88
88
  table = "Localizable"
89
89
  comments = {"login.title" => "this is the login screen title", "login.button" => nil}
90
- macros = Babelish::XcodeMacros.new
90
+ macros = BabelishRnc::XcodeMacros.new
91
91
  macros.process(table, keys, comments)
92
92
  macros.write_content("Babelish.h")
93
93
  expected_output = String.new(<<-EOS)
94
94
  //
95
95
  // Babelish.h
96
96
  //
97
- // This file was generated by Babelish
97
+ // This file was generated by babelish_rnc
98
98
  //
99
- // https://github.com/netbe/babelish
99
+ // https://github.com/rbrovko/babelish_rnc
100
100
  //
101
101
  #define LS_LOGIN_TITLE NSLocalizedStringFromTable(@"login.title",@"Localizable",@"this is the login screen title")
102
102
  #define LS_LOGIN_BUTTON NSLocalizedStringFromTable(@"login.button",@"Localizable",@"")
data/test/test_helper.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  begin
2
2
  require 'simplecov'
3
3
  require 'coveralls'
4
+ Coveralls.wear!
4
5
 
5
6
  SimpleCov.formatter = Coveralls::SimpleCov::Formatter
6
7
  SimpleCov.start do
@@ -12,6 +13,6 @@ end
12
13
 
13
14
  require 'test/unit'
14
15
 
15
- require 'babelish'
16
+ require 'babelish_rnc'
16
17
 
17
- require "babelish/commandline"
18
+ require "babelish_rnc/commandline"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: babelish_rnc
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.pre
4
+ version: 1.0.0.rc
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: 2018-04-17 00:00:00.000000000 Z
12
+ date: 2018-04-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: thor
@@ -175,7 +175,6 @@ files:
175
175
  - LICENSE.txt
176
176
  - README.md
177
177
  - Rakefile
178
- - babelish.gemspec
179
178
  - babelish_rnc.gemspec
180
179
  - bin/babelish_rnc
181
180
  - lib/babelish_rnc.rb
data/babelish.gemspec DELETED
@@ -1,41 +0,0 @@
1
- # -*- encoding: utf-8 -*-
2
- lib = File.expand_path('../lib', __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
-
5
- Gem::Specification.new do |s|
6
- s.name = 'babelishX'
7
- s.version = '1.0.1'
8
- s.date = Time.now.strftime("%Y-%m-%d")
9
- s.summary = "CSV converter for localization files"
10
- s.description = "This set of commands converts a CSV file to the following formats:
11
- - .strings (iOS)
12
- - .xml (Android)
13
- - .json
14
- - .php"
15
- s.authors = ["François Benaiteau", "Markus Paeschke"]
16
- s.email = ['francois.benaiteau@gmail.com', 'markus.paeschke@gmail.com']
17
- s.homepage = 'http://netbe.github.io/Babelish/'
18
- s.license = 'MIT'
19
-
20
- s.add_dependency "thor"
21
-
22
- s.add_dependency "google_drive", "~> 2.1.7"
23
- s.add_dependency "nokogiri"
24
- # google_drive dependency to ask for mail and password
25
- s.add_dependency "highline"
26
-
27
- # specify version of rack so works on ruby <2.2.2
28
- s.add_dependency "rack", "1.6.4"
29
- # json support
30
- s.add_dependency "json"
31
-
32
- s.add_development_dependency "rake"
33
- s.add_development_dependency "test-unit"
34
- s.add_development_dependency "simplecov"
35
- s.add_development_dependency "yard"
36
-
37
- s.files = `git ls-files`.split("\n")
38
- s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
39
- s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
40
- s.require_path = 'lib'
41
- end