Google's website translator and content loaded via AJAX
I am using Google's website translator on a website I am developing. In one section of the website I use AJAX to load new content into the page. I was hoping that there was a way to tell the Google translator to re-translate the loaded content (I could provide a DOM element that the content resides in).
I can't find any documentation which suggests how to do this and it appears that the Google Translate API is becoming a paid service. Is it possible to use the Google translator in the way I require or do开发者_如何学运维 you need to use the paid service?
You can call a function to re-translate the page in the same place you render the ajax content:
$.getScript("//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit");
Here's an example on jsFiddle http://jsfiddle.net/patridge/NQ4uE/
精彩评论