Last post Jul 17, 2011 11:07 AM by Sgt8log
Member
3 Points
10 Posts
Jul 17, 2011 09:01 AM|mechanize|LINK
Hi, I have developed a web application and now I want to integrate Google Translate Api, I am calling Google Translate API via : https://www.googleapis.com/language/translate/v2?key= and getting following string { "data": {"translations": [ { "translatedText": "नमस्ते अतिथि..." } ] } } I am interested in “नमस्ते अतिथि” only but getting above string Please anyone can direct me to the right direction? How can I integrate Google translate correctly, Regards
430 Points
107 Posts
Jul 17, 2011 11:07 AM|Sgt8log|LINK
Try this code.
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Text.RegularExpressions; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { string input = @"{ ""data"": {""translations"": [ { ""translatedText"": ""नमस्ते अतिथि..."" } ] } }"; Regex regex = new Regex(@"\""[^""]*\"""); Console.WriteLine(input); Console.WriteLine("Extracted"); Console.WriteLine(regex.Matches(input)[3]); Console.ReadLine(); } } }
Regards,
Sgt. 8log
Member
3 Points
10 Posts
asp.net google translate api
Jul 17, 2011 09:01 AM|mechanize|LINK
Hi,
I have developed a web
application and now I want to integrate Google Translate Api,
I am calling Google Translate API
via :
https://www.googleapis.com/language/translate/v2?key=
and getting
following string
{ "data": {"translations": [ { "translatedText": "नमस्ते अतिथि..." } ] } }
I am interested in “नमस्ते अतिथि” only but getting above string
Please anyone can direct me to
the right direction?
How can I integrate Google
translate correctly,
Regards
Member
430 Points
107 Posts
Re: asp.net google translate api
Jul 17, 2011 11:07 AM|Sgt8log|LINK
Try this code.
Regards,
Sgt. 8log
To err is human