language-translator 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
data/Manifest CHANGED
@@ -5,4 +5,4 @@ Rakefile
5
5
  language-translator.gemspec
6
6
  lib/translator.rb
7
7
  test/test_helper.rb
8
- test/translator_test.rb
8
+ test/translator_test.rb
data/README.rdoc CHANGED
@@ -1,7 +1,7 @@
1
1
  = Translator
2
2
 
3
3
  == Description
4
- A gem to translate from one language to another using google api(Unofficial).
4
+ Ruby gem to translate a string from one language to another using google api.
5
5
 
6
6
  == Installation
7
7
 
@@ -14,7 +14,7 @@ gem install language-translator
14
14
 
15
15
  #To translate 'Hello World' to Hindi
16
16
  tr = Translator.new()
17
- tr.translate( 'Hello, World', 'hi') #=> "नमस्ते, दुनिया"
17
+ tr.translate( 'Hello, World', 'hi') #=> "नमस्ते, दुनिया"
18
18
 
19
19
  #To translate "नमस्ते, दुनिया" to English
20
20
  tr.translate('नमस्ते, दुनिया', 'en','hi') #=> "Hello World"
data/Rakefile CHANGED
@@ -3,7 +3,7 @@ require 'rake'
3
3
  require 'echoe'
4
4
 
5
5
  Echoe.new('language-translator', '0.1.2') do |p|
6
- p.description = "A gem to translate from one language to another using google api(Unofficial)."
6
+ p.description = "Ruby gem to translate a string from one language to another using google api."
7
7
  p.url = "http://github.com/anilyanduri/language-translator"
8
8
  p.author = "Anil Yanduri"
9
9
  p.email = "anilkumaryln@gmail.com"
@@ -2,12 +2,12 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{language-translator}
5
- s.version = "0.1.3"
5
+ s.version = "0.1.4"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Anil Yanduri"]
9
9
  s.date = %q{2011-05-05}
10
- s.description = %q{Ruby gem to translate from one language to another using google api.}
10
+ s.description = %q{Ruby gem to translate from one language to another using google api. }
11
11
  s.email = %q{anilkumaryln@gmail.com}
12
12
  s.extra_rdoc_files = ["README.rdoc", "lib/translator.rb"]
13
13
  s.files = ["MIT-LICENSE", "Manifest", "README.rdoc", "Rakefile", "language-translator.gemspec", "lib/translator.rb", "test/test_helper.rb", "test/translator_test.rb"]
data/lib/translator.rb CHANGED
@@ -18,7 +18,7 @@ class Translator
18
18
 
19
19
  begin
20
20
  raise UnSupportedLanguage unless SUPPORTED_LANG_CODES.include?(to)
21
- raise UnSupportedLanguage unless SUPPORTED_LANG_CODES.include?(from) unless from.empty?
21
+ raise UnSupportedLanguage unless SUPPORTED_LANG_CODES.include?(from) unless from.empty? # letting to translate from unknown language
22
22
 
23
23
  http = Net::HTTP.new(Site_Url, 80)
24
24
 
@@ -44,6 +44,7 @@ class Translator
44
44
 
45
45
  end
46
46
 
47
+ # added in 0.1.2 to support from unknown to english
47
48
  def to_en(text)
48
49
  translate( text, "en", "" )
49
50
  end
data/test/test_helper.rb CHANGED
@@ -3,4 +3,3 @@ $:.unshift File.dirname(__FILE__) + '/../lib'
3
3
  require 'rubygems'
4
4
  require 'translator'
5
5
  require 'mocha'
6
-
@@ -17,7 +17,7 @@ class TranslatorTest < Test::Unit::TestCase
17
17
 
18
18
  def test_translate_from_other_to_english
19
19
  tr = Translator.new()
20
- assert_equal("Hello World", tr.translate("नमस्ते दुनिया", "en","hi"))
20
+ assert_equal("Hello World", tr.translate("नमस्ते दुनिया", "en","hi") )
21
21
  assert_equal("Hello world", tr.translate("世界您好", "en", "zh-CN"))
22
22
  assert_equal("Hello world", tr.translate("Dia duit domhan", "en", "ga"))
23
23
  assert_equal("Hello world", tr.translate("こんにちは、世界", "en", "ja"))
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: language-translator
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 19
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 3
10
- version: 0.1.3
9
+ - 4
10
+ version: 0.1.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Anil Yanduri
@@ -19,7 +19,7 @@ date: 2011-05-05 00:00:00 +05:30
19
19
  default_executable:
20
20
  dependencies: []
21
21
 
22
- description: Ruby gem to translate from one language to another using google api.
22
+ description: "Ruby gem to translate from one language to another using google api. "
23
23
  email: anilkumaryln@gmail.com
24
24
  executables: []
25
25