<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Google Translation Archives - gj</title>
	<atom:link href="https://blog.gaiterjones.com/tag/google-translation/feed/" rel="self" type="application/rss+xml" />
	<link>https://blog.gaiterjones.com/tag/google-translation/</link>
	<description>gaiterjones</description>
	<lastBuildDate>Tue, 07 Jun 2011 14:50:21 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.4.3</generator>
	<item>
		<title>Magento Google Element Translation Tool Implementation in 5 Minutes</title>
		<link>https://blog.gaiterjones.com/magento-google-translation-tool-implementation/</link>
					<comments>https://blog.gaiterjones.com/magento-google-translation-tool-implementation/#comments</comments>
		
		<dc:creator><![CDATA[PAJ]]></dc:creator>
		<pubDate>Thu, 10 Feb 2011 15:35:41 +0000</pubDate>
				<category><![CDATA[Language]]></category>
		<category><![CDATA[Magento]]></category>
		<category><![CDATA[5 Minute Fix]]></category>
		<category><![CDATA[Google Translation]]></category>
		<guid isPermaLink="false">http://blog.gaiterjones.com/?p=74</guid>

					<description><![CDATA[Google translations are not always perfect, and should not be relied on as a permanent solution to a Magento eCommerce multi language store front but implementing the Google element translation...<a class="more-link" href="https://blog.gaiterjones.com/magento-google-translation-tool-implementation/" title="Continue reading">Continue reading</a>]]></description>
										<content:encoded><![CDATA[<p><strong>Google </strong>translations are not always perfect, and should not be relied on as a <em>permanent </em>solution to a Magento eCommerce multi language store front but implementing the <a href="http://translate.google.com/translate_tools  ">Google element translation tool</a> into your Magento eCommerce site is a <strong><em>quick win</em></strong> especially if you are receiving a lot of visits from customers with a browser language that is different from your primary store language. We found customers were using Google to translate our store anyway, so why not implement the translation code <span style="text-decoration: underline;">ourselves</span>?</p>
<p>You can simply implement the Google element translation tool into Magento (and WordPress &#8211; see top left!) with support for over 50 languages in <strong>5 minutes</strong>.</p>
<p>Lets look at the default themes for Magento 1.3.x, 1.4.x and 1.5.x &#8211; in the <strong>header.phtml</strong> template file <strong>languages.phtml</strong> is used to automatically create a store switcher for Magento sites with more than one store. Lets replace the code in the language switcher phtml file with the Google element translation code.</p>
<p>Locate your version of the <em>languages.phtml</em> file and make a backup copy i.e. <em>languages.phtml.old</em>. Copy and paste the following code into<em> languages.phtml </em>replacing the existing code.</p>
<pre class="brush:plain">&lt;div class="form-language"&gt;
    &lt;label for="select-language"&gt;&lt;?php echo $this-&gt;__('Your Language:') ?&gt; &lt;/label&gt;

&lt;!-- Google Element Translator Styling--&gt;
		&lt;style&gt;
			.goog-te-combo{width: px !important;}
			.goog-te-balloon-frame{display: none !important;}
			font{background: transparent !important;}
			a font:hover{ color:  !important;}
			#google_translate_element{height: 26px !important;overflow: hidden !important;}
			.goog-te-banner-frame{display: none !important;}
			body{top: 0px !important;}
		&lt;/style&gt; 

&lt;!-- Google Element Translator --&gt;
	&lt;div id="google_language_drop"&gt;
		&lt;div id="google_translate_element" class="-blank"&gt;&lt;/div&gt;
			&lt;script&gt;
				function googleTranslateElementInit() {
					new google.translate.TranslateElement({
						includedLanguages: 'en,de,af,sq,ar,hy,az,eu,be,bg,ca,zh-CN,zh-TW,hr,cs,da,nl,et,tl,fi,fr,gl,ka,el,ht,iw,hi,hu,is,id,ga,it,ja,ko,la,lv,lt,mk,ms,mt,no,fa,pl,pt,ro,ru,sr,sk,sl,es,sw,sv,th,tr,uk,ur,vi,cy,yi',
						pageLanguage: '&lt;?php echo $this-&gt;__('en') ?&gt;',
						gaTrack: true,
						gaId: 'UA-12345678-1'
					}, 'google_translate_element');
				}
			&lt;/script&gt;
		&lt;script src="https://translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"&gt;&lt;/script&gt;
	&lt;/div&gt;
&lt;/div&gt;</pre>
<p>The standard Google element translator code introduces a nasty looking frame at the top of translated pages and a few other stylings and images around the language drop down that we don&#8217;t want to see,  so we remove these first with some style elements. We then use the bog standard code from <a href="http://translate.google.com/translate_tools  ">Google </a>to include the element translator javascript which generates the country selection drop down box. You can specify which languages you want to include by editing the <em>includedLanguages </em>ISO two letter country codes. If you use Google Analytics then include your analytics account number to feed usage data into your Google Analytics account. If you have a multi language store remember to add a translation for &#8216;<em>en</em>&#8216; in your locale files to let Google know the language of the page it is translating (although if you leave this blank it will try and auto detect the language).</p>
<p>Save the new <em>languages.phtml</em> and refresh your site, you should see the new Select Language drop down box in the  site header, or whereever you placed the element translator within your sites Magento theme.</p>
<figure id="attachment_75" aria-describedby="caption-attachment-75" style="width: 530px" class="wp-caption aligncenter"><a href="https://blog.gaiterjones.com/wp-content/uploads/2011/02/google-translation-tool-integrated-with-magento-1-4-2.jpg"><img fetchpriority="high" decoding="async" class="hang-1-column   " style="border: 1px solid black;" title="Google Translation Tool Integrated With Magento 1.4.2" src="https://blog.gaiterjones.com/wp-content/uploads/2011/02/google-translation-tool-integrated-with-magento-1-4-2.jpg" alt="Google Translation Tool Integrated With Magento 1.4.2" width="530" height="532" /></a><figcaption id="caption-attachment-75" class="wp-caption-text">Google Translation Tool Integrated With Magento 1.4.2</figcaption></figure>
<p>If your site already has multi language stores then you will need to integrate the code into your existing language switcher. You might want to hide the Google translator for visitors with a browser language that matches your site, you don&#8217;t want customers trying to translate your site with Google when you have already perfectly translated it yourself! You can accomplish this by wrapping the Google code in a PHP <em>If</em> statement e.g. if your site is in German and English, hide the translator from German speaking visitors:</p>
<pre class="brush:php">&lt;?php if (Mage::app()-&gt;getStore()-&gt;getId()==ID NUMBER OF ENGLISH STORE): ?&gt;

&lt;!-- Google Element Translator --&gt;

&lt;?php endif ?&gt;</pre>
<p>Style the #google_translate_element DIV if you need to place it correctly within your theme. I prefer switching stores using clickable flags, and for our store implemented a &#8220;Google&#8221; language flag <img decoding="async" class="alignnone" style="margin-left: 2px; margin-right: 2px;" title="Google Translate Flag" src="https://blog.gaiterjones.com/wp-content/uploads/2011/02/google-translate.gif" alt="Google Translate Flag" width="18" height="18" /> that toggles the Google element translator DIV on or off for visitors with foreign language browsers &#8211;</p>
<pre class="brush:php">&lt;script type="text/javascript"&gt;
&lt;!--
function toggle_visibility(id) {
var e = document.getElementById(id);
if(e.style.display == 'block')
e.style.display = 'none';
else
e.style.display = 'block';
}
//--&gt;
&lt;/script&gt;

&lt;a href="#" onClick="toggle_visibility('google_translate_element');"&gt;&lt;img width="16" height="16" src="&lt;?php echo $this-&gt;getSkinUrl('images/google-translate.gif') ?&gt;" id="lang-flag-google" title="Google Translate - please note we are not responsible for the accuracy of translations made with this service." /&gt;&lt;/a&gt;</pre>
<p>Tested with Magento 1.3.3, 1.4.2 and 1.5.0.</p>
<p>This post is dedicated to <span style="text-decoration: underline;"><a href="http://www.nilerodgers.com/" target="_blank">Nile Rodgers</a>.</span></p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.gaiterjones.com/magento-google-translation-tool-implementation/feed/</wfw:commentRss>
			<slash:comments>23</slash:comments>
		
		
			</item>
	</channel>
</rss>
