web_translate_it 2.4.2 → 2.4.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/history.md +17 -0
- data/lib/web_translate_it/command_line.rb +8 -8
- data/lib/web_translate_it/project.rb +1 -1
- data/lib/web_translate_it/util.rb +2 -2
- data/readme.md +27 -12
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cd683498148e92ac0a7a20fcafd94620e390f795
|
4
|
+
data.tar.gz: 151903d37541e3711142e254e083499de5a9f00f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2068c93aad7c1085a6b135986368e91445db6cdccab794862716ce81e3168bf515ac458837208f966dbd4a476ff3a30f2e6bd4c323d153e39b8c570d43f8908e
|
7
|
+
data.tar.gz: c81bab4dba2b24ea3a789efc47969142e8b50cf4503e5bbb219fffe5ef0b51ee17e01bdb88ed539612ff53ce6cb246ed8a44dbb7a0f7de08237076e76a13f854
|
data/history.md
CHANGED
@@ -1,3 +1,20 @@
|
|
1
|
+
## Version 2.4.3 / 2017-11-22
|
2
|
+
|
3
|
+
* Clearer error message when no files to push. #136
|
4
|
+
* New: ability to pull by file name and language. #133
|
5
|
+
Example: `wti pull config/locales/app/* -l en`
|
6
|
+
* New: `wti pull [filepath]` now pulls files matching a
|
7
|
+
[glob](https://en.wikipedia.org/wiki/Glob_(programming)) match
|
8
|
+
on the files hosted on WebTranslateIt.com (instead of relying on
|
9
|
+
shell’s list of files which might not exist on the first pull). Close #137.
|
10
|
+
This shouldn’t change existing commands but allows typing something like:
|
11
|
+
`wti pull config/locales/*/en.yml` to download only the `en` files.
|
12
|
+
* Fix: Report error messages when running commands such as:
|
13
|
+
- wti rmlocale xxx
|
14
|
+
- wti addlocale xxx
|
15
|
+
- wti status
|
16
|
+
#139
|
17
|
+
|
1
18
|
## Version 2.4.2 / 2017-09-28
|
2
19
|
|
3
20
|
* Fixed an issue where a file would not be created if its content was empty.
|
@@ -38,12 +38,12 @@ module WebTranslateIt
|
|
38
38
|
# Selecting files to pull
|
39
39
|
files = []
|
40
40
|
fetch_locales_to_pull.each do |locale|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
end
|
41
|
+
files |= configuration.files.find_all{ |file| file.locale == locale }
|
42
|
+
end
|
43
|
+
parameters.each do |parameter|
|
44
|
+
files = files.find_all{ |file| File.fnmatch(parameter, file.file_path) }
|
46
45
|
end
|
46
|
+
files = files.uniq.sort{ |a,b| a.file_path <=> b.file_path }
|
47
47
|
if files.size == 0
|
48
48
|
puts "No files to pull."
|
49
49
|
else
|
@@ -83,7 +83,7 @@ module WebTranslateIt
|
|
83
83
|
files = configuration.files.find_all{ |file| file.locale == locale }.sort{|a,b| a.file_path <=> b.file_path}
|
84
84
|
end
|
85
85
|
if files.size == 0
|
86
|
-
puts "
|
86
|
+
puts "Couldn't find any local files registered on WebTranslateIt to push."
|
87
87
|
else
|
88
88
|
files.each do |file|
|
89
89
|
success = file.upload(http, command_options[:merge], command_options.ignore_missing, command_options.label, command_options.low_priority, command_options[:minor], command_options.force)
|
@@ -158,7 +158,7 @@ module WebTranslateIt
|
|
158
158
|
parameters.each do |param|
|
159
159
|
print StringUtil.success("Adding locale #{param.upcase}... ")
|
160
160
|
WebTranslateIt::Connection.new(configuration.api_key) do
|
161
|
-
|
161
|
+
WebTranslateIt::Project.create_locale(param)
|
162
162
|
end
|
163
163
|
puts "Done."
|
164
164
|
end
|
@@ -175,7 +175,7 @@ module WebTranslateIt
|
|
175
175
|
if Util.ask_yes_no("Are you certain you want to delete the locale #{param.upcase}?\nThis will also delete its files and translations.", false)
|
176
176
|
print StringUtil.success("Deleting locale #{param.upcase}... ")
|
177
177
|
WebTranslateIt::Connection.new(configuration.api_key) do |http|
|
178
|
-
|
178
|
+
WebTranslateIt::Project.delete_locale(param)
|
179
179
|
end
|
180
180
|
puts "Done."
|
181
181
|
end
|
@@ -41,7 +41,7 @@ module WebTranslateIt
|
|
41
41
|
request = Net::HTTP::Get.new("/api/projects/#{api_key}/stats.yaml")
|
42
42
|
request.add_field("X-Client-Name", "web_translate_it")
|
43
43
|
request.add_field("X-Client-Version", WebTranslateIt::Util.version)
|
44
|
-
|
44
|
+
Util.handle_response(http.request(request), true)
|
45
45
|
end
|
46
46
|
rescue Timeout::Error
|
47
47
|
puts "Request timeout. Will retry in 5 seconds."
|
@@ -22,13 +22,13 @@ module WebTranslateIt
|
|
22
22
|
if raise_exception
|
23
23
|
raise "Error: #{MultiJson.load(response.body)['error']}"
|
24
24
|
else
|
25
|
-
StringUtil.failure(MultiJson.load(response.body)['error'])
|
25
|
+
puts StringUtil.failure(MultiJson.load(response.body)['error'])
|
26
26
|
end
|
27
27
|
elsif response.code.to_i == 500
|
28
28
|
if raise_exception
|
29
29
|
raise "Error: Server temporarily unavailable (Error 500)."
|
30
30
|
else
|
31
|
-
StringUtil.failure("Error: Server temporarily unavailable (Error 500).")
|
31
|
+
puts StringUtil.failure("Error: Server temporarily unavailable (Error 500).")
|
32
32
|
end
|
33
33
|
else
|
34
34
|
return response.body if return_response
|
data/readme.md
CHANGED
@@ -59,15 +59,16 @@ The reason is that the wti file is named in another way: `/usr/bin/wti.ruby2.1`
|
|
59
59
|
Now that the tool is installed, you’ll have to configure your project. Basically, `wti` is to be run on a project root directory, and looks for a `.wti` file containing your project information. The command `wti init` lets your create your `.wti` file.
|
60
60
|
|
61
61
|
``` bash
|
62
|
-
$ wti init
|
62
|
+
$ wti init proj_pvt_V8skdjsdDDA4
|
63
63
|
# Initializing project
|
64
64
|
|
65
|
-
|
65
|
+
The project Frontend was successfully initialized.
|
66
|
+
|
66
67
|
You can now use `wti` to push and pull your language files.
|
67
68
|
Check `wti --help` for help.
|
68
69
|
```
|
69
70
|
|
70
|
-
`
|
71
|
+
`proj_pvt_V8skdjsdDDA4` is the API token, which you can find in your project settings.
|
71
72
|
|
72
73
|
If you’d like to specify another path for your configuration file, you can use `wti init`. This command will ask you to enter your project API token and where to save the configuration file (by default it will create a `.wti` in your project root directory).
|
73
74
|
|
@@ -100,15 +101,21 @@ Execute `wti --help` to see the usage:
|
|
100
101
|
Append `--help` for each command for more information. For instance:
|
101
102
|
|
102
103
|
$ wti push --help
|
103
|
-
Push master language file(s)
|
104
|
+
wti push [filename] - Push master language file(s)
|
104
105
|
[options] are:
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
106
|
+
-l, --locale=<s> ISO code of locale(s) to push
|
107
|
+
-t, --target Upload all target files
|
108
|
+
-f, --force Force push (bypass conditional requests to WTI)
|
109
|
+
-o, --low-priority WTI will process this file with a low priority
|
110
|
+
-m, --merge Force WTI to merge this file
|
111
|
+
-i, --ignore-missing Force WTI to not obsolete missing strings
|
112
|
+
-n, --minor Minor Changes. When pushing a master file, prevents
|
113
|
+
target translations to be flagged as `to_verify`.
|
114
|
+
-a, --label=<s> Apply a label to the changes
|
115
|
+
-c, --config=<s> Path to a configuration file (default: .wti)
|
116
|
+
--all DEPRECATED -- See `wti push --target` instead
|
117
|
+
-d, --debug Display debug information
|
118
|
+
-h, --help Show this message
|
112
119
|
|
113
120
|
## Sample Commands
|
114
121
|
|
@@ -149,6 +156,10 @@ Append `--help` for each command for more information. For instance:
|
|
149
156
|
<td>wti push --all</td>
|
150
157
|
<td>Update all language files at once</td>
|
151
158
|
</tr>
|
159
|
+
<tr>
|
160
|
+
<td>wti push path/to/file.yml</td>
|
161
|
+
<td>Pushes the path/to/file.yml file</td>
|
162
|
+
</tr>
|
152
163
|
<tr>
|
153
164
|
<td>wti pull</td>
|
154
165
|
<td>Download target language files</td>
|
@@ -165,6 +176,10 @@ Append `--help` for each command for more information. For instance:
|
|
165
176
|
<td>wti pull path/to/files/*</td>
|
166
177
|
<td>Download all files in path/to/files</td>
|
167
178
|
</tr>
|
179
|
+
<tr>
|
180
|
+
<td>wti pull path/to/files/* -l fr</td>
|
181
|
+
<td>Download all fr files in path/to/files</td>
|
182
|
+
</tr>
|
168
183
|
<tr>
|
169
184
|
<td>wti pull --force</td>
|
170
185
|
<td>Force pull (to bypass WebTranslateIt’s HTTP caching)</td>
|
@@ -261,4 +276,4 @@ fr: 100% translated, 100% completed.
|
|
261
276
|
|
262
277
|
# License
|
263
278
|
|
264
|
-
Copyright (c) 2009-
|
279
|
+
Copyright (c) 2009-2017 Atelier Convivialité, released under the MIT License.
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: web_translate_it
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.4.
|
4
|
+
version: 2.4.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Edouard Briere
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-11-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: multipart-post
|
@@ -143,7 +143,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
143
143
|
version: '0'
|
144
144
|
requirements: []
|
145
145
|
rubyforge_project:
|
146
|
-
rubygems_version: 2.6.
|
146
|
+
rubygems_version: 2.6.13
|
147
147
|
signing_key:
|
148
148
|
specification_version: 4
|
149
149
|
summary: A CLI to sync locale files with WebTranslateIt.com.
|