painful_translate 0.0.3 → 0.0.4

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
  SHA1:
3
- metadata.gz: 401ed7fa2bff76cacb6e854aca3dc0d435272472
4
- data.tar.gz: 56f0c8a2d50e9d60f86501e311b712bd02388ecc
3
+ metadata.gz: 307185bf883610a70014e7e98485ed16734011fe
4
+ data.tar.gz: 7d968b974be68291a53805860a237f1ebe6836b5
5
5
  SHA512:
6
- metadata.gz: bba85c5d02dd541540849a1275240a6d039056287808eca54af493ac96f8acc028050b4e143deefdada9ff4b5eec097810e6154cc952ea5ba6649d786cd362b4
7
- data.tar.gz: 184b493ad8d6d9f3a1da2083f1e0ba03175dc3b8131c220fd2319289aedf8bc4cabaf4c87a5cee0a1bc5b48aca414e70b14d8fade5e59edadc3fffe4fddb69e7
6
+ metadata.gz: cb718f6c3b2d6d82f6d7a563e9500632596985b7bcca0b1381510ebe72683c2205b4bba1e8eedb7dd3d316a18b3b784fa88ea567a62761dcc2516507f9274028
7
+ data.tar.gz: 4892b4abf5c0344a83b854f8755d72bf75b47e40e4729bbd6d56e1438ecddac4a5c54046a61b74a6e7ab6374a0637fde3dcbc1eb7389b1c871ce13d28ec8b877
data/README.md CHANGED
@@ -47,6 +47,16 @@ Sorry, not built yet
47
47
 
48
48
  ---
49
49
 
50
+ ## Important Caveat
51
+
52
+ You can't translate strings with "\n" (newline) characters in it. This is because this translator uses newlines spread out batch translations to Google. So if you decide to try something like the following:
53
+
54
+ ```ruby
55
+ # Will behave unpredictably
56
+ PainfulTranslate.translate("Dear abbey,\n I am a big idiot", "please respond" :to => :es, :from => :en)
57
+ ```
58
+ Every translations after the one where you introduced offending line will be off by the one came before it... and, because I haven't gotten around to writing code that will throw an error, you may need to prepare your anus for some serious post-production pain when your entire site is out of context
59
+
50
60
  ## A note on capybara and selenium and how this thing works
51
61
 
52
62
  This gem will open up selenium via capybara which, for most of you, will mean it actually opens up firefox and visits https://translate.google.com . It then fills out the translation form, and fetches the translated answer from the webpage. In other words, this is exactly what you (as a lowly human) would do if you had to translate something with Google. Consequently, this process is slow and painful.
@@ -5,6 +5,6 @@ class PainfulTranslate::TranslationPage
5
5
  end
6
6
  def translation_output_strings
7
7
  sleep 2.seconds # give some time for Jewgle to look the page
8
- session.find(:xpath, '//*[@id="result_box"]').all(:css, 'span.hps').map(&:text)
8
+ session.find(:xpath, '//*[@id="result_box"]').native.text.split "\n"
9
9
  end
10
10
  end
@@ -1,3 +1,3 @@
1
1
  module PainfulTranslate
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: painful_translate
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thomas Chen