locked
Translate widget does not translate text typed in the input fields, tooltip/title of HTML elements RRS feed

  • Question

  • I started using the Microsoft Translator Widget, and I think that it serves most of my purposes.

    What I would have liked though is to translate even the text typed by the user in HTML input and text area elements, and also title attributes of HTML elements (which shows up as tooltip). This is very useful in cases when user wants to know the translation before posting it, for example as a comment on some article or a status update on some social website and post the translation itself.

    Please let me know if this is in your roadmap or do you want site developers to use the AJAX translator APIs for this purpose.

    -Kiran Lonikar

    Friday, August 10, 2012 4:55 AM

Answers

  • Hello Kiran,

    you are right that the widget does not translate user input. The text will be submitted to the web site as written. This is by design. We recommend that you, as web site owner, translate the input as needed. The best way to do that is to store the original as written, and then use the Microsoft Translator API (http://api.microsofttranslator.com) to translate the input into a language you can process/analyze/whatever.

    As a best practive you always want to retain the original input somewhere, and create the automatic translations as needed.

    Chris Wendt
    Microsoft Translator

    Monday, August 13, 2012 2:11 AM

All replies

  • Hello Kiran,

    you are right that the widget does not translate user input. The text will be submitted to the web site as written. This is by design. We recommend that you, as web site owner, translate the input as needed. The best way to do that is to store the original as written, and then use the Microsoft Translator API (http://api.microsofttranslator.com) to translate the input into a language you can process/analyze/whatever.

    As a best practive you always want to retain the original input somewhere, and create the automatic translations as needed.

    Chris Wendt
    Microsoft Translator

    Monday, August 13, 2012 2:11 AM
  • Ok, so that was the kind of answer I was expecting. However it would have been better to translate the user input as well, or at least the widget code generation should have provided an option to allow translation of user input.

    If not, I suggest the following alternatives, please let me know if the translator widget would support any of these?

    1. Would it be possible for the widget action handler to take one pre and one post handler javascript functions. I can then add my user text to a dom element in the pre-handler which the translator widget would translate, and my post handler would  add the translated text back to my user input?

    2. Using the translator API is an option but the problem is mine is a multi-user application and if I have to use the translator API, I would prefer my users provide their own client id, secret to my app based on which I can obtain the access token. But it appears to me that to obtain the access token, you need to post to the following URL and that is not possible from javascript due to cross domain violation. I do not want to have any server side code. How do I achieve this?

    https://datamarket.accesscontrol.windows.net/v2/OAuth2-13
    Monday, August 13, 2012 5:44 AM
  • Hello Kiran,

    my recommendation remains the same: you want to receive and store user input as written, translate from the stored original version as needed.

    If you want to offer translation as a feature to your users, use the Microsoft Translator API. You need to request the access token using server-side code, and using any server-side scripting that allows setting http headers. You find PHP and .Net samples here on the forum. You should sign up for the API, and will want to limit the throughput of your individual users to a level that is sustainable for you.

    Chris Wendt
    Microsoft Translator

    Monday, August 13, 2012 7:50 AM