Advertisement
zaksya

Untitled

Nov 6th, 2019
318
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.43 KB | None | 0 0
  1. <?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
  2. use Stichoza\GoogleTranslate\GoogleTranslate;
  3. function translate()
  4. {
  5.     $CI =& get_instance();
  6.     $text = $CI->output->get_output();
  7.     $text = trim($text);
  8.  
  9.     $translate  = new GoogleTranslate();
  10.     $output     = $translate->setSource('id')->setTarget('en')->translate($text);
  11.  
  12.     $output = trim($output);
  13.     $CI->output->set_output($output);
  14.     $CI->output->_display();
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement