Thursday, October 8, 2009

Google Translate API for .NET 0.3

We use localization in some of our WPF projects and I was wondering how easy would be to integrate the Google Translate API. I must say it has been unbelievable easy to use it! Check the code below:


using Google.API.Translate;
using NUnit.Framework;
 
namespace GoogleTranslation
{
    [TestFixture]
    public class GoogleTransationFixture
    {
        [Test]
        public void TranslateTest()
        {
            var client = new TranslateClient("test");
            var result  = client.Translate("casa", Language.Spanish, Language.Dutch);
            Assert.IsNotEmpty(result);
            Assert.AreEqual("huis", result);
        }
    }
}

No comments: