<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-gb">
	<link rel="self" type="application/atom+xml" href="https://forum.eggheads.org/app.php/feed/topic/20932" />

	<title>egghelp/eggheads community</title>
	<subtitle>Discussion of eggdrop bots, shell accounts and tcl scripts.</subtitle>
	<link href="https://forum.eggheads.org/index.php" />
	<updated>2021-03-09T07:14:43-04:00</updated>

	<author><name><![CDATA[egghelp/eggheads community]]></name></author>
	<id>https://forum.eggheads.org/app.php/feed/topic/20932</id>

		<entry>
		<author><name><![CDATA[CrazyCat]]></name></author>
		<updated>2021-03-09T07:14:43-04:00</updated>

		<published>2021-03-09T07:14:43-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=109501#p109501</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=109501#p109501"/>
		<title type="html"><![CDATA[Converting CrazyCat's Translation Script into using API key]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=109501#p109501"><![CDATA[
The <a href="https://translate.googleapis.com/translate_a/single" class="postlink">https://translate.googleapis.com/translate_a/single</a> url works but the rendered json is unreadable as there are no key.<br><br>I try to do a reusable script, not a fullish txt parser.<br><br>Here is the json I get when asking the translation of <em class="text-italics">bonjour la france</em>:<div class="codebox"><p>Code: </p><pre><code>[[["Hello France","bonjour la france",null,null,1]],null,"fr",null,null,null,1.0,[],[["fr"],null,[1.0],["fr"]]]</code></pre></div>And no, I won't treat it as a simple string.<br><br>Converted into dict, no more useable:<div class="codebox"><p>Code: </p><pre><code>{{{Hello France} {bonjour la france} null null 1}} null fr null null null 1.0 {} {fr null 1.0 fr}</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=691">CrazyCat</a> — Tue Mar 09, 2021 7:14 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[ComputerTech]]></name></author>
		<updated>2021-03-07T10:26:03-04:00</updated>

		<published>2021-03-07T10:26:03-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=109493#p109493</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=109493#p109493"/>
		<title type="html"><![CDATA[Converting CrazyCat's Translation Script into using API key]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=109493#p109493"><![CDATA[
Mmmm, it's not possible to somehow input text into<br><br><a href="https://translate.google.com/" class="postlink">https://translate.google.com/</a><br><br>Is that how the old script did?<br><br>and if i had a API key, you'd have it straight away  <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_wink.gif" width="15" height="15" alt=":wink:" title="Wink"> (trust you 100%)<br><br><br>EDIT <br><br>Was speaking to a Msl scripter and he says the way he uses his google translate script is using this.<br><div class="codebox"><p>Code: </p><pre><code>&lt;westor&gt; https://translate.googleapis.com/translate_a/single?client=gtx&amp;sl=auto&amp;tl=en&amp;dt=t&amp;q=URL_ENCODE(URL)&lt;westor&gt; https://translate.googleapis.com/translate_a/single?client=gtx&amp;sl=auto&amp;tl=en&amp;dt=t&amp;q=URL_ENCODE(TEXT)</code></pre></div><blockquote class="uncited"><div>&lt;ComputerTech&gt; so no api key like the youtube one then eh?<br>&lt;westor&gt; yeah it doesn't require one<br>&lt;westor&gt; just send some Headers<br>&lt;westor&gt; a valid User-Agent is required</div></blockquote>Hope this helps  <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_wink.gif" width="15" height="15" alt=":wink:" title="Wink"><br><br>EDIT 2<br><br>found this from bitbot, that might be of use<br><br><a href="https://github.com/jesopo/bitbot/blob/master/modules/translate.py" class="postlink">https://github.com/jesopo/bitbot/blob/m ... anslate.py</a><br><br>maybe could do similiar for your Script CrazyCat  <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=12849">ComputerTech</a> — Sun Mar 07, 2021 10:26 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[CrazyCat]]></name></author>
		<updated>2021-03-07T05:33:15-04:00</updated>

		<published>2021-03-07T05:33:15-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=109492#p109492</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=109492#p109492"/>
		<title type="html"><![CDATA[Converting CrazyCat's Translation Script into using API key]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=109492#p109492"><![CDATA[
I don't work anymore on this script since google stopped providing a free API, but I'll have an eye on it.<br><br>short points to see:<br>url is now <a href="https://translation.googleapis.com/language/translate/v2" class="postlink">https://translation.googleapis.com/lang ... anslate/v2</a><br>query must use POST<br>default return format is html, you may have to add format=text to get the translation in plain-text<br><br>I can only do a theorical development because google force to give a payment card even for a free trial and I won't do that.<br><br>If you have an api key and trust me, you can share it with and then I can do an evolution of this old script <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=691">CrazyCat</a> — Sun Mar 07, 2021 5:33 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[ComputerTech]]></name></author>
		<updated>2021-03-06T19:40:07-04:00</updated>

		<published>2021-03-06T19:40:07-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=109490#p109490</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=109490#p109490"/>
		<title type="html"><![CDATA[Converting CrazyCat's Translation Script into using API key]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=109490#p109490"><![CDATA[
So i have tried to find the where i could insert the API key, as the Script says it uses API,<br>but i cant find where.<br><div class="codebox"><p>Code: </p><pre><code>## Google Translator## Translation using Google Translate API## Author: CrazyCat &lt;crazycat@c-p-f.org&gt;# http://www.eggdrop.fr# irc.zeolia.net #c-p-f## Usage:#   !tr &lt;lg&gt; Sentence#  lg is the destination language## Changelog# 0.2 : Decodes html entities when needed## TODO:#   - Lot of things, that's a beta version#namespace eval gTranslator {set lngs { "fr" "en" "es" "de" "it" "nl" "id" }#---------------------------------------------------------------------##                    ***End of Settings ***                           ##   Do not edit below this line unless you know what you are doing! ##---------------------------------------------------------------------#    variable author "CrazyCat"    variable versionNum "0.2"    variable versionName "gTranslator"}namespace eval gTranslator {bind pub - !tr gTranslator::translateproc translate { nick uhost handle chan text } {package require httppackage require jsonset lngto [string tolower [lindex [split $text] 0]]if { [lsearch $::gTranslator::lngs $lngto] == -1 } {putserv "PRIVMSG $chan :\002Attention\002 $lngto n'est pas valide"return 0}set text [::http::formatQuery q [join [lrange [split $text] 1 end]]]set dturl "http://ajax.googleapis.com/ajax/services/language/detect?v=1.0&amp;q=$text"set res [::json::json2dict [::http::data [::http::geturl $dturl]]]set lng [dict get $res responseData language]if { $lng == $lngto } {putserv "PRIVMSG $chan :\002Erreur\002 Traduction de $lng (détecté) vers $lngto"return 0}set trurl "http://ajax.googleapis.com/ajax/services/language/translate?v=1.0&amp;langpair=$lng%7C$lngto&amp;$text"putlog $trurlset res [::json::json2dict [::http::data [::http::geturl $trurl]]]putlog $resputserv "PRIVMSG $chan :Langue detectée: $lng"set substitution {[format %c \1]}set trtext [subst [regsub -all -- {&amp;#(\d+);} [dict get $res responseData translatedText] $substitution]]putserv "PRIVMSG $chan :$trtext"}}putlog "\002$::gTranslator::versionName $::gTranslator::versionNum\002 loaded"</code></pre></div>or if its possible to convert to use a Google Translation API key<br><br><a href="https://cloud.google.com/translate" class="postlink">https://cloud.google.com/translate</a><br><br>Thanks in advanced  <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_wink.gif" width="15" height="15" alt=":wink:" title="Wink"><br><br><br>EDIT 1 :  getting this error when using the script<div class="codebox"><p>Code: </p><pre><code>&lt;Tech&gt; [05:41:37] Tcl error [gTranslator::translate]: unexpected '&lt;' in TOP mode</code></pre></div>Hope this helps<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=12849">ComputerTech</a> — Sat Mar 06, 2021 7:40 pm</p><hr />
]]></content>
	</entry>
	</feed>
