<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How does JSL call google's web translation results? in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/How-does-JSL-call-google-s-web-translation-results/m-p/755099#M93755</link>
    <description>&lt;P&gt;There are many many incorrect functions used in your example. I would first use scripting index to fix those and then get back here if needed.&lt;/P&gt;</description>
    <pubDate>Fri, 17 May 2024 06:40:15 GMT</pubDate>
    <dc:creator>jthi</dc:creator>
    <dc:date>2024-05-17T06:40:15Z</dc:date>
    <item>
      <title>How does JSL call google's web translation results?</title>
      <link>https://community.jmp.com/t5/Discussions/How-does-JSL-call-google-s-web-translation-results/m-p/755089#M93754</link>
      <description>&lt;P&gt;For example, how do I translate the specified English content into Chinese?&lt;BR /&gt;This is the result of a GPT3.5 query and does not work.&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;url = "https://translate.google.com";
sourceText = "Hello, world!";
targetLanguage = "zh-CN";  // Chinese Simplified

// Build the HTTP request
postData = "sl=en&amp;amp;tl=" || urlEncode(targetLanguage) || "&amp;amp;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, "&amp;lt;span title=\"") + Length("&amp;lt;span title=\"");
endPos = Pos(response, "\"&amp;gt;", startPos);
translation = Substr(response, startPos, endPos - startPos);

// Display the translation result
Show("Source Text: " || sourceText);
Show("Translation: " || translation);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 17 May 2024 06:13:51 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-does-JSL-call-google-s-web-translation-results/m-p/755089#M93754</guid>
      <dc:creator>lala</dc:creator>
      <dc:date>2024-05-17T06:13:51Z</dc:date>
    </item>
    <item>
      <title>Re: How does JSL call google's web translation results?</title>
      <link>https://community.jmp.com/t5/Discussions/How-does-JSL-call-google-s-web-translation-results/m-p/755099#M93755</link>
      <description>&lt;P&gt;There are many many incorrect functions used in your example. I would first use scripting index to fix those and then get back here if needed.&lt;/P&gt;</description>
      <pubDate>Fri, 17 May 2024 06:40:15 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-does-JSL-call-google-s-web-translation-results/m-p/755099#M93755</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2024-05-17T06:40:15Z</dc:date>
    </item>
  </channel>
</rss>

