Answered by:
Translator API: English to Arabic translations from not working

Question
-
I'm trying to use the Translator API from C# to translate something as simple as "Hello world" from English to Arabic and I only get "Hello world" in the translated text instead of the Arabic version. I am using the Translate method from the API to perform the translation.
Is there a current issue with Arabic?
Julio
- Edited by Julio Casal Monday, December 3, 2012 3:15 PM Added more details
Monday, December 3, 2012 3:09 PM
Answers
-
Hi Julio,
Indeed "Hello world" translates to "Hello world" in Arabic.
This is a somewhat pathological case: Our system is trained on real-world translations. The phrase "Hello world" is used most frequently in programming code examples, which are typically not translated. Well, better not translated at all. That's why this happens. If you use some actual text, you will see the translation to Arabic working well.
We can, and we will fix this individually, though. Thanks as always for the report.
Chris Wendt
Microsoft Translator- Marked as answer by Julio Casal Saturday, December 8, 2012 4:06 AM
Saturday, December 8, 2012 12:57 AM
All replies
-
I don't see any problems at the moment.
Can you post your code, so we can take a look? Thanks...
Monday, December 3, 2012 3:38 PM -
Yes, here my code:
private static void TranslateToArabic(string authToken) { string text = "Hello World"; TranslatorService.LanguageServiceClient client = new TranslatorService.LanguageServiceClient(); HttpRequestMessageProperty httpRequestProperty = new HttpRequestMessageProperty(); httpRequestProperty.Method = "POST"; httpRequestProperty.Headers.Add("Authorization", authToken); using (OperationContextScope scope = new OperationContextScope(client.InnerChannel)) { OperationContext.Current.OutgoingMessageProperties[HttpRequestMessageProperty.Name] = httpRequestProperty; string translationResult = client.Translate("", text, "en", "ar", "text/html", "general"); Console.WriteLine("Translation for source {0} from {1} to {2} is", text, "en", "ar"); Console.WriteLine(translationResult); } }
The resulting output would be this, which is not the Arabic version of Hello world:
Translation for source Hello World from en to ar is
Hello worldThanks,
Julio
Friday, December 7, 2012 2:47 AM -
This looks like you are using the .NET class provided by the Windows Azure Marketplace.
If that's the case, have you followed this walkthrough: http://code.msdn.microsoft.com/windowsazure/Walkthrough-Translator-in-7e0be0f7
?Between this, and the other thread, it looks, to me, that you aren't even connecting to translator -- that's why no translations or localizations are occurring.
My personal preference is to code this stuff myself.
Take a look at:
http://blogs.msdn.com/b/translation/p/gettingstarted1.aspx - For signing up and making sure you have the right app credentials
http://blogs.msdn.com/b/translation/p/gettingstarted2.aspx - For an example app that uses them
Laurence
- Proposed as answer by Laurence Moroney Friday, December 7, 2012 3:30 PM
- Unproposed as answer by Julio Casal Friday, December 7, 2012 5:44 PM
Friday, December 7, 2012 3:30 PM -
Thanks Laurence,
I am not using the .NET class provided by the Azure Marketplace. I just added a web reference to http://api.microsofttranslator.com/V2/soap.svc with provided me the LanguageService client class you see in my code.
Translations are working perfectly with the very same code if I specify any other target language. It is only when I specify Arabic (ar) that I get "Hello world" as the translated text instead of the Arabic version.
Thanks,
Julio
Friday, December 7, 2012 5:44 PM -
Hi Julio,
Indeed "Hello world" translates to "Hello world" in Arabic.
This is a somewhat pathological case: Our system is trained on real-world translations. The phrase "Hello world" is used most frequently in programming code examples, which are typically not translated. Well, better not translated at all. That's why this happens. If you use some actual text, you will see the translation to Arabic working well.
We can, and we will fix this individually, though. Thanks as always for the report.
Chris Wendt
Microsoft Translator- Marked as answer by Julio Casal Saturday, December 8, 2012 4:06 AM
Saturday, December 8, 2012 12:57 AM