i18n-docs 0.0.7 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: f1f7b7b3b0e95758db2c3cc0119add4a85c085c2
4
+ data.tar.gz: d4ce87fe52ba0434f8afd7af0a64d6e9afd36ed8
5
+ SHA512:
6
+ metadata.gz: 589f0f3b121d0a8b8000f5cf6a0521285aca80d8650a3b46f8bdeba40d9179dfa9b9ee0bccc32eb91bf642a716f288ebfc2295e70a2dc070d4498febdca41b9e
7
+ data.tar.gz: df6734d665f51c46f6986c2a322fcec1502fc124423270b09ef6e3c949ec249b9f48d6f112cc9098fe52b568d5fabce2120d9ae45b89070184347e08348273f0
data/Gemfile CHANGED
@@ -1,4 +1,4 @@
1
- source "http://rubygems.org"
1
+ source "https://rubygems.org"
2
2
 
3
3
  # Specify your gem's dependencies in localch.gemspec
4
4
  gemspec
data/README.md CHANGED
@@ -29,8 +29,14 @@ Create a configuration file in `config/translations.yml`:
29
29
 
30
30
  Finally, let Rails know what locales you will be using. Add this to `config/application.rb`:
31
31
 
32
- # locals to support:
33
- I18n.available_locales = [:en,:de,:it,:fr]
32
+ module Web
33
+ class Application < Rails::Application
34
+ # add yml path
35
+ config.i18n.load_path += Dir[Rails.root.join('config', 'locales', '*', '*.yml').to_s]
36
+ # locals to support:
37
+ config.i18n.available_locales = [:en,:de,:it,:fr]
38
+ end
39
+ end
34
40
 
35
41
  This defines which languages and translation files to import from a Google Spreadsheet. The content of the Spreadsheet URL is stored to a file called e.g. `example1.yml` within folders `config/locales/en` and all other detected locales.
36
42
 
@@ -67,13 +73,31 @@ Following Rake tasks are added by the GEM to your Rails project:
67
73
 
68
74
  ## CHANGELOG
69
75
 
76
+ ## 0.0.9
77
+
78
+ * add version.rb
79
+ * content downloaded is forced to UTF-8
80
+ * translation keys read are not downcased anymore
81
+ * fixes a bug when loading documents with an empty key
82
+ * create tmp directory if it does not exist
83
+ * strip spaces from keys
84
+
85
+ ## 0.0.8
86
+
87
+ * screwed up rubygems.org push
88
+ * this version has been YANKED
89
+
90
+ ### 0.0.7
91
+
92
+ * get in sync with Rubygems.org version
93
+
70
94
  ### 0.0.4
71
95
 
72
- Update docs, license. Push to Rubygems.org.
96
+ * update docs, license. Push to Rubygems.org.
73
97
 
74
98
  ### 0.0.3
75
99
 
76
- * Open sourced: changed name and description.
100
+ * open sourced: changed name and description.
77
101
 
78
102
  ### 0.0.2
79
103
 
@@ -1,10 +1,15 @@
1
+ $:.push File.expand_path("../lib", __FILE__)
2
+ # Maintain your gem's version:
3
+ require 'localch_i18n/version'
4
+
5
+ # encoding: utf-8
1
6
  Gem::Specification.new do |s|
2
7
  s.name = 'i18n-docs'
3
- s.version = '0.0.7'
8
+ s.version = LocalchI18n::VERSION
4
9
  s.date = '2013-05-10'
5
10
  s.summary = "Maintain translations in Google Docs and export them to your Rails project."
6
11
  s.description = "GEM providing helper scripts to manage i18n translations in Google Docs. Features: check YAML files for missing translations; export YAML files to CSV; download translations from multiple Google spreadsheets and store to YAML files"
7
- s.authors = ["Georg Kunz", "Ivan Jovanovic", "Jeremy Seitz", "Eduard Schäli", "Robin Wu", "Esteban Pastorino"]
12
+ s.authors = ["Georg Kunz", "Ivan Jovanovic", "Jeremy Seitz", "Eduard Schäli", "Robin Wunderlin", "Esteban Pastorino"]
8
13
  s.email = 'jeremy.seitz@local.ch'
9
14
  s.files = `git ls-files`.split("\n")
10
15
  s.homepage = 'https://github.com/local-ch/i18n-docs'
@@ -42,6 +42,7 @@ module LocalchI18n
42
42
 
43
43
  def process_row(row_hash)
44
44
  key = row_hash.delete('key')
45
+ return unless key
45
46
 
46
47
  key_elements = key.split('.')
47
48
  @locales.each do |locale|
@@ -56,6 +57,7 @@ module LocalchI18n
56
57
  # Google Spreadsheet does not export empty strings and therefore we use '_' as a replacement char.
57
58
  value = '' if value == '_'
58
59
 
60
+ keys.each(&:strip!)
59
61
  tree = keys[0...-1]
60
62
  leaf = keys.last
61
63
  data_hash = tree.inject(@translations[locale]) do |memo, k|
@@ -8,7 +8,7 @@ module LocalchI18n
8
8
  @source_file = source_file
9
9
 
10
10
  @output_file = File.join(output_dir, source_file.gsub('.yml', '.csv'))
11
- @locales = locales.map {|l| l.to_s.downcase }
11
+ @locales = locales.map {|l| l.to_s }
12
12
 
13
13
  @translations = {}
14
14
  end
@@ -74,4 +74,4 @@ module LocalchI18n
74
74
 
75
75
  end
76
76
 
77
- end
77
+ end
@@ -0,0 +1,3 @@
1
+ module LocalchI18n
2
+ VERSION = '0.0.9'
3
+ end
@@ -15,6 +15,7 @@ namespace :i18n do
15
15
  raise "No config file 'config/translations.yml' found." if !File.exists?(config_file)
16
16
 
17
17
  tmp_dir = Rails.root.join('tmp')
18
+ Dir.mkdir(tmp_dir) unless Dir.exist?(tmp_dir)
18
19
 
19
20
  translations = LocalchI18n::Translations.new(config_file, tmp_dir)
20
21
  translations.download_files
@@ -36,6 +36,17 @@ module UnitTests
36
36
  assert_equal 'Welcome', translations['en']['homepage']['welcome']
37
37
  end
38
38
 
39
+ def test_empty_row
40
+ row1 = {'key' => 'homepage.meta.title', 'en' => 'Phonebook of Switzerland', 'de' => 'Telefonbuch der Schweiz'}
41
+ row2 = {'key' => nil, 'en' => 'Welcome', 'de' => 'Willkommen'}
42
+ @csv_to_yaml.process_row(row1)
43
+ @csv_to_yaml.process_row(row2)
44
+
45
+ translations = @csv_to_yaml.translations
46
+ assert_equal 'Telefonbuch der Schweiz', translations['de']['homepage']['meta']['title']
47
+ assert_equal 'Phonebook of Switzerland', translations['en']['homepage']['meta']['title']
48
+ end
49
+
39
50
  def test_row_containing_non_locale_columns
40
51
  row = {'key' => 'homepage.title', 'en' => "We are the Phonebook", 'de' => 'Test DE', 'comment' => "Test comment"}
41
52
  @csv_to_yaml.process_row(row)
@@ -128,6 +139,15 @@ module UnitTests
128
139
  @csv_to_yaml.write_files
129
140
  assert File.exists?(@output_file)
130
141
  end
142
+
143
+ def test_key_has_spaces
144
+ row = {'key' => 'has. space', 'en' => 'yes', 'de' => 'ja'}
145
+ @csv_to_yaml.process_row(row)
146
+
147
+ translations = @csv_to_yaml.translations
148
+ assert_equal 'ja', translations['de']['has']['space']
149
+ assert_equal 'yes', translations['en']['has']['space']
150
+ end
131
151
 
132
152
  end
133
153
  end
metadata CHANGED
@@ -1,15 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: i18n-docs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
5
- prerelease:
4
+ version: 0.0.9
6
5
  platform: ruby
7
6
  authors:
8
7
  - Georg Kunz
9
8
  - Ivan Jovanovic
10
9
  - Jeremy Seitz
11
10
  - Eduard Schäli
12
- - Robin Wu
11
+ - Robin Wunderlin
13
12
  - Esteban Pastorino
14
13
  autorequire:
15
14
  bindir: bin
@@ -19,60 +18,54 @@ dependencies:
19
18
  - !ruby/object:Gem::Dependency
