i18n-migrations 2.0.3 → 2.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +8 -17
- data/lib/i18n/migrations/backends/crowd_translate_client.rb +8 -4
- data/lib/i18n/migrations/migration_factory.rb +21 -10
- data/lib/i18n/migrations/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8fc754b54a85b172209a62717aabb6207bb646be0fca6e04d777732c0c5979bb
|
4
|
+
data.tar.gz: d1b35b6d1d71c7ddfb83904cdff9cca5b307899330b363287c607220ceeccd72
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
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
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
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 =
|
53
|
-
|
54
|
-
|
55
|
-
|
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
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
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)
|
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.
|
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-
|
11
|
+
date: 2020-07-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|