web_translate_it 2.5.3 → 2.6.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,4 +1,3 @@
1
- # encoding: utf-8
2
1
  module WebTranslateIt
3
2
  # A TranslationFile is the representation of a master language file
4
3
  # on Web Translate It.
@@ -6,15 +5,15 @@ module WebTranslateIt
6
5
  # This class allows to manipulate TranslationFiles, more specifically upload and download them.
7
6
  # If you pass a Locale to the master language file you will be able to
8
7
  # manipulate a _target_ language file.
9
- class TranslationFile
8
+ class TranslationFile # rubocop:todo Metrics/ClassLength
10
9
  require 'net/https'
11
10
  require 'net/http/post/multipart'
12
11
  require 'time'
13
12
  require 'fileutils'
14
-
13
+
15
14
  attr_accessor :id, :file_path, :locale, :api_key, :updated_at, :remote_checksum, :master_id, :fresh
16
-
17
- def initialize(id, file_path, locale, api_key, updated_at = nil, remote_checksum = "", master_id = nil, fresh = nil)
15
+
16
+ def initialize(id, file_path, locale, api_key, updated_at = nil, remote_checksum = '', master_id = nil, fresh = nil) # rubocop:todo Metrics/ParameterLists
18
17
  self.id = id
19
18
  self.file_path = file_path
20
19
  self.locale = locale
@@ -24,7 +23,7 @@ module WebTranslateIt
24
23
  self.master_id = master_id
25
24
  self.fresh = fresh
26
25
  end
27
-
26
+
28
27
  # Fetch a language file.
29
28
  # By default it will make a conditional GET Request, using the `If-Modified-Since` tag.
30
29
  # You can force the method to re-download your file by passing `true` as a second argument
@@ -37,45 +36,45 @@ module WebTranslateIt
37
36
  # file.fetch # returns nothing, with a status 304 Not Modified
38
37
  # file.fetch(true) # force to re-download the file, will return the content of the file with a 200 OK
39
38
  #
40
- def fetch(http_connection, force = false)
39
+ def fetch(http_connection, force = false) # rubocop:todo Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/MethodLength, Metrics/PerceivedComplexity
41
40
  success = true
42
41
  tries ||= 3
43
42
  display = []
44
- if self.fresh
45
- display.push(self.file_path)
43
+ if fresh
44
+ display.push(file_path)
46
45
  else
47
- display.push("*#{self.file_path}")
46
+ display.push("*#{file_path}")
48
47
  end
49
- display.push "#{StringUtil.checksumify(self.local_checksum.to_s)}..#{StringUtil.checksumify(self.remote_checksum.to_s)}"
50
- if !File.exist?(self.file_path) or force or self.remote_checksum != self.local_checksum
48
+ display.push "#{StringUtil.checksumify(local_checksum.to_s)}..#{StringUtil.checksumify(remote_checksum.to_s)}"
49
+ if !File.exist?(file_path) || force || (remote_checksum != local_checksum)
51
50
  begin
52
51
  request = Net::HTTP::Get.new(api_url)
53
52
  WebTranslateIt::Util.add_fields(request)
54
- FileUtils.mkpath(self.file_path.split('/')[0..-2].join('/')) unless File.exist?(self.file_path) or self.file_path.split('/')[0..-2].join('/') == ""
53
+ FileUtils.mkpath(file_path.split('/')[0..-2].join('/')) unless File.exist?(file_path) || (file_path.split('/')[0..-2].join('/') == '')
55
54
  begin
56
55
  response = http_connection.request(request)
57
- File.open(self.file_path, 'wb'){ |file| file << response.body } if response.code.to_i == 200
56
+ File.open(file_path, 'wb') { |file| file << response.body } if response.code.to_i == 200
58
57
  display.push Util.handle_response(response)
59
58
  rescue Timeout::Error
60
- puts StringUtil.failure("Request timeout. Will retry in 5 seconds.")
61
- if (tries -= 1) > 0
59
+ puts StringUtil.failure('Request timeout. Will retry in 5 seconds.')
60
+ if (tries -= 1).positive?
62
61
  sleep(5)
63
62
  retry
64
63
  else
65
64
  success = false
66
65
  end
67
66
  rescue
68
- display.push StringUtil.failure("An error occured: #{$!}")
67
+ display.push StringUtil.failure("An error occured: #{$ERROR_INFO}")
69
68
  success = false
70
69
  end
71
70
  end
72
71
  else
73
- display.push StringUtil.success("Skipped")
72
+ display.push StringUtil.success('Skipped')
74
73
  end
75
74
  print ArrayUtil.to_columns(display)
76
- return success
75
+ success
77
76
  end
78
-
77
+
79
78
  # Update a language file to Web Translate It by performing a PUT Request.
80
79
  #
81
80
  # Example of implementation:
@@ -87,45 +86,51 @@ module WebTranslateIt
87
86
  #
88
87
  # Note that the request might or might not eventually be acted upon, as it might be disallowed when processing
89
88
  # actually takes place. This is due to the fact that language file imports are handled by background processing.
90
- def upload(http_connection, merge=false, ignore_missing=false, label=nil, low_priority=false, minor_changes=false, force=false, rename_others=false, destination_path=nil)
89
+ # rubocop:todo Metrics/PerceivedComplexity
90
+ # rubocop:todo Metrics/ParameterLists
91
+ # rubocop:todo Metrics/MethodLength
92
+ # rubocop:todo Metrics/AbcSize
93
+ def upload(http_connection, merge = false, ignore_missing = false, label = nil, low_priority = false, minor_changes = false, force = false, rename_others = false, destination_path = nil) # rubocop:todo Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/MethodLength, Metrics/ParameterLists, Metrics/PerceivedComplexity
91
94
  success = true
92
95
  tries ||= 3
93
96
  display = []
94
- display.push(self.file_path)
95
- display.push "#{StringUtil.checksumify(self.local_checksum.to_s)}..#{StringUtil.checksumify(self.remote_checksum.to_s)}"
96
- if File.exists?(self.file_path)
97
- if force or self.remote_checksum != self.local_checksum
98
- File.open(self.file_path) do |file|
99
- begin
100
- params = {"file" => UploadIO.new(file, "text/plain", file.path), "merge" => merge, "ignore_missing" => ignore_missing, "label" => label, "low_priority" => low_priority, "minor_changes" => minor_changes }
101
- params["name"] = destination_path unless destination_path.nil?
102
- params["rename_others"] = rename_others
103
- request = Net::HTTP::Put::Multipart.new(api_url, params)
104
- WebTranslateIt::Util.add_fields(request)
105
- display.push Util.handle_response(http_connection.request(request))
106
- rescue Timeout::Error
107
- puts StringUtil.failure("Request timeout. Will retry in 5 seconds.")
108
- if (tries -= 1) > 0
109
- sleep(5)
110
- retry
111
- else
112
- success = false
113
- end
114
- rescue
115
- display.push StringUtil.failure("An error occured: #{$!}")
97
+ display.push(file_path)
98
+ display.push "#{StringUtil.checksumify(local_checksum.to_s)}..#{StringUtil.checksumify(remote_checksum.to_s)}"
99
+ if File.exist?(file_path)
100
+ if force || (remote_checksum != local_checksum)
101
+ File.open(file_path) do |file|
102
+ params = { 'file' => UploadIO.new(file, 'text/plain', file.path), 'merge' => merge, 'ignore_missing' => ignore_missing, 'label' => label, 'low_priority' => low_priority, 'minor_changes' => minor_changes }
103
+ params['name'] = destination_path unless destination_path.nil?
104
+ params['rename_others'] = rename_others
105
+ request = Net::HTTP::Put::Multipart.new(api_url, params)
106
+ WebTranslateIt::Util.add_fields(request)
107
+ display.push Util.handle_response(http_connection.request(request))
108
+ rescue Timeout::Error
109
+ puts StringUtil.failure('Request timeout. Will retry in 5 seconds.')
110
+ if (tries -= 1).positive? # rubocop:todo Metrics/BlockNesting
111
+ sleep(5)
112
+ retry
113
+ else
116
114
  success = false
117
115
  end
116
+ rescue
117
+ display.push StringUtil.failure("An error occured: #{$ERROR_INFO}")
118
+ success = false
118
119
  end
119
120
  else
120
- display.push StringUtil.success("Skipped")
121
+ display.push StringUtil.success('Skipped')
121
122
  end
122
123
  puts ArrayUtil.to_columns(display)
123
124
  else
124
- puts StringUtil.failure("Can't push #{self.file_path}. File doesn't exist locally.")
125
+ puts StringUtil.failure("Can't push #{file_path}. File doesn't exist locally.")
125
126
  end
126
- return success
127
+ success
127
128
  end
128
-
129
+ # rubocop:enable Metrics/AbcSize
130
+ # rubocop:enable Metrics/MethodLength
131
+ # rubocop:enable Metrics/ParameterLists
132
+ # rubocop:enable Metrics/PerceivedComplexity
133
+
129
134
  # Create a master language file to Web Translate It by performing a POST Request.
130
135
  #
131
136
  # Example of implementation:
@@ -137,104 +142,102 @@ module WebTranslateIt
137
142
  # Note that the request might or might not eventually be acted upon, as it might be disallowed when processing
138
143
  # actually takes place. This is due to the fact that language file imports are handled by background processing.
139
144
  #
140
- def create(http_connection, low_priority=false)
145
+ def create(http_connection, low_priority = false) # rubocop:todo Metrics/AbcSize, Metrics/MethodLength
141
146
  success = true
142
147
  tries ||= 3
143
148
  display = []
144
149
  display.push file_path
145
- display.push "#{StringUtil.checksumify(self.local_checksum.to_s)}..[ ]"
146
- if File.exists?(self.file_path)
147
- File.open(self.file_path) do |file|
148
- begin
149
- request = Net::HTTP::Post::Multipart.new(api_url_for_create, { "name" => self.file_path, "file" => UploadIO.new(file, "text/plain", file.path), "low_priority" => low_priority })
150
- WebTranslateIt::Util.add_fields(request)
151
- display.push Util.handle_response(http_connection.request(request))
152
- puts ArrayUtil.to_columns(display)
153
- rescue Timeout::Error
154
- puts StringUtil.failure("Request timeout. Will retry in 5 seconds.")
155
- if (tries -= 1) > 0
156
- sleep(5)
157
- retry
158
- else
159
- success = false
160
- end
161
- rescue
162
- display.push StringUtil.failure("An error occured: #{$!}")
150
+ display.push "#{StringUtil.checksumify(local_checksum.to_s)}..[ ]"
151
+ if File.exist?(file_path)
152
+ File.open(file_path) do |file|
153
+ request = Net::HTTP::Post::Multipart.new(api_url_for_create, { 'name' => file_path, 'file' => UploadIO.new(file, 'text/plain', file.path), 'low_priority' => low_priority })
154
+ WebTranslateIt::Util.add_fields(request)
155
+ display.push Util.handle_response(http_connection.request(request))
156
+ puts ArrayUtil.to_columns(display)
157
+ rescue Timeout::Error
158
+ puts StringUtil.failure('Request timeout. Will retry in 5 seconds.')
159
+ if (tries -= 1).positive?
160
+ sleep(5)
161
+ retry
162
+ else
163
163
  success = false
164
164
  end
165
+ rescue
166
+ display.push StringUtil.failure("An error occured: #{$ERROR_INFO}")
167
+ success = false
165
168
  end
166
169
  else
167
- puts StringUtil.failure("\nFile #{self.file_path} doesn't exist locally!")
170
+ puts StringUtil.failure("\nFile #{file_path} doesn't exist locally!")
168
171
  end
169
- return success
172
+ success
170
173
  end
171
-
174
+
172
175
  # Delete a master language file from Web Translate It by performing a DELETE Request.
173
176
  #
174
- def delete(http_connection)
177
+ def delete(http_connection) # rubocop:todo Metrics/AbcSize, Metrics/MethodLength
175
178
  success = true
176
179
  tries ||= 3
177
180
  display = []
178
181
  display.push file_path
179
- if File.exists?(self.file_path)
182
+ if File.exist?(file_path)
180
183
  begin
181
184
  request = Net::HTTP::Delete.new(api_url_for_delete)
182
185
  WebTranslateIt::Util.add_fields(request)
183
186
  display.push Util.handle_response(http_connection.request(request))
184
187
  puts ArrayUtil.to_columns(display)
185
188
  rescue Timeout::Error
186
- puts StringUtil.failure("Request timeout. Will retry in 5 seconds.")
187
- if (tries -= 1) > 0
189
+ puts StringUtil.failure('Request timeout. Will retry in 5 seconds.')
190
+ if (tries -= 1).positive?
188
191
  sleep(5)
189
192
  retry
190
193
  else
191
194
  success = false
192
195
  end
193
196
  rescue
194
- display.push StringUtil.failure("An error occured: #{$!}")
197
+ display.push StringUtil.failure("An error occured: #{$ERROR_INFO}")
195
198
  success = false
196
199
  end
197
200
  else
198
- puts StringUtil.failure("\nMaster file #{self.file_path} doesn't exist locally!")
201
+ puts StringUtil.failure("\nMaster file #{file_path} doesn't exist locally!")
199
202
  end
200
- return success
203
+ success
201
204
  end
202
205
 
203
206
  def exists?
204
- File.exists?(file_path)
207
+ File.exist?(file_path)
205
208
  end
206
-
209
+
207
210
  def modified_remotely?
208
- fetch == "200 OK"
211
+ fetch == '200 OK'
209
212
  end
210
-
213
+
211
214
  protected
212
-
213
- # Convenience method which returns the date of last modification of a language file.
214
- def last_modification
215
- File.mtime(File.new(self.file_path, 'r'))
216
- end
217
-
218
- # Convenience method which returns the URL of the API endpoint for a locale.
219
- def api_url
220
- "/api/projects/#{self.api_key}/files/#{self.id}/locales/#{self.locale}"
221
- end
222
-
223
- def api_url_for_create
224
- "/api/projects/#{self.api_key}/files"
225
- end
226
-
227
- def api_url_for_delete
228
- "/api/projects/#{self.api_key}/files/#{self.id}"
229
- end
230
-
231
- def local_checksum
232
- require 'digest/sha1'
233
- begin
234
- Digest::SHA1.hexdigest(File.open(file_path) { |f| f.read })
235
- rescue
236
- ""
237
- end
215
+
216
+ # Convenience method which returns the date of last modification of a language file.
217
+ def last_modification
218
+ File.mtime(File.new(file_path, 'r'))
219
+ end
220
+
221
+ # Convenience method which returns the URL of the API endpoint for a locale.
222
+ def api_url
223
+ "/api/projects/#{api_key}/files/#{id}/locales/#{locale}"
224
+ end
225
+
226
+ def api_url_for_create
227
+ "/api/projects/#{api_key}/files"
228
+ end
229
+
230
+ def api_url_for_delete
231
+ "/api/projects/#{api_key}/files/#{id}"
232
+ end
233
+
234
+ def local_checksum
235
+ require 'digest/sha1'
236
+ begin
237
+ Digest::SHA1.hexdigest(File.read(file_path))
238
+ rescue
239
+ ''
238
240
  end
241
+ end
239
242
  end
240
243
  end
@@ -1,22 +1,22 @@
1
1
  class ArrayUtil
2
2
  def self.to_columns(arr)
3
- if arr[0][0] == "*"
3
+ if arr[0][0] == '*'
4
4
  "*#{StringUtil.backward_truncate(arr[0][1..-1])} | #{arr[1]} #{arr[2]}\n"
5
5
  else
6
6
  " #{StringUtil.backward_truncate(arr[0])} | #{arr[1]} #{arr[2]}\n"
7
7
  end
8
8
  end
9
9
 
10
- def self.chunk(arr, pieces=2)
11
- len = arr.length;
12
- mid = (len/pieces)
10
+ def self.chunk(arr, pieces = 2) # rubocop:todo Metrics/MethodLength
11
+ len = arr.length
12
+ mid = (len / pieces)
13
13
  chunks = []
14
14
  start = 0
15
15
  1.upto(pieces) do |i|
16
- last = start+mid
17
- last = last-1 unless len%pieces >= i
18
- chunks << arr[start..last] || []
19
- start = last+1
16
+ last = start + mid
17
+ last -= 1 unless len % pieces >= i
18
+ chunks << (arr[start..last] || [])
19
+ start = last + 1
20
20
  end
21
21
  chunks
22
22
  end
@@ -1,18 +1,18 @@
1
1
  class HashUtil
2
- def self.to_params(hash)
2
+ def self.to_params(hash) # rubocop:todo Metrics/MethodLength
3
3
  params = ''
4
4
  stack = []
5
5
 
6
6
  hash.each do |k, v|
7
7
  if v.is_a?(Hash)
8
- stack << [k,v]
8
+ stack << [k, v]
9
9
  else
10
10
  params << "#{k}=#{v}&"
11
11
  end
12
12
  end
13
13
 
14
- stack.each do |parent, hash|
15
- hash.each do |k, v|
14
+ stack.each do |parent, h|
15
+ h.each do |k, v|
16
16
  if v.is_a?(Hash)
17
17
  stack << ["#{parent}[#{k}]", v]
18
18
  else
@@ -34,4 +34,4 @@ class Hash
34
34
  end
35
35
  self
36
36
  end
37
- end
37
+ end
@@ -1,13 +1,10 @@
1
1
  class StringUtil
2
-
3
2
  def self.backward_truncate(str)
4
- if str.length <= 50
5
- spaces = ""
6
- (50-str.length).times{ spaces << " " }
7
- return str.dup << spaces
8
- else
9
- return "..." << str[str.length-50+3..str.length]
10
- end
3
+ return '...' << str[str.length - 50 + 3..str.length] if str.length > 50
4
+
5
+ spaces = ''
6
+ (50 - str.length).times { spaces << ' ' }
7
+ str.dup << spaces
11
8
  end
12
9
 
13
10
  def self.success(str)
@@ -1,55 +1,55 @@
1
- # encoding: utf-8
2
1
  module WebTranslateIt
3
-
4
2
  # A few useful functions
5
3
  class Util
6
-
7
4
  require 'multi_json'
8
-
5
+
9
6
  # Return a string representing the gem version
10
7
  # For example "1.8.3"
11
8
  def self.version
12
9
  Gem.loaded_specs['web_translate_it'].version
13
10
  end
14
-
11
+
15
12
  def self.calculate_percentage(processed, total)
16
- return 0 if total == 0
17
- ((processed*10)/total).to_f.ceil*10
13
+ return 0 if total.zero?
14
+
15
+ ((processed * 10) / total).to_f.ceil * 10
18
16
  end
19
-
20
- def self.handle_response(response, return_response = false, raise_exception = false)
21
- if response.code.to_i >= 400 and response.code.to_i < 500
22
- if raise_exception
23
- raise "Error: #{MultiJson.load(response.body)['error']}"
24
- else
25
- puts StringUtil.failure(MultiJson.load(response.body)['error'])
26
- end
17
+
18
+ # rubocop:todo Metrics/PerceivedComplexity
19
+ # rubocop:todo Metrics/MethodLength
20
+ # rubocop:todo Metrics/AbcSize
21
+ def self.handle_response(response, return_response = false, raise_exception = false) # rubocop:todo Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/MethodLength, Metrics/PerceivedComplexity
22
+ if (response.code.to_i >= 400) && (response.code.to_i < 500)
23
+ raise "Error: #{MultiJson.load(response.body)['error']}" if raise_exception
24
+
25
+ puts StringUtil.failure(MultiJson.load(response.body)['error'])
27
26
  elsif response.code.to_i == 500
28
- if raise_exception
29
- raise "Error: Server temporarily unavailable (Error 500)."
30
- else
31
- puts StringUtil.failure("Error: Server temporarily unavailable (Error 500).")
32
- end
27
+ raise 'Error: Server temporarily unavailable (Error 500).' if raise_exception
28
+
29
+ puts StringUtil.failure('Error: Server temporarily unavailable (Error 500).')
33
30
  else
34
31
  return response.body if return_response
35
- return StringUtil.success("OK") if response.code.to_i == 200
36
- return StringUtil.success("Created") if response.code.to_i == 201
37
- return StringUtil.success("Accepted") if response.code.to_i == 202
38
- return StringUtil.success("Not Modified") if response.code.to_i == 304
32
+ return StringUtil.success('OK') if response.code.to_i == 200
33
+ return StringUtil.success('Created') if response.code.to_i == 201
34
+ return StringUtil.success('Accepted') if response.code.to_i == 202
35
+ return StringUtil.success('Not Modified') if response.code.to_i == 304
39
36
  return StringUtil.failure("Locked\n (another import in progress)") if response.code.to_i == 503
40
37
  end
41
38
  end
42
-
39
+ # rubocop:enable Metrics/AbcSize
40
+ # rubocop:enable Metrics/MethodLength
41
+ # rubocop:enable Metrics/PerceivedComplexity
42
+
43
43
  def self.add_fields(request)
44
- request.add_field("X-Client-Name", "web_translate_it")
45
- request.add_field("X-Client-Version", version)
46
- request.add_field("Content-Type", "application/json")
44
+ request.add_field('X-Client-Name', 'web_translate_it')
45
+ request.add_field('X-Client-Version', version)
46
+ request.add_field('Content-Type', 'application/json')
47
47
  end
48
-
48
+
49
49
  ##
50
50
  # Ask a question. Returns a true for yes, false for no, default for nil.
51
-
52
- def self.ask_yes_no(question, default=nil)
51
+
52
+ def self.ask_yes_no(question, default = nil) # rubocop:todo Metrics/MethodLength
53
53
  qstr = case default
54
54
  when nil
55
55
  'yn'
@@ -64,40 +64,37 @@ module WebTranslateIt
64
64
  while result.nil?
65
65
  result = ask("#{question} [#{qstr}]")
66
66
  result = case result
67
- when /^[Yy].*/
68
- true
69
- when /^[Nn].*/
70
- false
71
- when /^$/
72
- when nil
73
- default
74
- else
75
- nil
76
- end
67
+ when /^[Yy].*/
68
+ true
69
+ when /^[Nn].*/
70
+ false
71
+ when '', nil
72
+ default
73
+ end
77
74
  end
78
75
 
79
- return result
76
+ result
80
77
  end
81
-
78
+
82
79
  ##
83
80
  # Ask a question. Returns an answer.
84
81
 
85
- def self.ask(question, default=nil)
86
- question = question + " (Default: #{default})" unless default.nil?
87
- print(question + " ")
88
- STDOUT.flush
82
+ def self.ask(question, default = nil)
83
+ question += " (Default: #{default})" unless default.nil?
84
+ print("#{question} ")
85
+ $stdout.flush
89
86
 
90
- result = STDIN.gets
91
- result.chomp! if result
92
- result = default if result.nil? or result == ''
87
+ result = $stdin.gets
88
+ result&.chomp!
89
+ result = default if result.nil? || (result == '')
93
90
  result
94
91
  end
95
-
92
+
96
93
  ##
97
94
  # Returns whether a terminal can display ansi colors
98
-
95
+
99
96
  def self.can_display_colors?
100
- !RUBY_PLATFORM.downcase.include?("mingw32")
97
+ !RUBY_PLATFORM.downcase.include?('mingw32')
101
98
  end
102
99
  end
103
- end
100
+ end
@@ -1,5 +1,3 @@
1
- # encoding: utf-8
2
-
3
1
  require 'web_translate_it/connection'
4
2
  require 'web_translate_it/util'
5
3
  require 'web_translate_it/util/array_util'
@@ -15,16 +13,18 @@ require 'web_translate_it/auto_fetch'
15
13
  require 'web_translate_it/command_line'
16
14
  require 'web_translate_it/project'
17
15
 
18
- module WebTranslateIt
16
+ require 'English'
19
17
 
20
- def self.fetch_translations
18
+ module WebTranslateIt
19
+ def self.fetch_translations # rubocop:todo Metrics/AbcSize
21
20
  config = Configuration.new
22
21
  locale = I18n.locale.to_s
23
22
  return if config.ignore_locales.include?(locale)
24
- config.logger.debug { " Fetching #{locale} language file(s) from WebTranslateIt" } if config.logger
23
+
24
+ config.logger&.debug { " Fetching #{locale} language file(s) from WebTranslateIt" }
25
25
  WebTranslateIt::Connection.new(config.api_key) do |http|
26
- config.files.find_all{ |file| file.locale.in?([locale, I18n.locale]) }.each do |file|
27
- response = file.fetch(http)
26
+ config.files.find_all { |file| file.locale.in?([locale, I18n.locale]) }.each do |file|
27
+ file.fetch(http)
28
28
  end
29
29
  end
30
30
  end
data/readme.md CHANGED
@@ -1,9 +1,9 @@
1
1
  # WebTranslateIt Synchronization Tool : wti
2
2
 
3
- [RubyDoc](https://rubydoc.info/github/webtranslateit/webtranslateit/master) |
4
- [Report a bug](https://github.com/webtranslateit/webtranslateit/issues) |
5
- [Support](https://webtranslateit.com/en/support) |
6
- [WebTranslateIt.com Homepage](https://webtranslateit.com/en)
3
+ [RubyDoc](https://rubydoc.info/github/webtranslateit/webtranslateit/master) |
4
+ [Report a bug](https://github.com/webtranslateit/webtranslateit/issues) |
5
+ [Support](https://webtranslateit.com/support) |
6
+ [WebTranslateIt.com Homepage](https://webtranslateit.com)
7
7
 
8
8
  wti lets you easily sync your language files with [WebTranslateIt.com](https://webtranslateit.com), a web-based tool to translation software.
9
9
 
@@ -32,7 +32,7 @@ Fetching: web_translate_it-2.1.3.gem (100%)
32
32
  Successfully installed web_translate_it-2.1.3
33
33
  1 gem installed
34
34
  ```
35
-
35
+
36
36
  At this point you should have the `wti` executable working:
37
37
 
38
38
  ``` bash
@@ -74,14 +74,18 @@ If you’d like to specify another path for your configuration file, you can use
74
74
 
75
75
  Now you’re all set and you can use the `wti` commands on your project.
76
76
 
77
+ ## Using on multiple projects
78
+
79
+ Please refer to [our documentation about syncing multiple projects](https://github.com/webtranslateit/webtranslateit/wiki/Using-wti-with-multiple-projects).
80
+
77
81
  ## Usage
78
82
 
79
83
  Execute `wti --help` to see the usage:
80
84
 
81
85
  Usage: wti <command> [options]+
82
-
86
+
83
87
  The most commonly used wti commands are:
84
-
88
+
85
89
  pull Pull target language file(s)
86
90
  push Push master language file(s)
87
91
  match Display matching of local files with File Manager
@@ -92,7 +96,7 @@ Execute `wti --help` to see the usage:
92
96
  init Configure your project to sync
93
97
 
94
98
  See `wti <command> --help` for more information on a specific command.
95
-
99
+
96
100
  [options] are:
97
101
  --config, -c <s>: Path to a translation.yml file (default: .wti)
98
102
  --version, -v: Print version and exit
@@ -213,7 +217,7 @@ There are 4 hooks:
213
217
  * `before_push`
214
218
  * `after_push`
215
219
 
216
- Check the [sample `.wti`](https://github.com/webtranslateit/webtranslateit/blob/master/examples/.wti#L9..L13) file for implementation.
220
+ Check the [sample `.wti`](https://github.com/webtranslateit/webtranslateit/blob/master/examples/.wti#L16-L21) file for implementation.
217
221
 
218
222
  ## Exit codes
219
223