Using Javascript and Google Translate

Hi all,

I am trying to use this code in a drop list to set the language in a prototype, using Google translate.
Any pointers on the correct syntax for adding this in Axure?

<div id="google_translate_element"></div>
<script>
    function googleTranslateElementInit() {
        new google.translate.TranslateElement(
            {pageLanguage: 'en'},
            'google_translate_element'
        );
    }
</script>
<script src="http://translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>

I have tried adding ‘:$’ after ‘javascript’, and removing the <div id and such, as they are probably unneeded, I am still unable to get the code to work in a native axure object. For workflow reasons it would be much easier to keep this created and maintained natively in axure and not use a code editor to add this function.

I am aware that a chrome user could already use the chrome plugin to do this exactly, however I need the control to sit in the prototype, during a full-screen use (no visible address bar and such).
Any pointers on the correct syntax for adding this in Axure? Thanks!

JS_Testing2.rp (52.4 KB)

Hi! If you’re looking to add external code to your prototype and you’ll be hosting the project on Axure Cloud, then we’d recommend using the Plugins feature to insert your code to the published project.

As far as how to structure that code, that’s beyond our support desk’s area of expertise but there are several code-savvy Axure gurus in the community who may be able to advise on that part! :slight_smile: