Make Money

Freelance Jobs Freelance Jobs

8.11.11

How to prevent translation of a web page

Delicious Digg StumbleUpon Reddit Subscribe to RSS Feed



Online web page translation lets your blog reach a wider audience by allowing it to be translated into most languages. It breaks the language barrier…well, sort of. There’s even a translator widget that can be added to your blog that automatically translates a page on a single click.
Having said that, some contents are best left in the original language. To name a few: your blog title (if you use text as title), names, addresses, song lyrics, book or movie titles and codes.
How then can you prevent them from being translated? Below are a few ways you can do that:


a) Block an entire page

You can prevent an entire page from being translated by adding this meta tag in the head section (before the </head> tag) of the page:
<meta name="google" content="notranslate"/>
With the meta tag in place, a translator simply returns an blank output.
Note: On Blogger, adding just the meta tag in template HTML will block the whole blog. To target the page you want to block, you need to wrap the meta tag in a conditional tag

b) Exclude sections of a Blogger blog

To exclude a section of your blog page from being translated. Just go to Design > Edit HTML, check the Expand Widget Templates checkbox and add class="notranslate" to the HTML element that represents the section. Here are a few examples:
  • Blog title Look for this line:
    <h1 class='title'>

    and add the notranslate class name like this:
    <h1 class='title notranslate'>
  • Content of a widget Locate the widget, and look for this line:
    <div class='widget-content'>

    and replace it with this:
    <div class='widget-content notranslate'>

c) Exclude parts of a post

Go to the post and switch to HTML mode and locate the text you want to exclude from translation.
  • For regular texts Wrap it in a span tag and add a class="notranslate" attribute to the tag.
    For example, the following markup will prevent the movie titles from being translated:
    My favorites movies are <span class="notranslate">Citizen Kane, The Shawshank Redemption and The Fugitive</span>.
  • For codes You can also use the <code> tag for codes:
    <code>PUT CODE HERE</code>
    The tag is prevented from translation by default, no notranslate class is required.
All methods explained above should work on Google Translate and Bing Translator, however none of them work on Yahoo! Babel Fish translator.
Enjoy!
comment and share to your friends!


0 reactions:

Post a Comment

 

HOW TO HACK Copyright © 2010 LKart Theme is Designed by Lasantha