babelish 0.5.0 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. checksums.yaml +8 -8
  2. data/.gitignore +2 -3
  3. data/.travis.yml +0 -1
  4. data/README.md +1 -1
  5. data/babelish.gemspec +1 -1
  6. data/lib/babelish/base2csv.rb +1 -0
  7. data/lib/babelish/commandline.rb +6 -6
  8. data/lib/babelish/csv2json.rb +1 -1
  9. data/lib/babelish/version.rb +1 -1
  10. data/test/babelish/commands/test_command_android2csv.rb +5 -5
  11. data/test/babelish/commands/test_command_csv2android.rb +2 -2
  12. data/test/babelish/commands/test_command_strings2csv.rb +22 -7
  13. data/test/babelish/test_base2csv.rb +1 -1
  14. data/test/babelish/test_commandline.rb +7 -7
  15. data/test/babelish/test_csv2json.rb +5 -5
  16. data/test/babelish/test_csv2php.rb +4 -4
  17. data/test/babelish/test_csv2strings.rb +6 -6
  18. data/test/babelish/test_strings2csv.rb +1 -1
  19. data/test/babelish/test_xcode_macros.rb +8 -8
  20. data/test/data/android_special_chars.csv +8 -0
  21. data/test/data/genstrings.strings +0 -0
  22. data/test/data/test_comments.strings +2 -0
  23. data/test/data/test_data.csv +3 -0
  24. data/test/data/test_data.strings +2 -0
  25. data/test/data/test_data_fr_with_comments.strings +6 -0
  26. data/test/data/test_data_multiple_langs.csv +3 -0
  27. data/test/data/test_data_with_comments.csv +3 -0
  28. data/test/data/test_data_with_percent.csv +3 -0
  29. data/test/data/test_data_with_percent_space.csv +4 -0
  30. data/test/data/test_data_with_semicolon.csv +3 -0
  31. data/test/data/test_data_with_spaces.csv +3 -0
  32. data/test/data/test_en.strings +2 -0
  33. data/test/data/test_fr.strings +2 -0
  34. data/test/data/test_space.strings +10 -0
  35. data/test/data/test_utf16.strings +0 -0
  36. data/test/data/test_with_nil.csv +3 -0
  37. data/test/data/test_with_nil.strings +4 -0
  38. data/test/data/xcode_empty.strings +7 -0
  39. metadata +2 -3
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- YWFiZDM4NDg3Zjg2NGRjYThiYmJmZjZkNjY2NDM0MzgxMjFhZmVmNg==
4
+ ZDBmYjkzYmRiMDA5MmQwMDZjOWQyMzk0MjE4YjllYWRlODQzNzE3Zg==
5
5
  data.tar.gz: !binary |-
6
- MDkxZmQ1ZjY1ZDE3OWQwN2YzYzJiMzkyYTI1ODhmMWUwYjU3YTdhYg==
6
+ Nzk4MTgwOTExZWQwNjc5NDUwMDU3YjVhYzZmN2FkNmNmY2RiNzBkZQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- YWQ0ZTVlOTkzM2ZmNDI1ODJjNWUwZGM4YzkyNjZmOTQ1Y2M2ODEwZTlhMDE0
10
- YTM0ZjU4OTQzNWU3MDdiYTQwMWViMWE0M2E0MjcyZDk3MzczMGM4MThkOGNi
11
- YWQ3NTRmMzMyOTIyYWJjMzViZGZiMGU0NzZkMjgzOWEzOGNkNGI=
9
+ ODA5ZTBmYTdkNmUzYWMyZWI0MWMyZTU2MzBlNTVhNjA0YTlmN2ZhMDZlZGEw
10
+ YzBkYmI3MDFjMGI2MGE5MmJiMTQzZTgyNzY3NzkwOTJmYjFmMjRkMGM2MmMy
11
+ MGViODA3M2I3NGZiNTU5NzM4MTk3NDNiMTY0ZTU3ZDZjYzJhZjA=
12
12
  data.tar.gz: !binary |-
