tr4n5l4te 0.1.13 → 0.1.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7f472799cb84dedb4b62e00f49fce1f95211308476b80fe39ef5ca3a8454b314
4
- data.tar.gz: a203ec65911493140c7330fc9f1dc1c2ed240cb164facf0a72fd6b3c457c3781
3
+ metadata.gz: 2708e83a48fe0953a4907f1bd440e3f5268e28b23cf34c1f3e3ee53a7cb66cd0
4
+ data.tar.gz: 43c32d754fb454c1e65b2349c71e5db4a2507c967de3feb8f0362e547a3a6bd8
5
5
  SHA512:
6
- metadata.gz: bc33154d77e153137ae5892ee419d844e564d8db9de8711b15c53abbff4b36ce75e68ec4ad4e1c96ade0decb22ec74420f0e8a4bc96f4924534298e5dec86dad
7
- data.tar.gz: a2e3ff5cc1fbba543ff310b8cc8db1a3fc3ec8afc7294bb6360ef00a57928e02a4a6ee94aec92a16f77f9754655fa80d355e42f8020ee4a5c243fa23bc0d5d78
6
+ metadata.gz: d3bf415df410267cddb4cb1cb9954bbb3bd1e93eff96813dad2b8137830137db8c40d107c7209d29a5fd9148388421a5571bb922251e82d59844f5cf74c5b94a
7
+ data.tar.gz: 5283f8a67579572b5c32f3ed63ae5b8a9c5b1282e1ca49d24fbc313610d52a7deba8d9919bb4494e291d592b22302a1ce050680fc8b1046acbd56acd5b5a5f91
data/CHANGELOG CHANGED
@@ -1,3 +1,9 @@
1
+ *0.1.14* (June 07, 2021)
2
+
3
+ * Add workaround for phantomjs SSL handshake problem, issue #24 - SSL handshake failed, by @gahia - see also: "https://github.com/ariya/phantomjs/issues/12440"
4
+ * Look for and report non-neutral gender translations. Now accepts the "male" translation by default and warns that there are alternatives, by @gahia.
5
+ * Don't fail if a translation is not found but instead show a warning message and continue, by @gahia.
6
+
1
7
  *0.1.13* (April 30, 2021)
2
8
 
3
9
  * Upgrade rexml from 3.2.4 to 3.2.5 to fix a CVE
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- tr4n5l4te (0.1.13)
4
+ tr4n5l4te (0.1.14)
5
5
  capybara (~> 2.6)
6
6
  colored (~> 1)
7
7
  midwire_common (~> 0.1)
@@ -30,7 +30,7 @@ GEM
30
30
  midwire_common (0.3.0)
31
31
  thor (~> 0.19)
32
32
  mini_mime (1.0.2)
33
- nokogiri (1.11.2-x86_64-linux)
33
+ nokogiri (1.11.5-x86_64-darwin)
34
34
  racc (~> 1.4)
35
35
  optimist (3.0.1)
36
36
  parallel (1.20.1)
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Tr4n5l4te
2
2
 
3
- **Version: 0.1.13**
3
+ **Version: 0.1.14**
4
4
 
5
5
  Use Google Translate without an API key.
6
6
 
@@ -10,7 +10,7 @@ module Tr4n5l4te
10
10
  app,
11
11
  js_errors: false,
12
12
  timeout: Tr4n5l4te.configuration.timeout,
13
- phantomjs_options: ['--load-images=no', '--ignore-ssl-errors=yes', '--web-security=false'],
13
+ phantomjs_options: ['--load-images=no', '--ignore-ssl-errors=yes', '--web-security=false', '--ssl-protocol=any'],
14
14
  phantomjs_logger: StringIO.new,
15
15
  logger: StringIO.new
16
16
  )
@@ -20,11 +20,22 @@ module Tr4n5l4te
20
20
  smart_visit(translator_url(encoded_text, from_lang, to_lang))
21
21
  result_box = browser.find('.JLqJ4b.ChMk0b > span:first-child')
22
22
  postprocess(result_box.text)
23
+
23
24
  rescue Capybara::Ambiguous
24
25
  all_translations = browser.find_all('.JLqJ4b.ChMk0b > span:first-child')
25
26
  multiples = all_translations.collect(&:text)
26
27
  puts("WARNING: '#{text}' has multiple translations: [#{multiples.join(', ')}]")
27
28
  text
29
+
30
+ rescue Capybara::ElementNotFound
31
+ all_translations = browser.find_all('.J0lOec > span:first-child')
32
+ multiples = all_translations.collect(&:text)
33
+ if multiples.any?
34
+ puts("WARNING: '#{text}' has gender translations: [#{multiples.join(', ')}]")
35
+ postprocess(multiples.last) # take the male form
36
+ else
37
+ puts("WARNING: Could not find a translation for '#{text}'")
38
+ end
28
39
  end
29
40
 
30
41
  private
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Tr4n5l4te
4
- VERSION = '0.1.13'.freeze
4
+ VERSION = '0.1.14'.freeze
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tr4n5l4te
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.13
4
+ version: 0.1.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Blackburn
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-05-01 00:00:00.000000000 Z
11
+ date: 2021-06-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -203,7 +203,7 @@ homepage: https://github.com/midwire/tr4n5l4te
203
203
  licenses:
204
204
  - MIT
205
205
  metadata: {}
206
- post_install_message:
206
+ post_install_message:
207
207
  rdoc_options: []
208
208
  require_paths:
209
209
  - lib
@@ -219,7 +219,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
219
219
  version: '0'
220
220
  requirements: []
221
221
  rubygems_version: 3.1.4
222
- signing_key:
222
+ signing_key:
223
223
  specification_version: 4
224
224
  summary: Use Google Translate without an API key.
225
225
  test_files: []