Skip to content

Latest commit

 

History

History
executable file
·
23 lines (15 loc) · 667 Bytes

README.rdoc

File metadata and controls

executable file
·
23 lines (15 loc) · 667 Bytes

Translator

Description

Ruby gem to translate a string from one language to another using google api.

Installation

gem install language-translator

Usage

require 'rubygems' 
require 'translator' 

#To translate 'Hello World' to Hindi
tr = Translator.new()
tr.translate( 'Hello, World', 'hi')     #=> "नमस्ते, दुनिया"

#To translate "नमस्ते, दुनिया" to English
tr.translate('नमस्ते, दुनिया', 'en','hi')       #=> "Hello World"

#From Unknown language to english, from 0.1.2
tr.to_en('नमस्ते, दुनिया')                    #=> "Hello World"