|
|
try to translate one word from English to French (it can be any languages) - e.g. sparrow
You will receive this:
[[[ , ],[,,, ]],[[ ,[ , , ],[[ ,[ ],,0.45783335, ],[ ,[ ],,0.0033880526, ],[ ,[ ],,0.0024787523, ]], ,1]], ,,,[[ ,1,[[ ,1000,true,false],[ ,0,true,false],[ ,0,true,false],[ ,0,true,false],[ ,0,true,false]],[[0,7]], ,0,1]],0.02046049,,[[ ],,[0.02046049]],,,[[ ,[[[ , ], sparrow noun a small finchlike Old World bird related to the weaverbirds, typically with brown and gray plumage. m_en_us1292816.001 With a beat of her tiny brown wings, the sparrow was on her way. any of a number of birds that resemble true sparrows in size or color. m_en_us1292816.002 sparrow I saw one bird, a tiny \u003cb\u003esparrow\u003c/b\u003e darting through the gnarled pine limbs. m_en_us1292816.001 With a beat of her tiny brown wings, the \u003cb\u003esparrow\u003c/b\u003e was on her way. m_en_us1292816.001 It was a light gray and it had a large black beak, more like a hawk's than a \u003cb\u003esparrow\u003c/b\u003e 's. m_en_us1292816.001 An injured \u003cb\u003esparrow\u003c/b\u003e or a bird dressed for a dining table distresses her as much as war among nations and nuclear experiments do. m_en_us1292816.001 Everything from the modest \u003cb\u003esparrow\u003c/b\u003e to the extravagant scarlet macaw came to perch and settle around her. m_en_us1292816.001 The branches serve as a handy perch for the \u003cb\u003esparrows\u003c/b\u003e and mourning doves that frequent my city bird feeder. m_en_us1292816.001 Crows and \u003cb\u003esparrows\u003c/b\u003e have been known to attack innocent passers-by who happen to stroll near their nests. m_en_us1292816.001 Smaller birds such as pigeons, thrushes, jackdaws, robins and \u003cb\u003esparrows\u003c/b\u003e would also have been seen on a regular basis. m_en_us1292816.001 He fed \u003cb\u003esparrows\u003c/b\u003e and grosbeaks on a seed tray mounted on a pole to be visible from his windows. m_en_us1292816.001 While we don't have tall trees, our neighbors do, and the firs and oaks that surround our property drop acorns and provide homes for jays, woodpeckers, robins and \u003cb\u003esparrows\u003c/b\u003e. m_en_us1292816.001 Growing up, I was fascinated by birds and my mother encouraged this by letting me feed \u003cb\u003esparrows\u003c/b\u003e on the fire-escape outside our window. m_en_us1292816.001 All wild birds (except pigeons, English \u003cb\u003esparrows\u003c/b\u003e and starlings) are protected by federal and state laws, so it's illegal to trap, kill or poison them. m_en_us1292816.001 Game birds, mockingbirds, robins, and \u003cb\u003esparrows\u003c/b\u003e enjoy the juicy, sticky red fruits. m_en_us1292816.001 Some landscapes these days have been reduced to nothing but dandelions and fire ants, knapweed and thistle, where the only remaining wildlife are \u003cb\u003esparrows\u003c/b\u003e, squirrels, and starlings. m_en_us1292816.001 One sparrow box can house up to 36 baby \u003cb\u003esparrows\u003c/b\u003e in a year. m_en_us1292816.001 Stop \u003cb\u003esparrows\u003c/b\u003e and finches from shredding crocus blossoms by placing foil pinwheels - the kind sold for children's Easter baskets - every few feet among the flowers. m_en_us1292816.001 Most folks start with a feeder or two and quickly find themselves engrossed with the resident \u003cb\u003esparrows\u003c/b\u003e, finches, and woodpeckers that eagerly accept the offerings. m_en_us1292816.001 A couple of \u003cb\u003esparrows\u003c/b\u003e who had been peacefully resting on the grey rocks abruptly flew off. m_en_us1292816.001 Budgies, finches, \u003cb\u003esparrows\u003c/b\u003e and canaries are only a few of the more than one hundred kinds of birds people keep in their apartments. m_en_us1292816.001 There is nothing to see except blackbirds and \u003cb\u003esparrows\u003c/b\u003e; nothing to hear except the noise of butterflies' wings. m_en_us1292816.001 sparrow-hawk sparrow hawk
while if your input two same words - sparrow sparrow - you will receive proper answer:
moineau moineau
Mark Doubson
|
|
|
|
|
Thanks. That seems like a lot more information than we'd like to receive.
/ravi
|
|
|
|
|
You can try use
string.Format(",\"{0}\"", Translator.LanguageEnumToIdentifier(sourceLanguage))
instead of
string.Format(",,\"{0}\"", Translator.LanguageEnumToIdentifier(sourceLanguage))
result will be more reasonable:
moineau ,,,, noun passereaux moineau ,,0.45783335, passereaux ,,0.0033880526, pierrot ,,0.0024787523, sparrow
Nothing wrong from Google side - you just need to improve you parser
|
|
|
|
|
Not quite, because I think that affects other cases. Anyway, I have a fix and will be releasing it shortly.
Thanks,
/ravi
|
|
|
|
|
You can fork - two comma pattern for several words case and one comma pattern for single word.
Now nothing can be broken.
|
|
|
|
|
Yep, that's exactly what I did. The article has been updated - please test.
Thanks!
/ravi
|
|
|
|
|
Fix coming shortly... doing some final testing before I update the article.
/ravi
|
|
|
|
|
Fixed in the latest version (6-May-2015).
/ravi
|
|
|
|
|
Sorry, Ravi - again error - you need to change you logic:
else
{
text = text.Substring(0, index);
text = text.Replace("],[", ",");
text = text.Replace("]", string.Empty);
text = text.Replace("[", string.Empty);
text = text.Replace("\",\"", "\"");
string[] phrases = text.Split(new[] { '\"' }, StringSplitOptions.RemoveEmptyEntries);
for (int i = 0; (i < phrases.Count()); i += 2)
{
translation += phrases[i] + " ";
}
translation = translation.Trim();
translation = translation.Replace(" ?", "?");
translation = translation.Replace(" !", "!");
translation = translation.Replace(" ,", ",");
translation = translation.Replace(" .", ".");
translation = translation.Replace(" ;", ";");
}
Mark Doubson, Montreal, Canada
|
|
|
|
|
It seems to work fine for me, Mark. Are you having problems translating a specific phrase?
/ravi
|
|
|
|
|
Yes because I don't get your updated source and only get updated published text where you also split cases. Here you properly get Translated word for one word case but after you start from old returned Text again with double comma pattern - and it generate pages of something irrelevant.
|
|
|
|
|
Ugh. I suspect the sample in the article is out of sync with the actual code. Will fix.
/ravi
|
|
|
|
|
The article has been updated. GoogleTranslator is working again.
Enjoy!
/ravi
|
|
|
|
|
Thank you sir!
Amazing!
Toll!
Tuyệt vời!
|
|
|
|
|
Could you please tell me where to find a binary version of this app!? Thank you!
|
|
|
|
|
The binary isn't supplied, but you can build the app from the source.
/ravi
|
|
|
|
|
Just a quick note to let readers know that a new version of GoogleTranslator will be available shortly.
Cheers,
/ravi
|
|
|
|
|
Hello Sir,
I downloaded sample code and run. But it is not working properly.
Please help me ASAP.
Thanks,
Puspita.
|
|
|
|
|
I'll look into it when I get the chance.
Thanks,
/ravi
|
|
|
|
|
|
|
It does not work anymore. Perhaps because of some recent change by Google ...
|
|
|
|
|
http://stackoverflow.com/questions/29532717/redirected-to-captcha-when-accessing-google-translate
I'm trying to retrieving data from Google Translate for my website. I use this sample for retrieving data from Google Translate:
http://translate.google.com/translate_a/t?client=t&text=find&hl=en&sl=en&tl=fr
but now it's redirecting me to:
http://ipv4.google.com/sorry
This has been working fine for me for the last two years, but the issue appeared last night. What is causing this, and what can I do about it?
php google-translate
shareimprove this question
edited Apr 10 at 21:00
dimo414
9,68323979
asked Apr 9 at 7:46
Khoj
214
From the docs: "Google Translate API is available as a paid service." Are you paying for these translations? – dimo414 Apr 10 at 21:04
|
|
|
|
|
I'll look into it when I get the chance.
Thanks,
/ravi
|
|
|
|
|