<?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>Cnu.in &#187; wordpress site translation</title>
	<atom:link href="http://cnu.in/tag/wordpress-site-translation/feed" rel="self" type="application/rss+xml" />
	<link>http://cnu.in</link>
	<description>online &#38; offline journey of Cnu</description>
	<lastBuildDate>Mon, 08 Nov 2010 01:22:22 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>show only one language translation using wordpress global translator plugin</title>
		<link>http://cnu.in/wordpress/show-only-one-language-translation-using-wordpress-global-translator-plugin.php</link>
		<comments>http://cnu.in/wordpress/show-only-one-language-translation-using-wordpress-global-translator-plugin.php#comments</comments>
		<pubDate>Mon, 15 Jun 2009 07:23:39 +0000</pubDate>
		<dc:creator>seenu</dc:creator>
				<category><![CDATA[wordpress]]></category>
		<category><![CDATA[customozing global translator]]></category>
		<category><![CDATA[translate your site]]></category>
		<category><![CDATA[translate your site into hindi]]></category>
		<category><![CDATA[wordpress site translation]]></category>

		<guid isPermaLink="false">http://cnu.in/?p=9</guid>
		<description><![CDATA[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&#8217;t need to put all language images, because your visitors don&#8217;t need other languages [...]]]></description>
			<content:encoded><![CDATA[<p>Now a days you can see that almost all sites putting up translate to other language bars (probably country colors)<br />
but if you are developing your website for your country ( if your country first language is not english) then you don&#8217;t need to put all language images, because your visitors don&#8217;t need other languages and it eats up your online real estate.</p>
<p>so, i have come with a solution for this.</p>
<div id="attachment_12" class="wp-caption aligncenter" style="width: 330px"><img src="http://cnu.in/wp-content/uploads/2009/06/gt.JPG" alt="showing single language in sigle post page" title="gt" width="320" height="50" class="size-full wp-image-12" /><p class="wp-caption-text">showing single language in sigle post page</p></div>
<p>in above pic, you can see that, iam giving option for translating my site into hindi just below title.</p>
<p>before doing this, you must know url path for each language,<br />
if your site is english and your path is like http://site.com/post-title/<br />
then when choose translated language to hindi, it becomes http://site.com/hi/post-title/<br />
or if you choose japanese, url become http://site.com/ja/post-title/</p>
<p>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,<br />
we have to edit the url.</p>
<p><strong>Editing URL</strong></p>
<p>using php regular expressions, we have to change url.<br />
for that we can use below code.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000088;">$linkurl</span> <span style="color: #339933;">=</span> get_permalink<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">preg_match</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/(http:\/\/yoursite.com\/)(.*)/'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;<span style="color: #006699; font-weight: bold;">$linkurl</span>&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$matchesarray</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>you can observer reverse slashes for // in http:// they are mandatory.<br />
replace yoursite.com with your website name</p>
<p>now we need to put above code in single. php</p>
<p>open your theme single.php<br />
you can find code like</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span>have_posts<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> <span style="color: #b1b100;">while</span><span style="color: #009900;">&#40;</span>have_posts<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> the_post<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>i.e. thats where the loop begins,</p>
<p>just below that, add above code.</p>
<p><strong>implimenting</strong><br />
now above code returns $matchesarray array variable.</p>
<p>now put following code in single.php where ever you want to show text for trasnlation.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;&lt;a href='&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$matchesarray</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;hi/&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$matchesarray</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;'&gt;Read this page in hindi&lt;/a&gt;&quot;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>if you have any questions, feel free to ask using below comment box, i will help you out.</p>
]]></content:encoded>
			<wfw:commentRss>http://cnu.in/wordpress/show-only-one-language-translation-using-wordpress-global-translator-plugin.php/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

