Page 1 of 1

Google Translate Script

Posted: Fri Aug 10, 2012 9:20 am
by LindaW
I've inserted the script for Google Translate into my master page and am pretty pleased with the results - except that in addition to the Google dropdown box, after the first time a selection is made from the dropbox, I am also getting a Google Translate bar across the top of my pages.

I'm not much of a Javascript person - strictly copy and paste - so, I can't tell if I've got some code in there that I might be able to remove so that only the dropdown box displays, and not the Google bar.
This is the test site where I have published it:

http://www.knowlagent.com/documentation ... imeReview/


I've included the code from my Master Page, with the script inserted after the <body> tag.

I'd appreciate any suggestions on changes I can make to get rid of the tool bar.

Thanks,
Linda


<?xml version="1.0" encoding="utf-8"?>
<html xmlns:MadCap="http://www.madcapsoftware.com/Schemas/MadCap.xsd" MadCap:lastBlockDepth="3" MadCap:lastHeight="345" MadCap:lastWidth="1169" MadCap:conditions="KnowlagentConditionTagSet.NotForTranslations">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=9; IE=8; IE=7; IE=EDGE">
</meta>
<script type="text/javascript">/*<![CDATA[*/ var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-28517412-1']);
_gaq.push(['_setDomainName', 'knowlagent.com']);
_gaq.push(['_trackPageview']);

(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();/*]]>*/</script>
</head>
<body>
<div id="google_translate_element" style="float: right;">
</div>
<script type="text/javascript">
function googleTranslateElementInit() {
new google.translate.TranslateElement({pageLanguage: 'en', layout: google.translate.TranslateElement.InlineLayout.SIMPLE, gaTrack: true, gaId: 'UA-28517412-1'}, 'google_translate_element');
}
</script>
<script type="text/javascript" src="http://translate.google.com/translate_a ... lementInit">
</script>
<p> </p>
<p style="text-align: right;">
<script src="../feedback_script.js">
</script>
</p>
<MadCap:breadcrumbsProxy />
<MadCap:bodyProxy />
<MadCap:miniTocProxy />
<MadCap:topicToolbarProxy class="" style="mc-topic-toolbar-items: ;" />
<hr class="hr_wide" />
<blockquote>
<h2 class="TopicHeading"><span style="font-weight: normal;">We value your feedback. Please send your comments or requests to the WebHelp Development Team.</span> <![CDATA[ ]]></h2>
<p>
<script src="../feedback_script.js">
</script>
</p>
</blockquote>
<hr class="hr_wide" />
</body>
</html>

Re: Google Translate Script

Posted: Fri Sep 21, 2012 2:58 pm
by techwriter31
Hi LindaW,

Did you have any luck? I too, would like to hide the toolbar if possible. I have a breadcrumbs proxy at the top of my master page and it covers the breadcrumb path and pushes the heading text down a bit, depending on the language selected.

Thanks!

Re: Google Translate Script

Posted: Thu Oct 04, 2012 11:38 am
by LindaW
Hi Kellie,
I've been away on vacation, so have not looked at this for a couple of weeks and probably will not get to it again before next week. So far, no progress, but I'll post again if I'm able to figure anything out.
Linda

Re: Google Translate Script

Posted: Thu Oct 04, 2012 1:04 pm
by techwriter31
No problem. Thanks!

By the way, I just figured out a problem with the script, that caused copyright symbols to be garbled in IE9:
http://forums.madcapsoftware.com/viewto ... =9&t=15828

Re: Google Translate Script

Posted: Tue Nov 27, 2012 11:21 am
by Thomas Tregner
Here is a clean description of how to show and hide an element: http://girlswhogeek.com/tutorials/2007/ ... javascript

Look at the markup for the bar while displayed in a web browser. From Chrome, you can right-click and select Inspect element. From IE, you can press F12 and use Find > Select element by click. Once you find the element, note the ID attribute. The show and hide scripts in the link take an ID for an element. So you can create buttons which fire those scripts using the ID of the element you want to show or hide.

As a side note, depending on browser settings, the Chrome browser displays a translate option similar to the bar and other browsers with Translate plugins may do the same. Some users may see both your script generated bar and the browser bar.

Re: Google Translate Script

Posted: Fri Nov 30, 2012 9:17 am
by techwriter31
Thanks for the information!

We've actually decided that if we use the Google Translate plug-in for a customer-facing website, we'll leave the toolbar in place because it makes users aware of the fact that we're using automated translations, rather than human translations.