show only one language translation using wordpress global translator plugin

Now a days you can see that almost all sites putting up translate to other language bars (probably country colors)
but if you are developing your website for your country ( if your country first language is not english) then you don’t need to put all language images, because your visitors don’t need other languages and it eats up your online real estate.

so, i have come with a solution for this.

showing single language in sigle post page
showing single language in sigle post page

in above pic, you can see that, iam giving option for translating my site into hindi just below title.

before doing this, you must know url path for each language,
if your site is english and your path is like http://site.com/post-title/
then when choose translated language to hindi, it becomes http://site.com/hi/post-title/
or if you choose japanese, url become http://site.com/ja/post-title/

when you use global translator in widgets, it do all the work for you but since we are trying to do in single post page,
we have to edit the url.

Editing URL

using php regular expressions, we have to change url.
for that we can use below code.

<!--?php 
$linkurl = get_permalink();
preg_match ('/(http:\/\/yoursite.com\/)(.*)/', "$linkurl", $matchesarray); ?-->

you can observer reverse slashes for // in http:// they are mandatory.
replace yoursite.com with your website name

now we need to put above code in single. php

open your theme single.php
you can find code like

<!--?php if(have_posts()) : while(have_posts()) : the_post(); ?-->

i.e. thats where the loop begins,

just below that, add above code.

implimenting
now above code returns $matchesarray array variable.

now put following code in single.php where ever you want to show text for trasnlation.

<!--?php echo "<a href='".$matchesarray[1]."hi/".$matchesarray[2]."'-->Read this page in hindi"; ?&gt;

if you have any questions, feel free to ask using below comment box, i will help you out.