You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
502 B
PHP
19 lines
502 B
PHP
<?php
|
|
|
|
namespace App;
|
|
|
|
use Stichoza\GoogleTranslate\GoogleTranslate;
|
|
|
|
function translate($str, $target_lang_code='de'){
|
|
$translated = new GoogleTranslate('en');
|
|
return $translated->setSource('en')->setTarget($target_lang_code)->translate($str);
|
|
}
|
|
|
|
/*
|
|
class Translator {
|
|
public function translate($str, $target_lang_code='de'){
|
|
$translated = new GoogleTranslate('en');
|
|
return $translated->setSource('en')->setTarget($target_lang_code)->translate($str);
|
|
}
|
|
}*/
|