Class: TranslationsController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/translations_controller.rb

Instance Method Summary collapse

Instance Method Details

#translateObject



6
7
8
9
10
11
12
13
# File 'app/controllers/translations_controller.rb', line 6

def translate
  translator = BingTranslator.new( Autotolk.bing_client_id, Autotolk.bing_client_secret,
    false, Autotolk.)
  translated = translator.translate params[:original], :to => params[:to]
  render json: {status: 200, translated: translated}
rescue Exception => e
  render json: {status: 500, error: e}
end