i18n-migrations 1.2.0 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.i18n-migrations.default.yml +29 -21
- data/lib/i18n/migrations/backends/crowd_translate_backend.rb +3 -2
- data/lib/i18n/migrations/backends/crowd_translate_client.rb +3 -7
- data/lib/i18n/migrations/config.rb +8 -0
- data/lib/i18n/migrations/migrator.rb +1 -1
- 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: 21f147cba399eb84cceba91a2973b74727ab79860bb3abf0afb5ba9d6c711009
|
4
|
+
data.tar.gz: 3389c9810857757574618474ca4d1eed0e7d63c6b34d5bb3356a166e06faf32c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e0ddd991774e877eb260f39772648ddbdfeacdf98015201c9df2fa010613bbbaa2e78af302dc946c682b49c8ddee8457d9a0d093a8d8a744a8b2e7c9f58e5c6c
|
7
|
+
data.tar.gz: 4eebcacbc1e59674eb3001fbc7e7e169b503cf0b1cd768420db045776aa34ba6664c1017bb42618a5443206cbd694b0a2a45cccf3b62cf4a7339c77098b35c3b
|
@@ -4,36 +4,44 @@ migration_dir: i18n/migrate
|
|
4
4
|
# this is where your locale files will live (en.yml, es.yml, etc). it will be relative to your config file
|
5
5
|
locales_dir: config/locales
|
6
6
|
|
7
|
-
# choose either google_spreadsheets or crowd_translate as a backend
|
8
|
-
backend: google_spreadsheets
|
9
|
-
|
10
|
-
# number of threads to concurrently perform migration operations for locales (optional)
|
11
|
-
# concurrency: 4
|
12
|
-
|
13
|
-
# number of threads to concurrently perform push operation for locales (optional)
|
14
|
-
# push_concurrency: 4
|
15
|
-
|
16
|
-
# seconds to wait time between push operations per thread, can be used to avoid API throttling (optional)
|
17
|
-
# wait_seconds: 0
|
18
|
-
|
19
7
|
# this is the locale you will be translating from
|
20
8
|
main_locale: en
|
21
9
|
|
22
|
-
# put all other locales you want to use here, if they don't already exist, add them with i18n-migrations
|
10
|
+
# put all other locales you want to use here, if they don't already exist, add them with i18n-migrations new_locale es
|
11
|
+
# each locale needs:
|
12
|
+
# name: Spanish
|
13
|
+
# # a spreadsheet that translators will use to do their work, these are the links to them
|
14
|
+
# google_spreadsheet: https://docs.google.com/spreadsheets/d/ID/edit
|
15
|
+
# # these are strings that should not show up in our translations. As in translations of proper nouns.
|
16
|
+
# do_not_translate:
|
17
|
+
# - Aula Transparente
|
18
|
+
# - clase transparente
|
23
19
|
other_locales:
|
24
|
-
|
20
|
+
es:
|
21
|
+
name: Spanish
|
22
|
+
# google_spreadsheet: https://docs.google.com/spreadsheets/d/1SpxQWX3l4pwW9tyKhfo2VPemhn6olJYTPV0dudknpRE/edit
|
23
|
+
do_not_translate: # put things like your product name here along with any possible mistranslations
|
24
|
+
"I18n Migrations":
|
25
|
+
- I18n Migraciones
|
25
26
|
|
26
27
|
# you need a service account key in order to access google spreadsheets. This is the path to it, relative to your config file
|
27
28
|
google_service_account_key_path: i18n/google_drive_key.json
|
28
29
|
|
29
|
-
#
|
30
|
-
google_spreadsheets
|
31
|
-
|
30
|
+
# choose either google_spreadsheets or crowd_translate as a backend
|
31
|
+
backend: google_spreadsheets
|
32
|
+
|
33
|
+
# if you are using crowd translate, uncomment these lines and make sure they are correct
|
34
|
+
# crowd_translate_server_url: https://crowd-translate.herokuapp.com/c/X
|
35
|
+
# crowd_translate_api_token: xxxxxxxxxxxxxxxxxxxxxxxxxxxx-xxxxxxxxxxxxxxxxxxxxx
|
32
36
|
|
33
37
|
# this is your api key to use google translate
|
34
38
|
google_translate_api_key: [INSERT_GOOGLE_TRANSLATE_API_KEY]
|
35
39
|
|
36
|
-
#
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
+
# number of threads to concurrently perform migration operations for locales (optional)
|
41
|
+
# concurrency: 4
|
42
|
+
|
43
|
+
# number of threads to concurrently perform push operation for locales (optional)
|
44
|
+
# push_concurrency: 4
|
45
|
+
|
46
|
+
# seconds to wait time between push operations per thread, can be used to avoid API throttling (optional)
|
47
|
+
# wait_seconds: 0
|
@@ -6,8 +6,9 @@ module I18n
|
|
6
6
|
class CrowdTranslateBackend
|
7
7
|
attr_reader :client
|
8
8
|
|
9
|
-
def initialize
|
10
|
-
@client = CrowdTranslateClient.new
|
9
|
+
def initialize(config)
|
10
|
+
@client = CrowdTranslateClient.new(api_token: config.crowd_translate_api_token,
|
11
|
+
server_url: config.crowd_translate_server_url)
|
11
12
|
end
|
12
13
|
|
13
14
|
def pull(locale)
|
@@ -5,14 +5,10 @@ module I18n
|
|
5
5
|
module Migrations
|
6
6
|
module Backends
|
7
7
|
class CrowdTranslateClient
|
8
|
-
def initialize
|
9
|
-
token = ENV['CROWD_TRANSLATE_API_TOKEN']
|
10
|
-
raise("You must define CROWD_TRANSLATE_API_TOKEN in order to talk to Crowd Translate") unless token.present?
|
11
|
-
|
12
|
-
server = ENV['CROWD_TRANSLATE_SERVER'] || 'https://crowd-translate.herokuapp.com'
|
8
|
+
def initialize(api_token:, server_url:)
|
13
9
|
@faraday = Faraday.new(
|
14
|
-
url:
|
15
|
-
headers: { 'X-CrowdTranslateApiToken' =>
|
10
|
+
url: File.join(server_url, '/api/v1'),
|
11
|
+
headers: { 'X-CrowdTranslateApiToken' => api_token },
|
16
12
|
)
|
17
13
|
end
|
18
14
|
|
@@ -52,6 +52,14 @@ module I18n
|
|
52
52
|
get_value([:other_locales, locale, :google_spreadsheet])
|
53
53
|
end
|
54
54
|
|
55
|
+
def crowd_translate_api_token
|
56
|
+
get_value(:crowd_translate_api_token)
|
57
|
+
end
|
58
|
+
|
59
|
+
def crowd_translate_server_url
|
60
|
+
get_value(:crowd_translate_server_url)
|
61
|
+
end
|
62
|
+
|
55
63
|
def do_not_translate(locale)
|
56
64
|
return {} if locale.to_s == main_locale
|
57
65
|
|
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: 1.2.
|
4
|
+
version: 1.2.1
|
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-02-
|
11
|
+
date: 2020-02-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|