language-translator 0.1.2 → 0.1.3

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/README.rdoc CHANGED
@@ -9,15 +9,15 @@ gem install language-translator
9
9
 
10
10
  == Usage
11
11
 
12
- require 'rubygems'
13
- require 'translator'
14
-
15
- #To translate 'Hello World' to Hindi
16
- tr = Translator.new()
17
- tr.translate( 'Hello, World', 'hi')
18
- =>"नमस्ते, दुनिया"
19
-
12
+ require 'rubygems'
13
+ require 'translator'
14
+
15
+ #To translate 'Hello World' to Hindi
16
+ tr = Translator.new()
17
+ tr.translate( 'Hello, World', 'hi') #=> "नमस्ते, दुनिया"
18
+
20
19
  #To translate "नमस्ते, दुनिया" to English
21
- tr.translate('नमस्ते, दुनिया', 'en','hi')
22
- =>"Hello World"
20
+ tr.translate('नमस्ते, दुनिया', 'en','hi') #=> "Hello World"
23
21
 
22
+ #From Unknown language to english, from 0.1.2
23
+ tr.to_en('नमस्ते, दुनिया') #=> "Hello World"
@@ -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.2"
5
+ s.version = "0.1.3"
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{A 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"]
@@ -16,7 +16,7 @@ Gem::Specification.new do |s|
16
16
  s.require_paths = ["lib"]
17
17
  s.rubyforge_project = %q{language-translator}
18
18
  s.rubygems_version = %q{1.3.5}
19
- s.summary = %q{A gem to translate from one language to another using google api(Unofficial).}
19
+ s.summary = %q{Ruby gem to translate from one language to another using google api.}
20
20
  s.test_files = ["test/translator_test.rb", "test/test_helper.rb"]
21
21
 
22
22
  if s.respond_to? :specification_version then
@@ -27,7 +27,20 @@ class TranslatorTest < Test::Unit::TestCase
27
27
  assert_equal("Hello world", tr.translate("¡Hola, mundo", "en", "es"))
28
28
  assert_equal("Hello world", tr.translate("مرحبا العالم", "en", "ar"))
29
29
  end
30
-
30
+
31
+ def test_translate_from_other_to_english
32
+ tr = Translator.new()
33
+ assert_equal("Hello World", tr.to_en("नमस्ते दुनिया"))
34
+ assert_equal("Hello world", tr.to_en("世界您好"))
35
+ assert_equal("Hello world", tr.to_en("Dia duit domhan"))
36
+ assert_equal("Hello world", tr.to_en("こんにちは、世界"))
37
+ assert_equal("Hello world", tr.to_en("안녕하세요 세상"))
38
+ assert_equal("Hello world", tr.to_en("Olá mundo"))
39
+ assert_equal("Hello world", tr.to_en("Привет мир"))
40
+ assert_equal("Hello world", tr.to_en("¡Hola, mundo"))
41
+ assert_equal("Hello world", tr.to_en("مرحبا العالم"))
42
+ end
43
+
31
44
  def test_unsupported_translate
32
45
  assert_raise UnSupportedLanguage do
33
46
  tr = Translator.new()
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: 31
4
+ hash: 29
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 2
10
- version: 0.1.2
9
+ - 3
10
+ version: 0.1.3
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: A 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
 
@@ -76,7 +76,7 @@ rubyforge_project: language-translator
76
76
  rubygems_version: 1.3.7
77
77
  signing_key:
78
78
  specification_version: 3
79
- summary: A gem to translate from one language to another using google api(Unofficial).
79
+ summary: Ruby gem to translate from one language to another using google api.
80
80
  test_files:
81
81
  - test/translator_test.rb
82
82
  - test/test_helper.rb