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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 21f147cba399eb84cceba91a2973b74727ab79860bb3abf0afb5ba9d6c711009
4
- data.tar.gz: 3389c9810857757574618474ca4d1eed0e7d63c6b34d5bb3356a166e06faf32c
3
+ metadata.gz: 44993d18af69d28ccfe2ec3a75a01c260276f6f4492d074a6fa8581cf3f9b6b3
4
+ data.tar.gz: bee4f8abc86f5d7f772d36ad451180370001a18e4c4da0567b5bc95b0e42616d
5
5
  SHA512:
6
- metadata.gz: e0ddd991774e877eb260f39772648ddbdfeacdf98015201c9df2fa010613bbbaa2e78af302dc946c682b49c8ddee8457d9a0d093a8d8a744a8b2e7c9f58e5c6c
7
- data.tar.gz: 4eebcacbc1e59674eb3001fbc7e7e169b503cf0b1cd768420db045776aa34ba6664c1017bb42618a5443206cbd694b0a2a45cccf3b62cf4a7339c77098b35c3b
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 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
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
- # 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
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
- # 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
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(config)
10
- @client = CrowdTranslateClient.new(api_token: config.crowd_translate_api_token,
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(api_token:, server_url:)
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: File.join(server_url, '/api/v1'),
11
- headers: { 'X-CrowdTranslateApiToken' => api_token },
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
 
@@ -141,7 +141,7 @@ end
141
141
 
142
142
  private def backend
143
143
  @backend ||= if config.crowd_translate?
144
- Backends::CrowdTranslateBackend.new(config)
144
+ Backends::CrowdTranslateBackend.new
145
145
  else
146
146
  Backends::GoogleSpreadsheetsBackend.new(config)
147
147
  end
@@ -1,5 +1,5 @@
1
1
  module I18n
2
2
  module Migrations
3
- VERSION = "1.2.1"
3
+ VERSION = "1.2.2"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: i18n-migrations
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1
4
+ version: 1.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Lightsmith