i18n-migrations 2.0.3 → 2.0.4

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
  SHA256:
3
- metadata.gz: 81cdab3c95ecdf3eadada65b83f94e51733cca841bda8862def4150f3ca182ce
4
- data.tar.gz: bcce6ac35266718cc3e49ec7289cba1dedd8f0e012c916a82c1fe323390034a7
3
+ metadata.gz: 8fc754b54a85b172209a62717aabb6207bb646be0fca6e04d777732c0c5979bb
4
+ data.tar.gz: d1b35b6d1d71c7ddfb83904cdff9cca5b307899330b363287c607220ceeccd72
5
5
  SHA512:
6
- metadata.gz: 65f1fd2c2b047d76b74f6ca85699d8ee5e618b9d35a8e4d24d19a42c851833cfd4cc4f22668f31aecc9eaa2806fffa4801e262ac6193944497fadc48c3c4dcc3
7
- data.tar.gz: e041b073626e8546226677bfb927a85a6c3235a233efe33a992b6e7dcb1da2f67c02469552b328b09e6b06ca642fd8579ec378fa08d605a5086342ec75cce5b6
6
+ metadata.gz: de609cad812e1793e2e9eeff28cfe60ccda2c8b50af2fe97b9f01270f1f661c870b1be3c79bd1ffbe52414e5cb8a54fd2fdc17016eceba94593ca9254bb95d05
7
+ data.tar.gz: 4f023a9a8b03ffba035c6b293fb51ca68e9274d51cc3adf9a7658575c42df3268ad54e2a04b7ad4d63f43e55968927785f0b045becc646696f3b707eb346849c
data/README.md CHANGED
@@ -47,20 +47,10 @@ Let's imagine that your config file look like this:
47
47
 
48
48
  In your project file, you should then have all your english terms in ```config/locales/en.yml```
49
49
 
50
- To create a new locale (like es.yml):
51
-
52
- 1. Translate all the terms w/ google translate
53
-
54
- > i18n-migrate new_locale es
55
-
56
- 2. Create a spreadsheet that is world editable (for now). You'll want to add the link to it to your config file. It should look like:
57
-
58
- | key | en | es | notes |
59
-
60
- 2. Push this to your google spreadsheet (the -f means it won't try to pull first)
61
-
62
- > i18n-migrate push -f es
50
+ You can:
63
51
 
52
+ * [Create a new locale](https://github.com/transparentclassroom/i18n-migrations/wiki/Create-a-new-locale-(language))
53
+ * [Add a migration](https://github.com/transparentclassroom/i18n-migrations/wiki/Add-a-migration)
64
54
 
65
55
  ## Development
66
56
 
@@ -71,8 +61,9 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
71
61
  ## Contributing
72
62
 
73
63
  1. Fork it ( https://github.com/[my-github-username]/i18n-migrations/fork )
74
- 2. Create your feature branch (`git checkout -b my-new-feature`)
75
- 3. Commit your changes (`git commit -am 'Add some feature'`)
76
- 4. Push to the branch (`git push origin my-new-feature`)
77
- 5. Create a new Pull Request
64
+ 1. Create your feature branch (`git checkout -b my-new-feature`)
65
+ 1. Make sure tests are passing (`rake`)
66
+ 1. Commit your changes (`git commit -am 'Add some feature'`)
67
+ 1. Push to the branch (`git push origin my-new-feature`)
68
+ 1. Create a new Pull Request
78
69
 
@@ -49,10 +49,14 @@ module I18n
49
49
  if response.success?
50
50
  response.body
51
51
  else
52
- error = begin
53
- JSON.parse(response.body)['error']
54
- rescue
55
- response.body
52
+ error = if response.status == 503
53
+ 'Server timed out - your request may have succeed, check the server for more details'
54
+ else
55
+ begin
56
+ JSON.parse(response.body)['error']
57
+ rescue
58
+ response.body
59
+ end
56
60
  end
57
61
  raise CrowdTranslateError, "... while calling #{method} #{File.join(base_url, path)}\n#{error}"
58
62
  end
@@ -27,15 +27,15 @@ module I18n
27
27
  raise("Can't parse version: #{version}") unless version =~ /^(\d{12})_(.*)/
28
28
  migration_class_name = "#{$2.camelcase}#{$1}"
29
29
 
30
- translations = Translations.new(data: data, metadata: metadata)
30
+ translations = Translations.new(locale_code: locale, data: data, metadata: metadata)
31
31
  migration = begin
32
- migration_class_name.constantize.new(locale_code: locale,
33
- translations: translations,
34
- dictionary: dictionary,
35
- direction: direction)
36
- rescue
37
- raise "Couldn't load migration #{migration_class_name} in #{filename}"
38
- end
32
+ migration_class_name.constantize.new(locale_code: locale,
33
+ translations: translations,
34
+ dictionary: dictionary,
35
+ direction: direction)
36
+ rescue
37
+ raise "Couldn't load migration #{migration_class_name} in #{filename}"
38
+ end
39
39
 
40
40
  migration.change
41
41
  end
@@ -44,8 +44,8 @@ module I18n
44
44
  # data = all keys -> all translations in this locale
45
45
  # metadata = some keys -> metadata about the translation in this locale
46
46
  class Translations
47
- def initialize(data:, metadata:)
48
- @data, @metadata = data, metadata
47
+ def initialize(locale_code:, data:, metadata:)
48
+ @locale_code, @data, @metadata = locale_code, data, metadata
49
49
  end
50
50
 
51
51
  def get_term(key)
@@ -63,6 +63,17 @@ module I18n
63
63
  @metadata[key].errors = errors
64
64
  @metadata[key].notes = nil
65
65
  @metadata[key].autotranslated = autotranslated
66
+ if errors.present?
67
+ puts [
68
+ "=" * 100,
69
+ "#{@locale_code}: #{key}",
70
+ value,
71
+ errors.map { |e| "Error: #{e}".red }.join("\n"),
72
+ "=" * 100,
73
+ ].compact.join("\n")
74
+ # puts ["Error with #{@locale_code}: #{key}: \n #{errors.join("\n ")}".red,
75
+ # value].compact.join("\n")
76
+ end
66
77
  end
67
78
 
68
79
  def delete_term(key)
@@ -1,5 +1,5 @@
1
1
  module I18n
2
2
  module Migrations
3
- VERSION = "2.0.3"
3
+ VERSION = "2.0.4"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: i18n-migrations
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.3
4
+ version: 2.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Lightsmith
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-07-24 00:00:00.000000000 Z
11
+ date: 2020-07-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler