crutch-google_translate 0.0.3 → 0.0.4

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.
data/VERSION.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
- :minor: 0
2
+ :minor: 1
3
3
  :patch: 3
4
4
  :major: 0
@@ -15,6 +15,7 @@ module GoogleTranslate
15
15
  PATH ="/ajax/services/language/"
16
16
  VERSION = "1.0"
17
17
  #USERAGENT = 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.1) Gecko/20060111 Firefox/1.5.0.1'
18
+ GOOGLE_STRING_LIMIT = 5000
18
19
 
19
20
  end
20
21
 
@@ -23,9 +23,9 @@ module GoogleTranslate
23
23
  # then this option needs to have a true value (:html => true)
24
24
  def translate(text,options = {})
25
25
  PARAMS["langpair"] = "#{@from}%7C#{@to}"
26
- PARAMS["q"] = CGI.escape(text)
26
+ PARAMS["q"] = CGI.escape(text[0,GOOGLE_STRING_LIMIT])
27
27
  response = google_api_call(SERVICE, PARAMS, TranslationResponse)
28
- translation = options[:html] ? response.translation : CGI.unescapeHTML(response.translation)
28
+ translation = options[:html].nil? ? response.translation : CGI.unescapeHTML(response.translation)
29
29
  translation # return value
30
30
  end
31
31
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: crutch-google_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
  - Elise Huard
@@ -37,6 +37,7 @@ files:
37
37
  - spec/translate_spec.rb
38
38
  has_rdoc: true
39
39
  homepage: http://github.com/crutch/google_translate
40
+ licenses:
40
41
  post_install_message:
41
42
  rdoc_options:
42
43
  - --inline-source
@@ -58,7 +59,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
58
59
  requirements: []
59
60
 
60
61
  rubyforge_project:
61
- rubygems_version: 1.2.0
62
+ rubygems_version: 1.3.5
62
63
  signing_key:
63
64
  specification_version: 2
64
65
  summary: Google Translate Ruby API