Tuesday, August 24, 2010

Google Translate Kit

It is a sub-project divided from Citiport project. Google Translation Kit is an implementation for Google Translation in C#, also supporting cache and data writing to any media, log file, database or...
compatible with Mono 2.6
Very basic sample:

  • Translator gt = new Translator();  



  • /*using cache*/  



  • DemoWriter dw = new DemoWriter();  



  • gt.KeyGen = new SimpleKeyGen();  



  • gt.CacheManager = new SimleCacheManager();  



  • gt.Writer = dw;  



  • Translator.TranslatedPost post = gt.GetTranslatedPost("Hello world", LanguageConst.ENGLISH, LanguageConst.CHINESE);  



  • Translator.TranslatedPost post2 = gt.GetTranslatedPost("I'm Jeff", LanguageConst.ENGLISH, LanguageConst.CHINESE);  



  • this.result.InnerHtml = "<p>" + post.text +post2.text+ "</p>";  



  • dw.WriteToFile();  

  • Read more: Codeplex