Nantes Université

Skip to content
Extraits de code Groupes Projets
Valider d128d5d5 rédigé par Jeremie BOURDON's avatar Jeremie BOURDON
Parcourir les fichiers

Update file Translate.php

parent a959fb4a
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -90,7 +90,7 @@ if (isset($_GET["ROOMID"])) {
// Launch Google Traduction API
if ($WhichTranslator == "GOOGLE") {
$output=array(); $retval=0;
exec($proxy."curl -s -X POST -H \"Content-Type: application/json\" --data \"{ 'q': '".str_replace("'","\'",$texte."")."', 'source': '".$langinput."', 'target': '".$lang."', 'format': 'text'}\" \"https://translation.googleapis.com/language/translate/v2?key=".$GOOGLEAPITOKEN."\"",$output,$retval);
exec($proxy."curl -q -s -X POST -H \"Content-Type: application/json\" --data \"{ 'q': '".str_replace("'","\'",$texte."")."', 'source': '".$langinput."', 'target': '".$lang."', 'format': 'text'}\" \"https://translation.googleapis.com/language/translate/v2?key=".$GOOGLEAPITOKEN."\"",$output,$retval);
$resultjson = (implode(" ",$output));
$result=$resultjson;
//$result=$resultjson->data->translations[0]->translatedText;
......@@ -123,7 +123,7 @@ if (isset($_GET["ROOMID"])) {
if ($WhichTranslator == "LIBRETRANSLATE") {
$output=array(); $retval=0;
exec($proxy."curl ".$LIBRETRANSLATESERVER." -d \"q=".str_replace('"','\"',$texte."")."\" -d \"format=text\" -d \"source=".strtolower($langinput)."\" -d \"target=".strtolower($lang)."\"",$output,$retval);
exec($proxy."curl -q ".$LIBRETRANSLATESERVER." -d \"q=".str_replace('"','\"',$texte."")."\" -d \"format=text\" -d \"source=".strtolower($langinput)."\" -d \"target=".strtolower($lang)."\"",$output,$retval);
$resultjson = (implode(" ",$output));
$resultsinjson = json_decode($resultjson);
$resultjson = '{ "data": { "translations": ['.str_replace("\n"," ",$resultjson).'] } }';
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter