Skip to content Skip to sidebar Skip to footer

Google Translate Tool Does Not Work On The Input Type Text Value?

I am using Google Translate tool for website on my page, and it is working fine but when I checked the same on a page with form, it is not changing the value written inside the inp

Solution 1:

Apparently Google Website Translator does not translate input element values, even when set in HTML source. I tested with a textarea element too, with the same result. However, it does translate user input via an element other than a form field; such elements can be created using the contenteditable attribute, which is widely (though not quite universally) supported in modern browsers. But extra measures would be needed to make the translated text to be submitted along with a form (since it won’t be in a form field).

In my book Going Global with JavaScript and Globalize.js, I describe some of the issues in automatic translation and suggest that although it might not be a good idea to have widgets for it on web pages in general, it could be useful for user input. For example, consider a discussion forum where discussions take place in English. You could add functionality that lets everyone use his native language, have it instantly translated into English, check it out, and submit it. There’s a simple demo of this: Translation of user input. (It uses a contenteditable element and writes the translated content into a hidden field.)


Post a Comment for "Google Translate Tool Does Not Work On The Input Type Text Value?"