Class: GTranslate::Translator
Instance Method Summary collapse
-
#initialize(text, source, target) ⇒ Translator
constructor
Create an instance with the specified options.
-
#translate ⇒ Object
Do the actual translation.
Constructor Details
#initialize(text, source, target) ⇒ Translator
Create an instance with the specified options
Parameters
- text<String>
-
The text you want to be translated
- source<String>
-
The source of the language. Currently only iso_639_2 codes are allowed (2 letter codes i.e. English -> en, German -> de, etc)
- target<String>
-
The target of the language. Same as source, only iso_639_2
Returns
GTranslate:: a GTranslate object
–
21 22 23 24 25 26 |
# File 'lib/g_translate/translator.rb', line 21 def initialize( text, source, target ) assert_valid_text! text assert_valid_iso_639_2! source, target @text, @source, @target = text, source, target end |