Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

3 876 Posts in 868 Topics- by 723 Members - Latest Member: tablarock

22 May 2012, 17:43
Select Language English | Russian ru | German
Main PageIRC Client KVIrc forumKVIrc discussionKVIrc scriptingOnChannelMessage Google Translate
Pages: [1]
Print
Author Topic: OnChannelMessage Google Translate  (Read 1316 times)
0 Members and 1 Guest are viewing this topic.
ambossarm
Постоялец
***

Репутация: 11
Gender: Male
Posts: 113



View Profile
« on: 8 March 2011, 05:29 »

The Class translates the message it gets and echos the result into the channel the message is from. The Event is triggered if the channel is #kvirc and translates from en to de.

Thanks to alexzulu for the open GoogleAPI without Key.

Quote
class("gtrans","http")
{
   function doneEvent()
   {
      %answer = $str.section(@$readAll(),"\"",5,5)
      echo -w=@%windowid %answer;
   }

   function trigger()
   {
      #$0: source
      #$1: target
      #$2: message
      @$setHost("ajax.googleapis.com");
      @$get("/ajax/services/language/translate?v=1.0&q=$str.urlencode($2)&langpair=$0|$1");
      @%windowid = $3;
   }
}


event(OnChannelMessage,GoogleTranslate)
{
   if ($target == "#kvirc") {
      %gtrans = $new(gtrans);
      %gtrans->$trigger("en","de",$3,$channel($target));   
   }
}
Logged
dracozny
Новичок
*

Репутация: 2
Posts: 43


View Profile
« Reply #1 on: 21 December 2011, 06:25 »

taking it up a noch.. the mibbit web client(although I do detest it) will translate any language to the desired language, it uses the auto detect function of the google api.
Logged
ambossarm
Постоялец
***

Репутация: 11
Gender: Male
Posts: 113



View Profile
« Reply #2 on: 21 December 2011, 10:53 »

try setting $0 to auto, but it will have problems with nonperfect lines, like most chats are.

Not only typos are a problem, most chat have a shortform for words that are not recognized by google.
Logged
dracozny
Новичок
*

Репутация: 2
Posts: 43


View Profile
« Reply #3 on: 21 December 2011, 11:05 »

thats a given for most (non human)translators.
however doing that only produces
"invalid translation language pair"
« Last Edit: 21 December 2011, 11:30 by dracozny » Logged
dracozny
Новичок
*

Репутация: 2
Posts: 43


View Profile
« Reply #4 on: 21 December 2011, 11:37 »

from the google api
Quote
Warning: You need your own API key in order to use the Language Detect API. In the example below, replace "INSERT-YOUR-KEY" with your own, unique key. Without a unique key, these examples won't work.
so no auto translate unless you wanna pay for it in v2
Quote
For text translations, you can use the Google Translate API v2, which is now available as a paid service

worst yet using the code as is
Quote
Suspected Terms of Service Abuse. Please see http://code.google.com/apis/errors

Quote
Google Translate API v1 was officially deprecated on May 26, 2011; it was shut off completely on December 1, 2011.

« Last Edit: 21 December 2011, 11:41 by dracozny » Logged
alexzulu
Постоялец
***

Репутация: 29
Posts: 181



View Profile Email
« Reply #5 on: 22 December 2011, 19:17 »

the project is closed. service has ceased to be free.
Logged

сеть freenode, каналы #kvirc и #kvirc-ru
ambossarm
Постоялец
***

Репутация: 11
Gender: Male
Posts: 113



View Profile
« Reply #6 on: 23 December 2011, 02:42 »

WTF, I just wanted to post my v2 version of the script and tell the ppl to get a free key for their own use, but there is no free service at all oO?

Quote
Courtesy limit: 0 characters/day • Pricing



    1 M characters of text: $20.00


Everything else on google has a free "courtesy limit" , damn!
1 Million Chars 20 bucks, that is 1MB of text costs 20$ oO? they really think they have a perfect translation...


Is there a service like that from MS or Yahoo?

http://www.microsofttranslator.com
http://babelfish.yahoo.com

Do they have an API?



just reading http://en.wikipedia.org/wiki/Comparison_of_machine_translation_applications
« Last Edit: 23 December 2011, 02:49 by ambossarm » Logged
Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic