Par exemple, comment traduire le contenu anglais spécifié en chinois ?
Ceci est le résultat d'une requête GPT3.5 et ne fonctionne pas.
Merci!
url = "https://translate.google.com";
sourceText = "Hello, world!";
targetLanguage = "zh-CN"; // Chinese Simplified
// Build the HTTP request
postData = "sl=en&tl=" || urlEncode(targetLanguage) || "&text=" || urlEncode(sourceText);
headers = Associative Array("Content-Type", "application/x-www-form-urlencoded", "User-Agent", "Mozilla/5.0");
httpReq = New HTTP Request(
url,
"POST",
headers,
postData
);
// Send the HTTP request and retrieve the response
httpReq.Send();
response = httpReq.ResponseBody();
// Extract the translation
startPos = Pos(response, "<SPAN title="\">", startPos); translation = Substr(response, startPos, endPos - startPos); // Afficher le résultat de la traduction Show("Source Text: " || sourceText); Show("Translation: " || translation);</SPAN>De nombreuses fonctions incorrectes sont utilisées dans votre exemple. J'utiliserais d'abord l'index de script pour les corriger, puis je reviendrais ici si nécessaire.