20
19
  name: rake
21
20
  requirement: !ruby/object:Gem::Requirement
22
- none: false
23
21
  requirements:
24
- - - ! '>='
22
+ - - ">="
25
23
  - !ruby/object:Gem::Version
26
24
  version: '0'
27
25
  type: :runtime
28
26
  prerelease: false
29
27
  version_requirements: !ruby/object:Gem::Requirement
30
- none: false
31
28
  requirements:
32
- - - ! '>='
29
+ - - ">="
33
30
  - !ruby/object:Gem::Version
34
31
  version: '0'
35
32
  - !ruby/object:Gem::Dependency
36
33
  name: mocha
37
34
  requirement: !ruby/object:Gem::Requirement
38
- none: false
39
35
  requirements:
40
- - - ~>
36
+ - - "~>"
41
37
  - !ruby/object:Gem::Version
42
38
  version: 0.13.3
43
39
  type: :development
44
40
  prerelease: false
45
41
  version_requirements: !ruby/object:Gem::Requirement
46
- none: false
47
42
  requirements:
48
- - - ~>
43
+ - - "~>"
49
44
  - !ruby/object:Gem::Version
50
45
  version: 0.13.3
51
46
  - !ruby/object:Gem::Dependency
52
47
  name: awesome_print
53
48
  requirement: !ruby/object:Gem::Requirement
54
- none: false
55
49
  requirements:
56
- - - ! '>='
50
+ - - ">="
57
51
  - !ruby/object:Gem::Version
58
52
  version: '0'
59
53
  type: :development
60
54
  prerelease: false
61
55
  version_requirements: !ruby/object:Gem::Requirement
62
- none: false
63
56
  requirements:
64
- - - ! '>='
57
+ - - ">="
65
58
  - !ruby/object:Gem::Version
66
59
  version: '0'
67
- description: ! 'GEM providing helper scripts to manage i18n translations in Google
68
- Docs. Features: check YAML files for missing translations; export YAML files to
69
- CSV; download translations from multiple Google spreadsheets and store to YAML files'
60
+ description: 'GEM providing helper scripts to manage i18n translations in Google Docs.
61
+ Features: check YAML files for missing translations; export YAML files to CSV; download
62
+ translations from multiple Google spreadsheets and store to YAML files'
70
63
  email: jeremy.seitz@local.ch
71
64
  executables: []
72
65
  extensions: []
73
66
  extra_rdoc_files: []
74
67
  files:
75
- - .gitignore
68
+ - ".gitignore"
76
69
  - Gemfile
77
70
  - LICENSE.md
78
71
  - README.md
@@ -83,6 +76,7 @@ files:
83
76
  - lib/localch_i18n/missing_keys_finder.rb
84
77
  - lib/localch_i18n/translation_file_export.rb
85
78
  - lib/localch_i18n/translations.rb
79
+ - lib/localch_i18n/version.rb
86
80
  - lib/tasks/store_translations.rake
87
81
  - tasks/test.rake
88
82
  - test/fixtures/config.yml
@@ -96,27 +90,25 @@ files:
96
90
  - test/unit/translations_test.rb
97
91
  homepage: https://github.com/local-ch/i18n-docs
98
92
  licenses: []
93
+ metadata: {}
99
94
  post_install_message:
100
95
  rdoc_options: []
101
96
  require_paths:
102
97
  - lib
103
98
  required_ruby_version: !ruby/object:Gem::Requirement
104
- none: false
105
99
  requirements:
106
- - - ! '>='
100
+ - - ">="
107
101
  - !ruby/object:Gem::Version
108
102
  version: '0'
109
103
  required_rubygems_version: !ruby/object:Gem::Requirement
110
- none: false
111
104
  requirements:
112
- - - ! '>='
105
+ - - ">="
113
106
  - !ruby/object:Gem::Version
114
107
  version: '0'
115
108
  requirements: []
116
109
  rubyforge_project:
117
- rubygems_version: 1.8.24
110
+ rubygems_version: 2.4.8
118
111
  signing_key:
119
- specification_version: 3
112
+ specification_version: 4
120
113
  summary: Maintain translations in Google Docs and export them to your Rails project.
121
114
  test_files: []
122
- has_rdoc: