Finally, I've coded a language translation tool for new blogger that translates a blog post page to different languages using Google Language Tool.
The unique features of this translation tool are,
a) It can switch between different languages on the current page i.e. without opening a new window for each language.
b) No outbound link for translation.
Source Code and Instruction for the same are as follows:-
Step 1: Goto Template -> Edit HTML tab and select 'Expand Widget Templates'.
Step 2: Find < div class="post-body">
Step 3: Add the translation code between
< div class="post-body">
and
< p>< data:post.body/>
Traslation code is given below
< b:if cond='data:blog.pageType == "item"'>
< div style='float:right'>
< script>
loc=location.href;
if(location.host!='etltechicalexpertiseblog.blogspot.com')
loc=loc.substring(loc.lastIndexOf('=')*1+6);
< /script>
< select align='center' name='to_lang' onchange='lp=this.options[this.selectedIndex ].value; if(lp!="") window.location=" http://google.com/translate_p? hl=en&ie=UTF-8&oe=UTF-8&u="+loc+"&langpair="+lp ;'>
< option value=''>Select Language
< option value='en|zh'>Chinese
< option value='en|ar'>Arabic
< option value='en|fr'>French
< option value='en|de'>German
< option value='en|it'>Italian
< option value='en|ja'>Japanese
< option value='en|ko'>Korean
< option value='en|pt'>Portuguese
< option value='en|ru'>Russian
< option value='en|es'>Spanish
< option value='en|en'>English
< /select>
< /div>
< /b:if>
Step 4: Save the template.
Preview this sample blog here that uses my translation technique.
Though machine translation may not be accurate, still it is quite handy to let readers read your blog in different languages.
No comments:
Post a Comment