13
- ZDEwNTU2ZGQ0YTA4NWI5NmEzMTdkMWVhN2RjMDI2YjkwN2FiODAwM2EyZjcz
14
- MmVmOGYwM2NjYmY0ZDA5YTUzOGY3YTM0YjM4MDc5MTY0NDU5YjYyN2FhOTVh
15
- ZWRlNTY1NTkwYmMwOWIyMDA3MDQyMjMwMmZkZjk5N2NiYWFjMTM=
13
+ ZDZjNjA2YTg1OThmZTE5Y2RjOTJiOWEzMDgwNTIxMDQ2M2VmNmJmNDYwM2Zj
14
+ MjVhMmFlYjE5OTFlMTg3ZjA3ZDA4MzRhOTRkMTQyZDBhYTcwZjk4NmYxNDBk
15
+ NmY0ZGUyMjdjMTEzMjk2YWQ5OWYxZjk2YmNiODQ0ZTQxMDE5ZTE=
data/.gitignore CHANGED
@@ -1,6 +1,6 @@
1
1
  # Generated files
2
- *.csv
3
- *.strings
2
+ /*.csv
3
+ /*.strings
4
4
  *.lproj
5
5
  *.gem
6
6
  *~
@@ -29,4 +29,3 @@ Gemfile.lock
29
29
 
30
30
  doc
31
31
  .yardoc
32
-
@@ -1,7 +1,6 @@
1
1
  language: ruby
2
2
  sudo: false
3
3
  rvm:
4
- - 1.9.3
5
4
  - 2.0.0
6
5
  - 2.1.0
7
6
  - 2.2
data/README.md CHANGED
@@ -17,7 +17,7 @@ It can also fetch the csv file from GoogleDrive.
17
17
 
18
18
  `gem install babelish`
19
19
 
20
- Requires Ruby 1.9.3 or above.
20
+ Requires Ruby 2.0.0 or above.
21
21
 
22
22
  Or download [Latest Release](https://github.com/netbe/Babelish/releases/latest).
23
23
 
@@ -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 = '2015-11-09'
9
+ s.date = Time.now.strftime("%Y-%m-%d")
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)
@@ -83,6 +83,7 @@ module Babelish
83
83
  def create_csv_file(keys, strings, comments = nil)
84
84
  raise "csv_filename must not be nil" unless @csv_filename
85
85
  CSV.open(@csv_filename, "wb") do |csv|
86
+ @headers << "Comments" if !comments.nil? && !comments.empty?
86
87
  csv << @headers
87
88
  keys.each do |key|
88
89
  line = [key]
@@ -21,9 +21,9 @@ class Commandline < Thor
21
21
  method_option :excluded_states, :type => :array, :aliases => "-x", :desc => "Exclude rows with given state"
22
22
  method_option :state_column, :type => :numeric, :aliases => "-s", :desc => "Position of column for state if any"
23
23
  method_option :keys_column, :type => :numeric, :aliases => "-k", :desc => "Position of column for keys"
24
- method_option :comments_column, :type => :numeric, :aliases => "-c", :desc => "Position of column for comments if any"
24
+ method_option :comments_column, :type => :numeric, :aliases => "-C", :desc => "Position of column for comments if any"
25
25
  method_option :default_lang, :type => :string, :aliases => "-l", :desc => "Default language to use for empty values if any"
26
- method_option :csv_separator, :type => :string, :aliases => "-cs", :desc => "CSV column separator character, uses ',' by default"
26
+ method_option :csv_separator, :type => :string, :aliases => "-S", :desc => "CSV column separator character, uses ',' by default"
27
27
  method_option :output_dir, :type => :string, :aliases => "-d", :desc => "Path of output files"
28
28
  method_option :output_basenames, :type => :array, :aliases => "-o", :desc => "Basename of output files"
29
29
  method_option :stripping, :type => :boolean, :aliases => "-N", :default => false, :desc => "Strips values of spreadsheet"
@@ -77,7 +77,7 @@ class Commandline < Thor
77
77
  desc "open FILE", "Open local csv file in default editor or Google Spreadsheet containing translations in default browser"
78
78
  def open(file = "translations.csv")
79
79
  filename = file || options["filename"]
80
- if File.exists?(filename)
80
+ if File.exist?(filename)
81
81
  say "Opening local file '#{filename}'"
82
82
  system "open \"#{filename}\""
83
83
  else
@@ -89,12 +89,12 @@ class Commandline < Thor
89
89
 
90
90
  desc "init", "Create a configuration file from template"
91
91
  def init
92
- if File.exists?(".babelish")
92
+ if File.exist?(".babelish")
93
93
  say "Config file '.babelish' already exists."
94
94
  else
95
95
  say "Creating new config file '.babelish'."
96
96
  config_file = File.expand_path("../../../.babelish.sample", __FILE__)
97
- if File.exists?(config_file)
97
+ if File.exist?(config_file)
98
98
  system "cp #{config_file} .babelish"
99
99
  else
100
100
  say "Template '#{config_file}' not found."
@@ -176,7 +176,7 @@ class Commandline < Thor
176
176
 
177
177
  def options
178
178
  original_options = super
179
- return original_options unless File.exists?(original_options["config"])
179
+ return original_options unless File.exist?(original_options["config"])
180
180
  defaults = ::YAML.load_file(original_options["config"]) || {}
181
181
  Thor::CoreExt::HashWithIndifferentAccess.new(defaults.merge(original_options))
182
182
  end
@@ -5,7 +5,7 @@ module Babelish
5
5
  def language_filepaths(language)
6
6
  require 'pathname'
7
7
  filename = @output_basename || language.code
8
- filepath = Pathname.new("#{@output_dir}#{filename}.js")
8
+ filepath = Pathname.new("#{@output_dir}#{filename}.json")
9
9
 
10
10
  return filepath ? [filepath] : []
11
11
  end
@@ -1,3 +1,3 @@
1
1
  module Babelish
2
- VERSION = "0.5.0"
2
+ VERSION = "0.5.1"
3
3
  end
@@ -6,7 +6,7 @@ class TestAndroid2CSVCommand < Test::Unit::TestCase
6
6
 
7
7
  assert File.exist?("translations.csv")
8
8
 
9
- #clean up
9
+ # clean up
10
10
  system("rm -f translations.csv")
11
11
  end
12
12
 
@@ -16,7 +16,7 @@ class TestAndroid2CSVCommand < Test::Unit::TestCase
16
16
 
17
17
  assert !File.exist?("translations.csv")
18
18
 
19
- #clean up
19
+ # clean up
20
20
  system("rm -f translations.csv")
21
21
  end
22
22
 
@@ -27,7 +27,7 @@ class TestAndroid2CSVCommand < Test::Unit::TestCase
27
27
 
28
28
  assert File.exist?("myfile.csv")
29
29
 
30
- #clean up
30
+ # clean up
31
31
  system("rm -f myfile.csv")
32
32
  end
33
33
 
@@ -38,7 +38,7 @@ class TestAndroid2CSVCommand < Test::Unit::TestCase
38
38
 
39
39
  #TODO assertion or move test on at lib level
40
40
 
41
- #clean up
41
+ # clean up
42
42
  system("rm -f translations.csv")
43
43
  end
44
44
 
@@ -53,7 +53,7 @@ class TestAndroid2CSVCommand < Test::Unit::TestCase
53
53
 
54
54
  #TODO assertion
55
55
 
56
- #clean up
56
+ # clean up
57
57
  system("rm -f enfr.csv")
58
58
  end
59
59
 
@@ -11,7 +11,7 @@ class TestCSV2AndroidCommand < Test::Unit::TestCase
11
11
  assert File.exist?("./values-en/strings.xml")
12
12
  assert File.exist?("./values-fr/strings.xml")
13
13
 
14
- #clean up
14
+ # clean up
15
15
  system("rm -rf ./values-en/")
16
16
  system("rm -rf ./values-fr/")
17
17
  end
@@ -28,7 +28,7 @@ class TestCSV2AndroidCommand < Test::Unit::TestCase
28
28
  assert File.exist?("./mynewlocation/values-en/strings.xml"), "can't find output file for English"
29
29
  assert File.exist?("./mynewlocation/values-fr/strings.xml"), "can't find output file for French"
30
30
 
31
- #clean up
31
+ # clean up
32
32
  system("rm -rf ./mynewlocation")
33
33
  end
34
34
 
@@ -7,7 +7,7 @@ class TestStrings2CSVCommand < Test::Unit::TestCase
7
7
 
8
8
  assert File.exist?("translations.csv")
9
9
 
10
- #clean up
10
+ # clean up
11
11
  system("rm -f translations.csv")
12
12
  end
13
13
 
@@ -17,7 +17,7 @@ class TestStrings2CSVCommand < Test::Unit::TestCase
17
17
 
18
18
  assert !File.exist?("translations.csv")
19
19
 
20
- #clean up
20
+ # clean up
21
21
  system("rm -f translations.csv")
22
22
  end
23
23
 
@@ -28,7 +28,7 @@ class TestStrings2CSVCommand < Test::Unit::TestCase
28
28
 
29
29
  assert File.exist?("myfile.csv")
30
30
 
31
- #clean up
31
+ # clean up
32
32
  system("rm -f myfile.csv")
33
33
  end
34
34
 
@@ -39,7 +39,7 @@ class TestStrings2CSVCommand < Test::Unit::TestCase
39
39
 
40
40
  #TODO assertion or move test on at lib level
41
41
 
42
- #clean up
42
+ # clean up
43
43
  system("rm -f translations.csv")
44
44
  end
45
45
 
@@ -54,7 +54,7 @@ class TestStrings2CSVCommand < Test::Unit::TestCase
54
54
 
55
55
  #TODO assertion
56
56
 
57
- #clean up
57
+ # clean up
58
58
  system("rm -f enfr.csv")
59
59
  end
60
60
 
@@ -71,7 +71,7 @@ class TestStrings2CSVCommand < Test::Unit::TestCase
71
71
  end
72
72
  assert system("diff test_with_nil.csv test/data/test_with_nil.csv"), "no difference on output"
73
73
 
74
- #clean up
74
+ # clean up
75
75
  system("rm -f test_with_nil.csv")
76
76
  end
77
77
 
@@ -87,9 +87,24 @@ class TestStrings2CSVCommand < Test::Unit::TestCase
87
87
  Commandline.new([], options).strings2csv
88
88
  end
89
89
 
90
- #clean up
90
+ # clean up
91
91
  system("rm -f test_utf16.csv")
92
92
 
93
93
  end
94
94
 
95
+ def test_strings2csv_with_comments_outputs_right_headers
96
+ expected_content = <<-EOF
97
+ Variables,test/data/test_comments.strings,Comments
98
+ MY_CONSTANT,This 'is' ok,this is a comment
99
+ EOF
100
+
101
+ options = { :filenames => ["test/data/test_comments.strings"] }
102
+ Commandline.new([], options).strings2csv
103
+
104
+ csv_content = `cat translations.csv`
105
+
106
+ assert_equal expected_content, csv_content, "Content of generated file differs from expected one"
107
+ # clean up
108
+ system("rm -f translations.csv")
109
+ end
95
110
  end
@@ -17,7 +17,7 @@ class TestBase2Csv < Test::Unit::TestCase
17
17
  converter.send :create_csv_file, keys, strings
18
18
  assert File.exist?(converter.csv_filename)
19
19
 
20
- #clean up
20
+ # clean up
21
21
  system("rm -rf ./" + converter.csv_filename)
22
22
  end
23
23
 
@@ -5,7 +5,7 @@ class TestCommandLine < Test::Unit::TestCase
5
5
  assert_nothing_raised do
6
6
  Commandline.new.init
7
7
  end
8
- #clean up
8
+ # clean up
9
9
  system("rm -f .babelish")
10
10
  end
11
11
 
@@ -22,7 +22,7 @@ class TestCommandLine < Test::Unit::TestCase
22
22
  Commandline.new.csv2strings
23
23
  end
24
24
 
25
- #clean up
25
+ # clean up
26
26
  system("rm -rf ./en.lproj/")
27
27
  system("rm -rf ./fr.lproj/")
28
28
  system("rm -f .babelish")
@@ -41,7 +41,7 @@ class TestCommandLine < Test::Unit::TestCase
41
41
  Commandline.new.csv2strings
42
42
  end
43
43
 
44
- #clean up
44
+ # clean up
45
45
  system("rm -rf ./en.lproj/")
46
46
  system("rm -rf ./fr.lproj/")
47
47
  system("rm -f .babelish")
@@ -59,7 +59,7 @@ class TestCommandLine < Test::Unit::TestCase
59
59
  Commandline.new.strings2csv
60
60
  end
61
61
 
62
- #clean up
62
+ # clean up
63
63
  system("rm -f translations.csv")
64
64
  system("rm -f .babelish")
65
65
  end
@@ -74,7 +74,7 @@ class TestCommandLine < Test::Unit::TestCase
74
74
  Commandline.new.strings2csv
75
75
  end
76
76
 
77
- #clean up
77
+ # clean up
78
78
  system("rm -f .babelish")
79
79
  end
80
80
 
@@ -88,7 +88,7 @@ class TestCommandLine < Test::Unit::TestCase
88
88
  Commandline.new.csv_download
89
89
  end
90
90
 
91
- #clean up
91
+ # clean up
92
92
  system("rm -f .babelish")
93
93
  end
94
94
 
@@ -104,7 +104,7 @@ class TestCommandLine < Test::Unit::TestCase
104
104
  Commandline.new.csv_download
105
105
  end
106
106
 
107
- #clean up
107
+ # clean up
108
108
  system("rm -f .babelish")
109
109
  end
110
110
 
@@ -5,10 +5,10 @@ class TestCSV2JSON < Test::Unit::TestCase
5
5
  csv_file = "test/data/test_data.csv"
6
6
  converter = Babelish::CSV2JSON.new(csv_file, 'English' => "en")
7
7
  converter.convert
8
- assert File.exists?("en.js"), "the ouptut file does not exist"
8
+ assert File.exist?("en.json"), "the ouptut file does not exist"
9
9
 
10
- #clean up
11
- system("rm -rf en.js")
10
+ # clean up
11
+ system("rm -rf en.json")
12
12
  end
13
13
 
14
14
  def test_converting_csv_to_dotstrings_one_output_option
@@ -19,9 +19,9 @@ class TestCSV2JSON < Test::Unit::TestCase
19
19
  :output_basename => 'myfile',
20
20
  :ignore_lang_path => true)
21
21
  converter.convert
22
- assert File.exists?(single_file), "the ouptut file does not exist"
22
+ assert File.exist?(single_file), "the ouptut file does not exist"
23
23
 
24
- #clean up
24
+ # clean up
25
25
  system("rm -rf ./" + single_file)
26
26
  end
27
27
  end
@@ -5,9 +5,9 @@ class TestCSV2Php < Test::Unit::TestCase
5
5
  csv_file = "test/data/test_data.csv"
6
6
  converter = Babelish::CSV2Php.new(csv_file, 'English' => "en")
7
7
  converter.convert
8
- assert File.exists?("en/lang.php"), "the ouptut file does not exist"
8
+ assert File.exist?("en/lang.php"), "the ouptut file does not exist"
9
9
 
10
- #clean up
10
+ # clean up
11
11
  system("rm -rf ./en")
12
12
  end
13
13
 
@@ -19,9 +19,9 @@ class TestCSV2Php < Test::Unit::TestCase
19
19
  :output_basename => 'myApp',
20
20
  :ignore_lang_path => true)
21
21
  converter.convert
22
- assert File.exists?(single_file), "the ouptut file does not exist"
22
+ assert File.exist?(single_file), "the ouptut file does not exist"
23
23
 
24
- #clean up
24
+ # clean up
25
25
  system("rm -rf ./" + single_file)
26
26
  end
27
27
  end
@@ -5,7 +5,7 @@ class TestCSV2Strings < Test::Unit::TestCase
5
5
  csv_file = "test/data/test_data.csv"
6
6
  converter = Babelish::CSV2Strings.new(csv_file, 'English' => [:en])
7
7
  converter.convert
8
- assert File.exists?("en.lproj/Localizable.strings"), "the ouptut file does not exist"
8
+ assert File.exist?("en.lproj/Localizable.strings"), "the ouptut file does not exist"
9
9
  system("rm -rf en.lproj/")
10
10
  end
11
11
 
@@ -17,7 +17,7 @@ class TestCSV2Strings < Test::Unit::TestCase
17
17
  :output_basename => 'myApp',
18
18
  :ignore_lang_path => true)
19
19
  converter.convert
20
- assert File.exists?(single_file), "the ouptut file does not exist"
20
+ assert File.exist?(single_file), "the ouptut file does not exist"
21
21
  system("rm -f #{single_file}")
22
22
  end
23
23
 
@@ -32,7 +32,7 @@ class TestCSV2Strings < Test::Unit::TestCase
32
32
  {'English' => [:en], "French" => "fr", "German" => "de", "Spanish" => "es"},
33
33
  :default_lang => "English")
34
34
  converter.convert
35
- assert File.exists?(spanish_file), "the ouptut file does not exist"
35
+ assert File.exist?(spanish_file), "the ouptut file does not exist"
36
36
  result = File.read(spanish_file)
37
37
  assert_equal expected_output, result
38
38
  system("rm -rf *.lproj")
@@ -48,7 +48,7 @@ class TestCSV2Strings < Test::Unit::TestCase
48
48
  converter = Babelish::CSV2Strings.new(csv_file,
49
49
  {'English' => [:en], "French" => "fr", "German" => "de", "Spanish" => "es"})
50
50
  converter.convert
51
- assert File.exists?(spanish_file), "the ouptut file does not exist"
51
+ assert File.exist?(spanish_file), "the ouptut file does not exist"
52
52
  result = File.read(spanish_file)
53
53
  assert_equal expected_output, result
54
54
  system("rm -rf *.lproj")
@@ -65,7 +65,7 @@ class TestCSV2Strings < Test::Unit::TestCase
65
65
  {'English' => [:en], "French" => "fr", "German" => "de", "Spanish" => "es"},
66
66
  :default_lang => "variables")
67
67
  converter.convert
68
- assert File.exists?(spanish_file), "the ouptut file does not exist"
68
+ assert File.exist?(spanish_file), "the ouptut file does not exist"
69
69
  result = File.read(spanish_file)
70
70
  assert_equal expected_output, result
71
71
  system("rm -rf *.lproj")
@@ -146,7 +146,7 @@ class TestCSV2Strings < Test::Unit::TestCase
146
146
  {"French" => "fr"},
147
147
  :default_lang => "English", :comments_column => 5)
148
148
  converter.convert
149
- assert File.exists?(spanish_file), "the ouptut file does not exist"
149
+ assert File.exist?(spanish_file), "the ouptut file does not exist"
150
150
  result = File.read(spanish_file)
151
151
  assert_equal expected_output, result
152
152
  system("rm -rf *.lproj")
@@ -121,7 +121,7 @@ class TestStrings2CSV < Test::Unit::TestCase
121
121
  converter.send :create_csv_file, keys, strings
122
122
  assert File.exist?(converter.csv_filename)
123
123
 
124
- #clean up
124
+ # clean up
125
125
  system("rm -rf ./" + converter.csv_filename)
126
126
  end
127
127
 
@@ -27,10 +27,10 @@ class TestXcodeMacros < Test::Unit::TestCase
27
27
  #define LS_LOGIN_TITLE NSLocalizedStringFromTable(@"login.title",@"Localizable",@"")
28
28
  #define LS_LOGIN_BUTTON NSLocalizedStringFromTable(@"login.button",@"Localizable",@"")
29
29
  EOS
30
- assert File.exists?("Babelish.h")
30
+ assert File.exist?("Babelish.h")
31
31
  result = File.read("Babelish.h")
32
32
  assert_equal expected_output, result
33
- #clean up
33
+ # clean up
34
34
  system("rm -f ./Babelish.h")
35
35
  end
36
36
 
@@ -51,10 +51,10 @@ class TestXcodeMacros < Test::Unit::TestCase
51
51
  #define LS_LOGIN_TITLE NSLocalizedStringFromTable(@"login.title",@"Localizable",@"")
52
52
  #define LS_LOGIN_BUTTON NSLocalizedStringFromTable(@"login.button",@"Localizable",@"")
53
53
  EOS
54
- assert File.exists?("Babelish.h")
54
+ assert File.exist?("Babelish.h")
55
55
  result = File.read("Babelish.h")
56
56
  assert_equal expected_output, result
57
- #clean up
57
+ # clean up
58
58
  system("rm -f ./Babelish.h")
59
59
  end
60
60
 
@@ -76,10 +76,10 @@ class TestXcodeMacros < Test::Unit::TestCase
76
76
  #define LS_LOGIN NSLocalizedStringFromTable(@"login!",@"Localizable",@"")
77
77
  #define LS_HEY NSLocalizedStringFromTable(@"HEY!!",@"Localizable",@"")
78
78
  EOS
79
- assert File.exists?("Babelish.h")
79
+ assert File.exist?("Babelish.h")
80
80
  result = File.read("Babelish.h")
81
81
  assert_equal expected_output, result
82
- #clean up
82
+ # clean up
83
83
  system("rm -f ./Babelish.h")
84
84
  end
85
85
 
@@ -101,10 +101,10 @@ class TestXcodeMacros < Test::Unit::TestCase
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",@"")
103
103
  EOS
104
- assert File.exists?("Babelish.h")
104
+ assert File.exist?("Babelish.h")
105
105
  result = File.read("Babelish.h")
106
106
  assert_equal expected_output, result
107
- #clean up
107
+ # clean up
108
108
  system("rm -f ./Babelish.h")
109
109
  end
110
110
 
@@ -0,0 +1,8 @@
1
+ variables,german
2
+ good_example_1,This\'ll work
3
+ good_example_2,"This is a \""good string\""."
4
+ good_example_3,"""This'll also work"""
5
+ welcome_messages_1,"Hello, %1$s! You have %2$d new messages."
6
+ welcome_messages_2,"Hello, %1$s! You have &lt;b&gt;%2$d new messages&lt;/b&gt;."
7
+ ANOTHER_STRING,"text <b>with</b> html and \' special # chars ` ´ !""§$%/()==?{[]}"
8
+ title,"Title of &lt;a href=""asd""&gt;File&lt;/a&gt;"
@@ -0,0 +1,2 @@
1
+ /* this is a comment */
2
+ "MY_CONSTANT" = "This 'is' ok";
@@ -0,0 +1,3 @@
1
+ variables,English
2
+ ERROR_HANDLER_WARNING_DISMISS,OK
3
+ ANOTHER_STRING,hello
@@ -0,0 +1,2 @@
1
+ "ERROR_HANDLER_WARNING_DISMISS" = "OK";
2
+ "ANOTHER_STRING" = "hello";
@@ -0,0 +1,6 @@
1
+
2
+ /* this is a greeting string */
3
+ "GREETINGS" = "Salut";
4
+
5
+ /* this is another example */
6
+ "ANOTHER_STRING" = "testEN";
@@ -0,0 +1,3 @@
1
+ variables,English,German,French,Spanish
2
+ GREETINGS,Hello,Hallo,Salut,Buenos dias
3
+ ANOTHER_STRING,testEN,,,
@@ -0,0 +1,3 @@
1
+ variables,English,German,French,Spanish,Comments
2
+ GREETINGS,Hello,Hallo,Salut,Buenos dias,this is a greeting string
3
+ ANOTHER_STRING,testEN,,,,this is another example
@@ -0,0 +1,3 @@
1
+ variables,English
2
+ GREETINGS,hello_%@
3
+ ANOTHER_STRING,hello
@@ -0,0 +1,4 @@
1
+ variables,English
2
+ GREETINGS,you have %d points
3
+ ANOTHER_STRING,this is a string with 10% of juice
4
+ ANOTHER_EXAMPLE,tu as fait 10% d'efforts
@@ -0,0 +1,3 @@
1
+ variables;English
2
+ ERROR_HANDLER_WARNING_DISMISS;OK
3
+ ANOTHER_STRING;hello
@@ -0,0 +1,3 @@
1
+ variables,English
2
+ GREETINGS ,hello
3
+ ANOTHER_STRING, my other string with space at begin
@@ -0,0 +1,2 @@
1
+ "GREETINGS" = "Hello";
2
+ "ANOTHER_STRING" = "testEN";
@@ -0,0 +1,2 @@
1
+ "GREETINGS" = "Bonjour";
2
+ "ANOTHER_STRING" = "testFR";
@@ -0,0 +1,10 @@
1
+ "name"= "definition";
2
+ "name1"="definition1";
3
+ "name2" = "definition2";
4
+ "name3" = "definition3" ;
5
+ "name4" = "definition4";
6
+ "this is a name"="a definition";
7
+ wrong format "should be ignored" = "really" ;
8
+ "should be ignored"wrong format = "really" ;
9
+ "should be ignored"= "really" dd;
10
+ "should be ignored"=aa "really";
@@ -0,0 +1,3 @@
1
+ Variables,test/data/test_with_nil.strings
2
+ GREETINGS,Hello
3
+ ANOTHER_STRING,testEN
@@ -0,0 +1,4 @@
1
+ "GREETINGS" = "Hello";
2
+
3
+ "ANOTHER_STRING" = "testEN";
4
+
@@ -0,0 +1,7 @@
1
+ /*
2
+ Localized.strings
3
+ testLocalization
4
+
5
+ Created by François Benaiteau on 14/04/14.
6
+ Copyright (c) 2014 SinnerSchrader Mobile. All rights reserved.
7
+ */
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.0
4
+ version: 0.5.1
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: 2015-11-09 00:00:00.000000000 Z
12
+ date: 2016-03-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: thor
@@ -244,4 +244,3 @@ signing_key:
244
244
  specification_version: 4
245
245
  summary: CSV converter for localization files
246
246
  test_files: []
247
- has_rdoc: