web_translate_it 2.4.11 → 2.5.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +2 -5
- data/bin/wti +3 -3
- data/history.md +34 -0
- data/lib/web_translate_it/command_line.rb +1 -1
- data/lib/web_translate_it/configuration.rb +7 -3
- data/lib/web_translate_it/translation_file.rb +8 -3
- data/lib/web_translate_it/util/array_util.rb +5 -1
- data/readme.md +9 -9
- data/spec/spec_helper.rb +5 -0
- data/spec/web_translate_it/string_spec.rb +36 -41
- data/spec/web_translate_it/term_spec.rb +20 -20
- metadata +20 -7
checksums.yaml
CHANGED
@@ -1,7 +1,4 @@
|
|
1
1
|
---
|
2
|
-
SHA256:
|
3
|
-
metadata.gz: 66a5c317674bbe2ed5e34456a69f2a4a927d7574d12e6131709c947acb8fa3bb
|
4
|
-
data.tar.gz: 262ca5d895379b6f43a3541917b81f8844d9d3d5d72db86f63fc0388757d703a
|
5
2
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7ede92a93df822b3dd6044a0cfda87771b5d3079920fd46499ed33f88d547aa86b35ce46fef709b05e2c8561d9b37f17dd1e6f620ab8f52b24cf74482f756215
|
4
|
+
data.tar.gz: 9502c4c524303391e3ebc0633c76a9e1f21f011ae82f442bea078b2af5294aa15b0bd2b16491dae0a47a3bcd10c3111d32ed2d8e1648f0eda4d197202364a1c5
|
data/bin/wti
CHANGED
@@ -40,7 +40,7 @@ command_options = case command
|
|
40
40
|
wti pull [filename] - Pull target language file(s)
|
41
41
|
[options] are:
|
42
42
|
EOS
|
43
|
-
opt :locale, "ISO code of locale(s) to pull", type: :string
|
43
|
+
opt :locale, "ISO code of locale(s) to pull, space-separated", type: :string
|
44
44
|
opt :all, "Pull all files"
|
45
45
|
opt :force, "Force pull (bypass conditional requests to WTI)"
|
46
46
|
opt :config, "Path to a configuration file", short: "-c", default: ".wti"
|
@@ -52,7 +52,7 @@ EOS
|
|
52
52
|
wti push [filename] - Push master language file(s)
|
53
53
|
[options] are:
|
54
54
|
EOS
|
55
|
-
opt :locale, "ISO code of locale(s) to push", type: :string
|
55
|
+
opt :locale, "ISO code of locale(s) to push, space-separated", type: :string
|
56
56
|
opt :target, "Upload all target files"
|
57
57
|
opt :force, "Force push (bypass conditional requests to WTI)"
|
58
58
|
opt :low_priority, "WTI will process this file with a low priority"
|
@@ -97,7 +97,7 @@ EOS
|
|
97
97
|
end
|
98
98
|
when "status"
|
99
99
|
Optimist::options do
|
100
|
-
banner "wti status - Fetch and display project statistics"
|
100
|
+
banner "wti status - Fetch and display project statistics.\nReturns 100 if untranslated segments exist in project\nReturns 101 if unproofread segments exist in project."
|
101
101
|
opt :config, "Path to a configuration file", short: "-c", default: ".wti"
|
102
102
|
opt :debug, "Display debug information"
|
103
103
|
end
|
data/history.md
CHANGED
@@ -1,3 +1,37 @@
|
|
1
|
+
## Version 2.5.2 / 2022-02-02
|
2
|
+
|
3
|
+
* Fix compatibility issues with rubies < 2.6.
|
4
|
+
|
5
|
+
## Version 2.5.1 / 2021-11-15
|
6
|
+
|
7
|
+
* Ruby 3.1.0 compatible.
|
8
|
+
|
9
|
+
## Version 2.5.0 / 2021-11-15
|
10
|
+
|
11
|
+
* Display files that are being updated on WebTranslateIt but are not ready to be downloaded by a `*`.
|
12
|
+
|
13
|
+
``` bash
|
14
|
+
~/Desktop/test% wti pull
|
15
|
+
# Pulling files on test 3
|
16
|
+
*cs-CZ.de.yml | 65a7fc8..65a7fc8 Skipped
|
17
|
+
en.yml | ffd8096..ffd8096 Skipped
|
18
|
+
i18nextv4.de.json | 142aca7..142aca7 Skipped
|
19
|
+
*cs-CZ.yml | 42c32a3..42c32a3 Skipped
|
20
|
+
de.yml | 9dda491..9dda491 Skipped
|
21
|
+
test.de.json | 48a9c13..48a9c13 Skipped
|
22
|
+
test.de.txt | 8f305f3..8f305f3 Skipped
|
23
|
+
test.json | 7a9478f..7a9478f Skipped
|
24
|
+
i18nextv4.json | 84d6cdf..8776cb3 OK
|
25
|
+
test.txt | 8f305f3..7a1a5db OK
|
26
|
+
```
|
27
|
+
* Improve help on `wti status` documentation.
|
28
|
+
|
29
|
+
## Version 2.4.12 / 2021-06-30
|
30
|
+
|
31
|
+
* Add ability to pass project API token as an ENV variable. You can run:
|
32
|
+
`export WTI_PROJECT_API_KEY=[my_api_token]`
|
33
|
+
`wti pull`
|
34
|
+
|
1
35
|
## Version 2.4.11 / 2019-10-22
|
2
36
|
|
3
37
|
* Fix for `wti pull` without parameters.
|
@@ -113,7 +113,7 @@ module WebTranslateIt
|
|
113
113
|
to_add = parameters.reject{ |param| added.include?(File.expand_path(param))}
|
114
114
|
if to_add.any?
|
115
115
|
to_add.each do |param|
|
116
|
-
file = TranslationFile.new(nil, param, nil, configuration.api_key)
|
116
|
+
file = TranslationFile.new(nil, param.gsub(/ /, "\\ "), nil, configuration.api_key)
|
117
117
|
success = file.create(http, command_options.low_priority)
|
118
118
|
complete_success = false if !success
|
119
119
|
end
|
@@ -20,12 +20,16 @@ module WebTranslateIt
|
|
20
20
|
self.path = root_path
|
21
21
|
self.logger = logger
|
22
22
|
if File.exists?(File.expand_path(path_to_config_file, self.path))
|
23
|
-
self.api_key = configuration['api_key']
|
23
|
+
self.api_key = ENV["WTI_PROJECT_API_KEY"] || configuration['api_key']
|
24
24
|
self.before_pull = configuration['before_pull']
|
25
25
|
self.after_pull = configuration['after_pull']
|
26
26
|
self.before_push = configuration['before_push']
|
27
27
|
self.after_push = configuration['after_push']
|
28
|
-
project_info
|
28
|
+
project_info = if RUBY_VERSION >= 3.1
|
29
|
+
YAML.safe_load WebTranslateIt::Project.fetch_info(api_key), permitted_classes: [Time]
|
30
|
+
else
|
31
|
+
YAML.load WebTranslateIt::Project.fetch_info(api_key)
|
32
|
+
end
|
29
33
|
set_locales_to_ignore(configuration)
|
30
34
|
set_locales_needed(configuration)
|
31
35
|
set_files(project_info['project'])
|
@@ -71,7 +75,7 @@ module WebTranslateIt
|
|
71
75
|
if project_file['name'].nil? or project_file['name'].strip == ''
|
72
76
|
puts "File #{project_file['id']} not set up"
|
73
77
|
else
|
74
|
-
self.files.push TranslationFile.new(project_file['id'], project_file['name'], project_file['locale_code'], self.api_key, project_file['updated_at'], project_file['hash_file'], project_file['master_project_file_id'])
|
78
|
+
self.files.push TranslationFile.new(project_file['id'], project_file['name'], project_file['locale_code'], self.api_key, project_file['updated_at'], project_file['hash_file'], project_file['master_project_file_id'], project_file['fresh'])
|
75
79
|
end
|
76
80
|
end
|
77
81
|
end
|
@@ -12,9 +12,9 @@ module WebTranslateIt
|
|
12
12
|
require 'time'
|
13
13
|
require 'fileutils'
|
14
14
|
|
15
|
-
attr_accessor :id, :file_path, :locale, :api_key, :updated_at, :remote_checksum, :master_id
|
15
|
+
attr_accessor :id, :file_path, :locale, :api_key, :updated_at, :remote_checksum, :master_id, :fresh
|
16
16
|
|
17
|
-
def initialize(id, file_path, locale, api_key, updated_at = nil, remote_checksum = "", master_id = nil)
|
17
|
+
def initialize(id, file_path, locale, api_key, updated_at = nil, remote_checksum = "", master_id = nil, fresh = nil)
|
18
18
|
self.id = id
|
19
19
|
self.file_path = file_path
|
20
20
|
self.locale = locale
|
@@ -22,6 +22,7 @@ module WebTranslateIt
|
|
22
22
|
self.updated_at = updated_at
|
23
23
|
self.remote_checksum = remote_checksum
|
24
24
|
self.master_id = master_id
|
25
|
+
self.fresh = fresh
|
25
26
|
end
|
26
27
|
|
27
28
|
# Fetch a language file.
|
@@ -40,7 +41,11 @@ module WebTranslateIt
|
|
40
41
|
success = true
|
41
42
|
tries ||= 3
|
42
43
|
display = []
|
43
|
-
|
44
|
+
if self.fresh
|
45
|
+
display.push(self.file_path)
|
46
|
+
else
|
47
|
+
display.push("*#{self.file_path}")
|
48
|
+
end
|
44
49
|
display.push "#{StringUtil.checksumify(self.local_checksum.to_s)}..#{StringUtil.checksumify(self.remote_checksum.to_s)}"
|
45
50
|
if !File.exist?(self.file_path) or force or self.remote_checksum != self.local_checksum
|
46
51
|
begin
|
@@ -1,6 +1,10 @@
|
|
1
1
|
class ArrayUtil
|
2
2
|
def self.to_columns(arr)
|
3
|
-
|
3
|
+
if arr[0][0] == "*"
|
4
|
+
"*#{StringUtil.backward_truncate(arr[0][1..-1])} | #{arr[1]} #{arr[2]}\n"
|
5
|
+
else
|
6
|
+
" #{StringUtil.backward_truncate(arr[0])} | #{arr[1]} #{arr[2]}\n"
|
7
|
+
end
|
4
8
|
end
|
5
9
|
|
6
10
|
def self.chunk(arr, pieces=2)
|
data/readme.md
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
# WebTranslateIt Synchronization Tool : wti
|
2
2
|
|
3
|
-
[RubyDoc](
|
4
|
-
[Report a bug](
|
5
|
-
[Support](https://webtranslateit.com/support) |
|
6
|
-
[WebTranslateIt.com Homepage](https://webtranslateit.com)
|
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)
|
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
|
|
@@ -17,14 +17,14 @@ wti lets you easily sync your language files with [WebTranslateIt.com](https://w
|
|
17
17
|
### Optionally, wti does...
|
18
18
|
|
19
19
|
* include a rack middleware you can use in your Rails app to automatically fetch new translations from WebTranslateIt.com.
|
20
|
-
* include libraries you can use to programmatically fetch your segments from WebTranslateIt.com. See [Extras](https://github.com/
|
21
|
-
* include a web interface for your translation team to update your language files. [Learn more on the web_translate_it_server project page](https://github.com/
|
20
|
+
* include libraries you can use to programmatically fetch your segments from WebTranslateIt.com. See [Extras](https://github.com/webtranslateit/webtranslateit/wiki/Extras)
|
21
|
+
* include a web interface for your translation team to update your language files. [Learn more on the web_translate_it_server project page](https://github.com/webtranslateit/web_translate_it_server).
|
22
22
|
|
23
23
|
---
|
24
24
|
|
25
25
|
## Installation
|
26
26
|
|
27
|
-
You will also need ruby to run `wti`. On Linux or a Mac, it’s already installed. Install [RubyInstaller](http://rubyinstaller.org/) if you’re using Windows. [See detailed installation instructions for Windows users](https://github.com/
|
27
|
+
You will also need ruby to run `wti`. On Linux or a Mac, it’s already installed. Install [RubyInstaller](http://rubyinstaller.org/) if you’re using Windows. [See detailed installation instructions for Windows users](https://github.com/webtranslateit/webtranslateit/wiki/Install-wti-on-Windows).
|
28
28
|
|
29
29
|
``` bash
|
30
30
|
$ gem install web_translate_it
|
@@ -213,7 +213,7 @@ There are 4 hooks:
|
|
213
213
|
* `before_push`
|
214
214
|
* `after_push`
|
215
215
|
|
216
|
-
Check the [sample `.wti`](https://github.com/
|
216
|
+
Check the [sample `.wti`](https://github.com/webtranslateit/webtranslateit/blob/master/examples/.wti#L9..L13) file for implementation.
|
217
217
|
|
218
218
|
## Exit codes
|
219
219
|
|
@@ -276,4 +276,4 @@ fr: 100% translated, 100% completed.
|
|
276
276
|
|
277
277
|
# License
|
278
278
|
|
279
|
-
Copyright (c) 2009-
|
279
|
+
Copyright (c) 2009-2022 [WebTranslateIt Software S.L](https://webtranslateit.com), released under the MIT License.
|
data/spec/spec_helper.rb
CHANGED
@@ -1,23 +1,23 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe WebTranslateIt::String do
|
4
|
-
|
5
|
-
let(:api_key) { "
|
6
|
-
|
4
|
+
|
5
|
+
let(:api_key) { "proj_pvt_glzDR250FLXlMgJPZfEyHQ" }
|
6
|
+
|
7
7
|
describe "#initialize" do
|
8
8
|
it "should assign api_key and many parameters" do
|
9
9
|
string = WebTranslateIt::String.new({ "id" => 1234, "key" => "bacon"})
|
10
10
|
string.id.should == 1234
|
11
11
|
string.key.should == "bacon"
|
12
12
|
end
|
13
|
-
|
13
|
+
|
14
14
|
it "should assign parameters using symbols" do
|
15
15
|
string = WebTranslateIt::String.new({ :id => 1234, :key => "bacon"})
|
16
16
|
string.id.should == 1234
|
17
17
|
string.key.should == "bacon"
|
18
18
|
end
|
19
19
|
end
|
20
|
-
|
20
|
+
|
21
21
|
describe "#save" do
|
22
22
|
it "should create a new String" do
|
23
23
|
WebTranslateIt::Connection.new(api_key) do
|
@@ -31,7 +31,7 @@ describe WebTranslateIt::String do
|
|
31
31
|
string.delete
|
32
32
|
end
|
33
33
|
end
|
34
|
-
|
34
|
+
|
35
35
|
it "should update an existing String" do
|
36
36
|
WebTranslateIt::Connection.new(api_key) do
|
37
37
|
string = WebTranslateIt::String.new({ "key" => "bacony" })
|
@@ -43,11 +43,11 @@ describe WebTranslateIt::String do
|
|
43
43
|
string.delete
|
44
44
|
end
|
45
45
|
end
|
46
|
-
|
46
|
+
|
47
47
|
it "should create a new String with Translation" do
|
48
48
|
translation1 = WebTranslateIt::Translation.new({ "locale" => "en", "text" => "Hello" })
|
49
49
|
translation2 = WebTranslateIt::Translation.new({ "locale" => "fr", "text" => "Bonjour" })
|
50
|
-
|
50
|
+
|
51
51
|
string = WebTranslateIt::String.new({ "key" => "bacon", "translations" => [translation1, translation2] })
|
52
52
|
WebTranslateIt::Connection.new(api_key) do
|
53
53
|
string.save
|
@@ -60,20 +60,20 @@ describe WebTranslateIt::String do
|
|
60
60
|
string.delete
|
61
61
|
end
|
62
62
|
end
|
63
|
-
|
63
|
+
|
64
64
|
it "should update a String and save its Translation" do
|
65
65
|
translation1 = WebTranslateIt::Translation.new({ "locale" => "en", "text" => "Hello" })
|
66
66
|
translation2 = WebTranslateIt::Translation.new({ "locale" => "fr", "text" => "Bonjour" })
|
67
|
-
|
67
|
+
|
68
68
|
string = WebTranslateIt::String.new({ "key" => "bacon" })
|
69
69
|
WebTranslateIt::Connection.new(api_key) do
|
70
70
|
string.save
|
71
71
|
string_fetched = WebTranslateIt::String.find(string.id)
|
72
72
|
string_fetched.translation_for("fr").should be_nil
|
73
|
-
|
73
|
+
|
74
74
|
string_fetched.translations = [translation1, translation2]
|
75
75
|
string_fetched.save
|
76
|
-
|
76
|
+
|
77
77
|
string_fetched = WebTranslateIt::String.find(string.id)
|
78
78
|
string_fetched.translation_for("en").should_not be_nil
|
79
79
|
string_fetched.translation_for("en").text.should == "Hello"
|
@@ -83,7 +83,7 @@ describe WebTranslateIt::String do
|
|
83
83
|
end
|
84
84
|
end
|
85
85
|
end
|
86
|
-
|
86
|
+
|
87
87
|
describe "#delete" do
|
88
88
|
it "should delete a String" do
|
89
89
|
string = WebTranslateIt::String.new({ "key" => "bacon" })
|
@@ -91,53 +91,48 @@ describe WebTranslateIt::String do
|
|
91
91
|
string.save
|
92
92
|
string_fetched = WebTranslateIt::String.find(string.id)
|
93
93
|
string_fetched.should_not be_nil
|
94
|
-
|
94
|
+
|
95
95
|
string_fetched.delete
|
96
96
|
WebTranslateIt::String.find(string.id).should be_nil
|
97
97
|
end
|
98
98
|
end
|
99
99
|
end
|
100
|
-
|
100
|
+
|
101
101
|
describe "#find_all" do
|
102
102
|
it "should find many strings" do
|
103
103
|
WebTranslateIt::Connection.new(api_key) do
|
104
|
-
string1 = WebTranslateIt::String.new({ "key" => "
|
104
|
+
string1 = WebTranslateIt::String.new({ "key" => "one two three" })
|
105
105
|
string1.save
|
106
|
-
string2 = WebTranslateIt::String.new({ "key" => "
|
106
|
+
string2 = WebTranslateIt::String.new({ "key" => "four five six" })
|
107
107
|
string2.save
|
108
|
-
string3 = WebTranslateIt::String.new({ "key" => "
|
108
|
+
string3 = WebTranslateIt::String.new({ "key" => "six seven eight" })
|
109
109
|
string3.save
|
110
|
-
|
111
|
-
strings = WebTranslateIt::String.find_all({ "key" => "
|
112
|
-
strings.count.should == 2
|
113
|
-
strings[0].key.should == "bacon"
|
114
|
-
strings[1].key.should == "bacon tart"
|
115
|
-
|
116
|
-
strings = WebTranslateIt::String.find_all({ :key => "bacon" })
|
110
|
+
|
111
|
+
strings = WebTranslateIt::String.find_all({ "key" => "six" })
|
117
112
|
strings.count.should == 2
|
118
|
-
strings[0].key.should == "
|
119
|
-
strings[1].key.should == "
|
113
|
+
strings[0].key.should == "four five six"
|
114
|
+
strings[1].key.should == "six seven eight"
|
120
115
|
|
121
|
-
strings = WebTranslateIt::String.find_all({
|
116
|
+
strings = WebTranslateIt::String.find_all({ :key => "six" })
|
122
117
|
strings.count.should == 2
|
123
|
-
strings[0].key.should == "
|
124
|
-
strings[1].key.should == "
|
125
|
-
|
126
|
-
strings = WebTranslateIt::String.find_all({ "key" => "
|
118
|
+
strings[0].key.should == "four five six"
|
119
|
+
strings[1].key.should == "six seven eight"
|
120
|
+
|
121
|
+
strings = WebTranslateIt::String.find_all({ "key" => "eight" })
|
122
|
+
strings.count.should == 1
|
123
|
+
strings[0].key.should == "six seven eight"
|
124
|
+
|
125
|
+
strings = WebTranslateIt::String.find_all({ "key" => "three" })
|
127
126
|
strings.count.should == 1
|
128
|
-
strings[0].key.should == "
|
129
|
-
|
130
|
-
string1.delete
|
131
|
-
string2.delete
|
132
|
-
string3.delete
|
127
|
+
strings[0].key.should == "one two three"
|
133
128
|
end
|
134
129
|
end
|
135
130
|
end
|
136
|
-
|
131
|
+
|
137
132
|
describe "#translation_for" do
|
138
133
|
it "should fetch translations" do
|
139
134
|
translation = WebTranslateIt::Translation.new({ "locale" => "en", "text" => "Hello" })
|
140
|
-
string = WebTranslateIt::String.new({ "key" => "
|
135
|
+
string = WebTranslateIt::String.new({ "key" => "greetings", "translations" => [translation] })
|
141
136
|
WebTranslateIt::Connection.new(api_key) do
|
142
137
|
string.save
|
143
138
|
string_fetched = WebTranslateIt::String.find(string.id)
|
@@ -147,9 +142,9 @@ describe WebTranslateIt::String do
|
|
147
142
|
string.delete
|
148
143
|
end
|
149
144
|
end
|
150
|
-
|
145
|
+
|
151
146
|
it "should not return a stale object" do
|
152
|
-
string = WebTranslateIt::String.new({ :key => "
|
147
|
+
string = WebTranslateIt::String.new({ :key => "greetings 2" })
|
153
148
|
translation = WebTranslateIt::Translation.new({ :locale => "es", :text => "text", :string_id => string.id })
|
154
149
|
string.translations << translation
|
155
150
|
string.translation_for('fr').should be_nil
|
@@ -1,9 +1,9 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe WebTranslateIt::Term do
|
4
|
-
|
5
|
-
let(:api_key) { "
|
6
|
-
|
4
|
+
|
5
|
+
let(:api_key) { "proj_pvt_glzDR250FLXlMgJPZfEyHQ" }
|
6
|
+
|
7
7
|
describe "#initialize" do
|
8
8
|
it "should assign api_key and many parameters" do
|
9
9
|
term = WebTranslateIt::Term.new({ "id" => 1234, "text" => "bacon"})
|
@@ -17,7 +17,7 @@ describe WebTranslateIt::Term do
|
|
17
17
|
term.text.should == "bacon"
|
18
18
|
end
|
19
19
|
end
|
20
|
-
|
20
|
+
|
21
21
|
describe "#save" do
|
22
22
|
it "should create a new Term" do
|
23
23
|
WebTranslateIt::Connection.new(api_key) do
|
@@ -31,10 +31,10 @@ describe WebTranslateIt::Term do
|
|
31
31
|
term.delete
|
32
32
|
end
|
33
33
|
end
|
34
|
-
|
34
|
+
|
35
35
|
it "should update an existing Term" do
|
36
36
|
WebTranslateIt::Connection.new(api_key) do
|
37
|
-
term = WebTranslateIt::Term.new({ "text" => "Term", "description" => "A description" })
|
37
|
+
term = WebTranslateIt::Term.new({ "text" => "Term 2", "description" => "A description" })
|
38
38
|
term.save
|
39
39
|
term.text = "A Term"
|
40
40
|
term.save
|
@@ -43,11 +43,11 @@ describe WebTranslateIt::Term do
|
|
43
43
|
term.delete
|
44
44
|
end
|
45
45
|
end
|
46
|
-
|
46
|
+
|
47
47
|
it "should create a new Term with a TermTranslation" do
|
48
48
|
translation1 = WebTranslateIt::TermTranslation.new({ "locale" => "fr", "text" => "Bonjour" })
|
49
49
|
translation2 = WebTranslateIt::TermTranslation.new({ "locale" => "fr", "text" => "Salut" })
|
50
|
-
|
50
|
+
|
51
51
|
term = WebTranslateIt::Term.new({ "text" => "Hello", "translations" => [translation1, translation2] })
|
52
52
|
WebTranslateIt::Connection.new(api_key) do
|
53
53
|
term.save
|
@@ -59,20 +59,20 @@ describe WebTranslateIt::Term do
|
|
59
59
|
term.delete
|
60
60
|
end
|
61
61
|
end
|
62
|
-
|
62
|
+
|
63
63
|
it "should update a Term and save its Translation" do
|
64
64
|
translation1 = WebTranslateIt::TermTranslation.new({ "locale" => "fr", "text" => "Bonjour" })
|
65
65
|
translation2 = WebTranslateIt::TermTranslation.new({ "locale" => "fr", "text" => "Salut" })
|
66
|
-
|
66
|
+
|
67
67
|
term = WebTranslateIt::Term.new({ "text" => "Hi!" })
|
68
68
|
WebTranslateIt::Connection.new(api_key) do
|
69
69
|
term.save
|
70
70
|
term_fetched = WebTranslateIt::Term.find(term.id)
|
71
71
|
term_fetched.translation_for("fr").should be_nil
|
72
|
-
|
72
|
+
|
73
73
|
term_fetched.translations = [translation1, translation2]
|
74
74
|
term_fetched.save
|
75
|
-
|
75
|
+
|
76
76
|
term_fetched = WebTranslateIt::Term.find(term.id)
|
77
77
|
term_fetched.translation_for("fr").should_not be_nil
|
78
78
|
term_fetched.translation_for("fr")[0].text.should == "Bonjour"
|
@@ -81,7 +81,7 @@ describe WebTranslateIt::Term do
|
|
81
81
|
end
|
82
82
|
end
|
83
83
|
end
|
84
|
-
|
84
|
+
|
85
85
|
describe "#delete" do
|
86
86
|
it "should delete a Term" do
|
87
87
|
term = WebTranslateIt::Term.new({ "text" => "bacon" })
|
@@ -89,27 +89,27 @@ describe WebTranslateIt::Term do
|
|
89
89
|
term.save
|
90
90
|
term_fetched = WebTranslateIt::Term.find(term.id)
|
91
91
|
term_fetched.should_not be_nil
|
92
|
-
|
92
|
+
|
93
93
|
term_fetched.delete
|
94
94
|
term_fetched = WebTranslateIt::Term.find(term.id)
|
95
95
|
term_fetched.should be_nil
|
96
96
|
end
|
97
97
|
end
|
98
98
|
end
|
99
|
-
|
99
|
+
|
100
100
|
describe "#find_all" do
|
101
101
|
it "should fetch many terms" do
|
102
102
|
WebTranslateIt::Connection.new(api_key) do
|
103
|
-
term1 = WebTranslateIt::Term.new({ "text" => "
|
103
|
+
term1 = WebTranslateIt::Term.new({ "text" => "greeting 1" })
|
104
104
|
term1.save
|
105
|
-
term2 = WebTranslateIt::Term.new({ "text" => "
|
105
|
+
term2 = WebTranslateIt::Term.new({ "text" => "greeting 2" })
|
106
106
|
term2.save
|
107
|
-
term3 = WebTranslateIt::Term.new({ "text" => "
|
107
|
+
term3 = WebTranslateIt::Term.new({ "text" => "greeting 3" })
|
108
108
|
term3.save
|
109
|
-
|
109
|
+
|
110
110
|
terms = WebTranslateIt::Term.find_all
|
111
111
|
terms.count.should == 3
|
112
|
-
|
112
|
+
|
113
113
|
term1.delete
|
114
114
|
term2.delete
|
115
115
|
term3.delete
|
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
|
+
version: 2.5.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Edouard Briere
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-02-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: multipart-post
|
@@ -66,6 +66,20 @@ dependencies:
|
|
66
66
|
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: 2.6.0
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: simplecov
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
84
|
name: guard-rspec
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -124,7 +138,7 @@ homepage: https://webtranslateit.com
|
|
124
138
|
licenses:
|
125
139
|
- MIT
|
126
140
|
metadata: {}
|
127
|
-
post_install_message:
|
141
|
+
post_install_message:
|
128
142
|
rdoc_options:
|
129
143
|
- "--main"
|
130
144
|
- readme.md
|
@@ -141,9 +155,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
141
155
|
- !ruby/object:Gem::Version
|
142
156
|
version: '0'
|
143
157
|
requirements: []
|
144
|
-
|
145
|
-
|
146
|
-
signing_key:
|
158
|
+
rubygems_version: 3.0.9
|
159
|
+
signing_key:
|
147
160
|
specification_version: 4
|
148
161
|
summary: A CLI to sync locale files with WebTranslateIt.com.
|
149
162
|
test_files:
|