i18n-migrations 1.2.1 → 1.2.2
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 +21 -29
- data/lib/i18n/migrations/backends/crowd_translate_backend.rb +2 -3
- data/lib/i18n/migrations/backends/crowd_translate_client.rb +7 -3
- data/lib/i18n/migrations/config.rb +0 -8
- data/lib/i18n/migrations/migrator.rb +1 -1
- data/lib/i18n/migrations/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 44993d18af69d28ccfe2ec3a75a01c260276f6f4492d074a6fa8581cf3f9b6b3
|
4
|
+
data.tar.gz: bee4f8abc86f5d7f772d36ad451180370001a18e4c4da0567b5bc95b0e42616d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cbf4c2e6cd020ccd7c463547393234a3af4d0ce7f1cad67ea0a5699a50855bee01a26565e4a4403a70712964355af29f6f644080f1947369b14d8368b71d885f
|
7
|
+
data.tar.gz: d389b856751843009f199094761a3b5b742fe84e0792c1826bfd548c6abe99ef235484b3fabdaed17aa1b8a6383acc4de96f87584cde66b112242c6eed0d56ca
|
@@ -4,44 +4,36 @@ 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
|
+
|
7
19
|
# this is the locale you will be translating from
|
8
20
|
main_locale: en
|
9
21
|
|
10
|
-
# put all other locales you want to use here, if they don't already exist, add them with i18n-migrations
|
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
|
22
|
+
# put all other locales you want to use here, if they don't already exist, add them with i18n-migrations new-locale es
|
19
23
|
other_locales:
|
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
|
24
|
+
- es
|
26
25
|
|
27
26
|
# you need a service account key in order to access google spreadsheets. This is the path to it, relative to your config file
|
28
27
|
google_service_account_key_path: i18n/google_drive_key.json
|
29
28
|
|
30
|
-
#
|
31
|
-
|
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
|
29
|
+
# each locale will have a spreadsheet that translators will use to do their work, these are the links to them
|
30
|
+
google_spreadsheets:
|
31
|
+
es: https://docs.google.com/spreadsheets/d/YOUR_SPREADSHEET_ID/edit
|
36
32
|
|
37
33
|
# this is your api key to use google translate
|
38
34
|
google_translate_api_key: [INSERT_GOOGLE_TRANSLATE_API_KEY]
|
39
35
|
|
40
|
-
#
|
41
|
-
|
42
|
-
|
43
|
-
|
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
|
36
|
+
# put things like your product name here along with any possible mistranslations
|
37
|
+
do_not_translate:
|
38
|
+
"I18n Migrations":
|
39
|
+
- I18n Migraciones
|
@@ -6,9 +6,8 @@ module I18n
|
|
6
6
|
class CrowdTranslateBackend
|
7
7
|
attr_reader :client
|
8
8
|
|
9
|
-
def initialize
|
10
|
-
@client = CrowdTranslateClient.new
|
11
|
-
server_url: config.crowd_translate_server_url)
|
9
|
+
def initialize
|
10
|
+
@client = CrowdTranslateClient.new
|
12
11
|
end
|
13
12
|
|
14
13
|
def pull(locale)
|
@@ -5,10 +5,14 @@ module I18n
|
|
5
5
|
module Migrations
|
6
6
|
module Backends
|
7
7
|
class CrowdTranslateClient
|
8
|
-
def initialize
|
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'
|
9
13
|
@faraday = Faraday.new(
|
10
|
-
url:
|
11
|
-
headers: { 'X-CrowdTranslateApiToken' =>
|
14
|
+
url: "#{server}/api/v1",
|
15
|
+
headers: { 'X-CrowdTranslateApiToken' => token },
|
12
16
|
)
|
13
17
|
end
|
14
18
|
|
@@ -52,14 +52,6 @@ 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
|
-
|
63
55
|
def do_not_translate(locale)
|
64
56
|
return {} if locale.to_s == main_locale
|
65
57
|
|