<?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>DALLASCAO.COM &#187; World Wide Web</title>
	<atom:link href="http://dallascao.com/en/category/world-wide-web/feed/" rel="self" type="application/rss+xml" />
	<link>http://dallascao.com/en</link>
	<description>Site of Dallas Cao, English to Chinese translator</description>
	<lastBuildDate>Tue, 06 Jul 2010 18:08:38 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>GT4T review by Riccardo</title>
		<link>http://dallascao.com/en/gt4t-review-by-riccardo/</link>
		<comments>http://dallascao.com/en/gt4t-review-by-riccardo/#comments</comments>
		<pubDate>Sat, 05 Jun 2010 12:28:36 +0000</pubDate>
		<dc:creator>Dallas</dc:creator>
				<category><![CDATA[World Wide Web]]></category>
		<category><![CDATA[Google Translate]]></category>
		<category><![CDATA[GT4T]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[tools for translators]]></category>

		<guid isPermaLink="false">http://dallascao.com/en/?p=758</guid>
		<description><![CDATA[Written by Riccardo posted at http://thoughtsontranslation.com/2010/01/25/reader-survey-the-best-and-worst-things-about-your-cat-tools/
Pros: If you want to speed up your translation by taking advantage of Google Translate’s suggestions, this tool allows you to do it from within any program you are using to translate: just select the sentence to translate, hit Ctrl+J, and the selected source text is replaced by the Google [...]]]></description>
			<content:encoded><![CDATA[<p>Written by <a href="http://go2.wordpress.com/?id=725X1342&amp;site=corinnemckay.wordpress.com&amp;url=http%3A%2F%2Faboutranslation.blogspot.com%2F&amp;sref=http%3A%2F%2Fthoughtsontranslation.com%2F2010%2F01%2F25%2Freader-survey-the-best-and-worst-things-about-your-cat-tools%2F" target="_blank">Riccardo</a> posted at <a href="http://thoughtsontranslation.com/2010/01/25/reader-survey-the-best-and-worst-things-about-your-cat-tools/" target="_blank">http://thoughtsontranslation.com/2010/01/25/reader-survey-the-best-and-worst-things-about-your-cat-tools/</a></p>
<p><a href="http://thoughtsontranslation.com/2010/01/25/reader-survey-the-best-and-worst-things-about-your-cat-tools/" target="_blank"></a>Pros: If you want to speed up your translation by taking advantage of Google Translate’s suggestions, this tool allows you to do it from within any program you are using to translate: just select the sentence to translate, hit Ctrl+J, and the selected source text is replaced by the Google translation. I tested it from within Workbench (using both the Word and the Tag Editor interfaces), and from within SDLX. It works, and can help speeding up your translation. The tool is cheap, and allows for a generous trial period.</p>
<p>Cons: Apart from the obvious (the quality of the MT provided), the tool sometime only translates parts of the text, if the selection is too long. Also, concerns have been voiced about the use Google will make of the texts you pass through their translation engine, and they also apply if the text is processed by Google through another interface such as this one.</p>
<p>As regards the quality of the MT provided by Google, your mileage may vary, depending on the type of text and language pair. In some fields I find it is good enough as a first rough draft. In others it is still quite useless.</p>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://dallascao.com/en/opening-pdf-files-with-coreldraw/" rel="bookmark" class="crp_title">Opening PDF files with CorelDraw</a></li><li><a href="http://dallascao.com/en" rel="bookmark" class="crp_title">home</a></li><li><a href="http://dallascao.com/en/surprise/" rel="bookmark" class="crp_title">Surprise!</a></li><li><a href="http://dallascao.com/en/chinese-friendfeedcom-receives-favorable-feedbacks-from-fans/" rel="bookmark" class="crp_title">Chinese friendfeed.com receives favorable feedbacks from fans</a></li><li><a href="http://dallascao.com/en/homezz-com-celebrating-one-year-anniversary-of-service/" rel="bookmark" class="crp_title">Homezz.com: celebrating one-year anniversary of service</a></li><li>Powered by <a href="http://ajaydsouza.com/wordpress/plugins/contextual-related-posts/">Contextual Related Posts</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://dallascao.com/en/gt4t-review-by-riccardo/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Use regular expressions in .htaccess for redirections</title>
		<link>http://dallascao.com/en/use-regular-expressions-in-htaccess-for-redirections/</link>
		<comments>http://dallascao.com/en/use-regular-expressions-in-htaccess-for-redirections/#comments</comments>
		<pubDate>Fri, 14 May 2010 17:30:04 +0000</pubDate>
		<dc:creator>Dallas</dc:creator>
				<category><![CDATA[Coding Frenzy]]></category>
		<category><![CDATA[World Wide Web]]></category>
		<category><![CDATA[.htaccess]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[regular expressions]]></category>

		<guid isPermaLink="false">http://dallascao.com/en/?p=744</guid>
		<description><![CDATA[Task one:
Apache server provides a .htaccess file using which you can use to redirect URLs. For example, if you want to redirect all visitors to http://dallascao.com/cn/ to http://dallascao.com/en/, you can open the .htaccess file at the root, and then input:

RewriteRule ^cn\/?$ en\/

Translating the code in English, it means &#8220;Please replace &#8216;^cn\/?$&#8217; with &#8216;en/&#8217;&#8221;.   [...]]]></description>
			<content:encoded><![CDATA[<h2>Task one:</h2>
<p>Apache server provides a .htaccess file using which you can use to redirect URLs. For example, if you want to redirect all visitors to http://dallascao.com/cn/ to http://dallascao.com/en/, you can open the .htaccess file at the root, and then input:</p>

<div class="wp_syntax"><div class="code"><pre class="perl" style="font-family:monospace;">RewriteRule <span style="color: #339933;">^</span>cn\<span style="color: #339933;">/?</span>$ en\<span style="color: #339933;">/</span></pre></div></div>

<p>Translating the code in English, it means &#8220;Please replace &#8216;^cn\/?$&#8217; with &#8216;en/&#8217;&#8221;.   &#8220;^cn\/?$&#8221; is a regular expression, in which:</p>
<p>&#8220;^&#8221; matches the beginning of a string.<br />
&#8220;$&#8221; matches the end.<br />
&#8220;\&#8221; means &#8220;/&#8221; following it stands for &#8220;/&#8221; itself, not part of the grammar.<br />
&#8220;?&#8221; means there can be one &#8220;/&#8221; or no &#8220;/&#8221;</p>
<p>So  &#8220;^cn\/?$&#8221; matches two strings: &#8220;cn/&#8221; or &#8220;cn&#8221;. When visitors visit http://dallascao.com/cn/ (end with a slash) or http://dallascao.com/cn (end with no slash), they are redirected to http://dallascao.com/en/</p>
<h2>Task two:</h2>
<p>If you want to redirect all visitors to the root of http://dallascao.com/ to http://dallascao.com/en/, I can use this:</p>

<div class="wp_syntax"><div class="code"><pre class="perl" style="font-family:monospace;">RewriteRule <span style="color: #339933;">^</span>$ en\<span style="color: #339933;">/</span></pre></div></div>

<p>&#8220;^$&#8221; matches an empty string, meaning the root.</p>
<h2>Task three:</h2>
<p>Inputting the following code into the .htaccess of http://gt4t.net/, all visitors to http://gt4t.net/anything/ to http://gt4t.net/en/anything/. For example, visitors to http://gt4t.net/downloads/ will be redirected to http://gt4t.net/en/downloads.</p>

<div class="wp_syntax"><div class="code"><pre class="perl" style="font-family:monospace;">RewriteRule <span style="color: #339933;">^</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">.*?</span><span style="color: #009900;">&#41;</span>\<span style="color: #339933;">/?</span>$ \<span style="color: #339933;">/</span>en\<span style="color: #339933;">/</span><span style="color: #0000ff;">$1</span></pre></div></div>

<p>&#8220;^(.*?)\/?$&#8221; means anything that either ends with one &#8220;/&#8221; or no &#8220;/&#8221;. In the second part, &#8220;\/en\/$1&#8243;, &#8220;$1&#8243; stands for the 1st bracketed element in the previous string &#8220;^(.*?)\/?$&#8221; (in this case, the only bracketed element.). And it means replacing &#8220;ANYTHING&#8221; ending with &#8220;/&#8221; or no &#8220;/&#8221; with &#8220;/en/ANYTHING/&#8221;</p>
<p>By the way, if you want your redirection to be hidden, you can add the following option to the beginng .</p>

<div class="wp_syntax"><div class="code"><pre class="perl" style="font-family:monospace;">Options <span style="color: #339933;">+</span>FollowSymLinks</pre></div></div>

<p>In the example above, your visitors to http://gt4t.net/downloads is redirected to http://gt4t.net/gt4t_en/downloads/ but http://gt4t.net/downloads is still shown in the address bar.</p>
<p>Finally, here is  is the complete .htaccess file:</p>

<div class="wp_syntax"><div class="code"><pre class="perl" style="font-family:monospace;">RewriteEngine on
Options <span style="color: #339933;">+</span>FollowSymLinks
&nbsp;
RewriteCond <span style="color: #339933;">%</span><span style="color: #009900;">&#123;</span>HTTP_HOST<span style="color: #009900;">&#125;</span> <span style="color: #339933;">^</span>gt4t<span style="color: #339933;">.</span>net$ <span style="color: #009900;">&#91;</span>OR<span style="color: #009900;">&#93;</span>
RewriteCond <span style="color: #339933;">%</span><span style="color: #009900;">&#123;</span>HTTP_HOST<span style="color: #009900;">&#125;</span> <span style="color: #339933;">^</span>www<span style="color: #339933;">.</span>gt4t<span style="color: #339933;">.</span>net$
RewriteRule <span style="color: #339933;">^</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">.*?</span><span style="color: #009900;">&#41;</span>\<span style="color: #339933;">/?</span>$ \<span style="color: #339933;">/</span>gt4t_en\<span style="color: #339933;">/</span><span style="color: #0000ff;">$1</span> <span style="color: #009900;">&#91;</span>L<span style="color: #009900;">&#93;</span></pre></div></div>

<p>Confused? <a href="http://dallascao.com/en/contact-dallas/">Contact me</a> if you have such a need. I will be happy to help you.</p>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://dallascao.com/en/use-of-if-fields/" rel="bookmark" class="crp_title">Use of If field in Microsoft Word</a></li><li><a href="http://dallascao.com/en/use-cookies-to-remember/" rel="bookmark" class="crp_title">Use cookies to remember the language version users visited last time (php code)</a></li><li><a href="http://dallascao.com/en/autohotkey-disable-the-close-button-x-of-a-gui-window/" rel="bookmark" class="crp_title">Autohotkey: Disable the close button [X] of a GUI window</a></li><li><a href="http://dallascao.com/en/the-context-sensitive-language-versions-link/" rel="bookmark" class="crp_title">The context sensitive Language Versions link</a></li><li><a href="http://dallascao.com/en/google-dictionary-for-word-gd4word/" rel="bookmark" class="crp_title">Google Dictionary for Word (GD4Word)</a></li><li>Powered by <a href="http://ajaydsouza.com/wordpress/plugins/contextual-related-posts/">Contextual Related Posts</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://dallascao.com/en/use-regular-expressions-in-htaccess-for-redirections/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The coolest country in the world</title>
		<link>http://dallascao.com/en/google-discovered-uninhabited-land-just-northeast-of-china/</link>
		<comments>http://dallascao.com/en/google-discovered-uninhabited-land-just-northeast-of-china/#comments</comments>
		<pubDate>Sun, 22 Nov 2009 03:48:03 +0000</pubDate>
		<dc:creator>Dallas</dc:creator>
				<category><![CDATA[World Wide Web]]></category>
		<category><![CDATA[google map]]></category>
		<category><![CDATA[North Korea]]></category>

		<guid isPermaLink="false">http://dallascao.com/en/?p=446</guid>
		<description><![CDATA[Google gave this land a name North Korea due to the fact that it is to the north of Korea.]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><img class="aligncenter size-full wp-image-447" title="Capture" src="http://dallascao.com/en/wp-content/uploads/2009/11/Capture.jpg" alt="Capture" width="448" height="401" /></p>
<p>Google maps shows it is largely uninhabited. Google gave this land a name North Korea due to the fact that it is to the north of Korea.</p>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://dallascao.com/en/google-map-translates-toll-gate-as-shoufei-station/" rel="bookmark" class="crp_title">google map translates &#8220;toll gate&#8221; as &#8220;Shoufei Station&#8221;</a></li><li><a href="http://dallascao.com/en/a-list-of-country-names/" rel="bookmark" class="crp_title">A list of country names (English to Chinese Trados TM)</a></li><li><a href="http://dallascao.com/en/use-more-keyboards-to-relieve-rsi/" rel="bookmark" class="crp_title">Suffer from RSI? Use more than one keyboard!</a></li><li><a href="http://dallascao.com/en/use-of-if-fields/" rel="bookmark" class="crp_title">Use of If field in Microsoft Word</a></li><li><a href="http://dallascao.com/en/advertising-gt4t-on-proz-com/" rel="bookmark" class="crp_title">Advertising GT4T on proz.com</a></li><li>Powered by <a href="http://ajaydsouza.com/wordpress/plugins/contextual-related-posts/">Contextual Related Posts</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://dallascao.com/en/google-discovered-uninhabited-land-just-northeast-of-china/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to start a public wave</title>
		<link>http://dallascao.com/en/how-to-start-a-public-wave/</link>
		<comments>http://dallascao.com/en/how-to-start-a-public-wave/#comments</comments>
		<pubDate>Tue, 10 Nov 2009 11:55:40 +0000</pubDate>
		<dc:creator>Dallas</dc:creator>
				<category><![CDATA[World Wide Web]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[google wave]]></category>

		<guid isPermaLink="false">http://dallascao.com/en/?p=403</guid>
		<description><![CDATA[1. add public@a.gwave.com (not googlewave!) to your contacts in the lower left, using the (+) next to "Manage contacts".

It will say the account doesn't exist, PRESS the Enter Key to add anyway! (not click the button)

2. Add this public contact to a wave you want to have be made public

3. A Yellow/Beige bar will appear saying "Everyone has access to this wave." This means the wave is public.]]></description>
			<content:encoded><![CDATA[<p>GoogleWave has caused much noise among geeks.  <a href="http://www.lizunlong.com/">Li Zunlong</a> spared me an invitation and I finally got my google wave account. I logged in and out and nothing seemed to happen until today when I learnt how to search for public Wave. It is exciting! Well, I am not sure it is a revolution yet, but it certainly is very different from any existing web-based applications!</p>
<p>Very soon I wanted to start a public wave (topic) myself. I searched google and found nothing and I searched inside GoogleWave and found this (sorry that I don&#8217;t know who this article should be attributed to):</p>
<p><span style="font-size: 1.75em; font-weight: bold;">How To Find Public Waves</span></p>
<p>you search <span style="font-weight: bold;">group:public@a.gwave.com</span><span style="font-weight: bold; font-style: italic;">. </span>To find only English waves search <span style="font-weight: bold;">lang:en</span>. Add tags to refine your search: <span style="font-weight: bold;">tag:wavedev</span><span style="font-weight: bold; font-style: italic;"> </span>for example. (Add your friends to this wave so they can see these directions.). See step 4 below for a list of tags you can search. You can remove blogger posts with -with:blog-wave@appspot.com.</p>
<p>You can also search for &#8220;with:public&#8221; to read all the WAAVVVESS.</p>
<p>If you are just getting started and need help, try searching <span style="font-weight: bold;">group:wavehelp@googlegroups.com</span></p>
<p><strong>How To Make Public Waves</strong></p>
<p>1. add <span style="font-weight: bold;">public@a.gwave.com</span><span style="font-weight: bold; font-style: italic;"> </span><span style="font-style: italic;">(not googlewave!)</span> to your contacts in the lower left, using the <span style="background-color: #cccccc;">(+)</span> next to &#8220;Manage contacts&#8221;.</p>
<p>It will say the account doesn&#8217;t exist, <span style="background-color: #ffe500;">PRESS the </span><span style="background-color: #ffe500; font-weight: bold;">Enter Key</span><span style="background-color: #ffe500;"> to add anyway! (not click the button)</span></p>
<p>2. Add this public contact to a wave you want to have be made public</p>
<p>3. A Yellow/Beige bar will appear saying &#8220;Everyone has access to this wave.&#8221; This means the wave is public.</p>
<p>4. None of the above work for some users due to yet another <a style="font-family: arial, sans-serif; color: #003ea8;" href="http://www.google.com/support/forum/p/wave/thread?tid=340bf91882d8619d&amp;hl=en" target="_blank">bug.</a> A good workaround is to add<span style="font-weight: bold;"> </span><span style="font-weight: bold; font-family: arial, 'san serif';">easypublic@appspot.com</span><span style="font-family: arial, 'san serif';"> instead.</span></p>
<h2></h2>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://dallascao.com/en/interview-moving-beyond-%e2%80%9cgarbage-in-garbage-out%e2%80%9d-translations/" rel="bookmark" class="crp_title">Interview: Moving Beyond “Garbage In-Garbage Out” Translations</a></li><li><a href="http://dallascao.com/en/font-problem-with-trados-translators-workbench/" rel="bookmark" class="crp_title">Font problem with TRADOS Translator&#8217;s Workbench</a></li><li><a href="http://dallascao.com/en/gt4t/" rel="bookmark" class="crp_title">Google Translate for Translators (GT4T)</a></li><li><a href="http://dallascao.com/en/google-dictionary-for-word-gd4word/" rel="bookmark" class="crp_title">Google Dictionary for Word (GD4Word)</a></li><li><a href="http://dallascao.com/en/major-projects/" rel="bookmark" class="crp_title">projects</a></li><li>Powered by <a href="http://ajaydsouza.com/wordpress/plugins/contextual-related-posts/">Contextual Related Posts</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://dallascao.com/en/how-to-start-a-public-wave/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Paste plain text in Word, any in any applications using GT4T</title>
		<link>http://dallascao.com/en/paste-plain-text-in-word/</link>
		<comments>http://dallascao.com/en/paste-plain-text-in-word/#comments</comments>
		<pubDate>Thu, 29 Oct 2009 15:35:55 +0000</pubDate>
		<dc:creator>Dallas</dc:creator>
				<category><![CDATA[World Wide Web]]></category>

		<guid isPermaLink="false">http://dallascao.com/en/?p=323</guid>
		<description><![CDATA[Copy/paste – I know pasting text with format information (e.g. fonts, color, size etc) is an important feature, but probably around 9 out of 10 times we need only to paste the plain text so the text fits into the position pasted. You can paste plain text with Word, to do that,
in Word 2003, click [...]]]></description>
			<content:encoded><![CDATA[<p>Copy/paste – I know pasting text with format information (e.g. fonts, color, size etc) is an important feature, but probably around 9 out of 10 times we need only to paste the plain text so the text fits into the position pasted. You can paste plain text with Word, to do that,</p>
<p>in Word 2003, click Edit-&gt;Selective Paste-&gt;plain text.</p>
<p>You can also use the keyboard – ALT+E, L and then select.</p>
<p>I always wonder why Microsoft doesn&#8217;t make it easier. Why isn&#8217;t there a direct keyboard short cut to such an useful operation? Microsoft doesn&#8217;t provide a shortcut, but you can create one yourself:</p>
<p>With Word 2003:</p>
<p>Go to Tools-&gt;Macro-&gt;Visual Basic Editor-&gt;Right click on Normal and then click Insert&#8211;&gt;Module. Copy and paste the following code to that Module and save.</p>

<div class="wp_syntax"><div class="code"><pre class="vb" style="font-family:monospace;"><span style="color: #000080;">Sub</span> PastePlain()
Selection.PasteAndFormat (wdFormatPlainText)
<span style="color: #000080;">End</span> <span style="color: #000080;">Sub</span></pre></div></div>

<p>Now you have created a small macro named PastePlain. The next step is to create a shortcut to that macro: In Word 2003, Click tools -&gt;customize-&gt;commands-&gt;Keyboard button. Select Macros in the Categories list, choose PastePlain, click &#8220;Press new shortcut&#8221; box and press down a key combination like ALT+V.</p>
<p>Next time you you copy some text, you can use the usual CTRL+V to paste rich text, and ALT+V to paste plain text.</p>
<p>However, your shortcut will only work within Word. To paste plain text in all applications, (pasting a table on a webpage to Excel, for example), you can download the new version of <a href="http://dallascao.com/en/2009/10/google-translate-for-microsoft-word-gt4word-beta/">GT4T</a>. The pasting plain text and checking Google Dictionary features of GT4T are  free, which means you will never get the payment request notice if you only use them.</p>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://dallascao.com/en/google-dictionary-for-word-gd4word/" rel="bookmark" class="crp_title">Google Dictionary for Word (GD4Word)</a></li><li><a href="http://dallascao.com/en/plaintext/" rel="bookmark" class="crp_title">PlainText 1.10</a></li><li><a href="http://dallascao.com/en/how-to-assign-a-keyboard-shortcut-to-a-macro-in-word-2003-and-word-2007/" rel="bookmark" class="crp_title">How to assign a keyboard shortcut to a macro in Word 2003 and Word 2007</a></li><li><a href="http://dallascao.com/en/use-of-if-fields/" rel="bookmark" class="crp_title">Use of If field in Microsoft Word</a></li><li><a href="http://dallascao.com/en/why-gt4t-is-useful-to-you/" rel="bookmark" class="crp_title">Why GT4T is useful to you?</a></li><li>Powered by <a href="http://ajaydsouza.com/wordpress/plugins/contextual-related-posts/">Contextual Related Posts</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://dallascao.com/en/paste-plain-text-in-word/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Shortcut to open a link in a new tab instead of a new window</title>
		<link>http://dallascao.com/en/open-a-link-in-a-new-tab/</link>
		<comments>http://dallascao.com/en/open-a-link-in-a-new-tab/#comments</comments>
		<pubDate>Sat, 01 Aug 2009 16:07:51 +0000</pubDate>
		<dc:creator>Dallas</dc:creator>
				<category><![CDATA[Coding Frenzy]]></category>
		<category><![CDATA[World Wide Web]]></category>
		<category><![CDATA[browsers]]></category>
		<category><![CDATA[Chrome]]></category>
		<category><![CDATA[Firefox]]></category>
		<category><![CDATA[IE]]></category>

		<guid isPermaLink="false">http://dallascao.com/en/?p=168</guid>
		<description><![CDATA[Ctrl+click or press the middle button of your mouse to force open a link in a new tab. It should work in IE, chrome and Firefox. Sadly when tabs get popular with browsers, the HTML standard still lags behind and it seems that web designers are not able to define whether a link should open [...]]]></description>
			<content:encoded><![CDATA[<p>Ctrl+click or press the middle button of your mouse to force open a link in a new tab. It should work in IE, chrome and Firefox. <span id="more-168"></span>Sadly when tabs get popular with browsers, the HTML standard still lags behind and it seems that web designers are not able to define whether a link should open in a new window or a new tab.</p>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://dallascao.com/en/friendfeedtranslate/" rel="bookmark" class="crp_title">friendfeedTranslate: script that translate all languages on a page into one language</a></li><li><a href="http://dallascao.com/en/the-context-sensitive-language-versions-link/" rel="bookmark" class="crp_title">The context sensitive Language Versions link</a></li><li><a href="http://dallascao.com/en/autohotkey-disable-the-close-button-x-of-a-gui-window/" rel="bookmark" class="crp_title">Autohotkey: Disable the close button [X] of a GUI window</a></li><li><a href="http://dallascao.com/en/business-opportunities-from-chinas-great-firewall/" rel="bookmark" class="crp_title">Business opportunities from China&#8217;s Great Firewall</a></li><li><a href="http://dallascao.com/en/font-problem-with-trados-translators-workbench/" rel="bookmark" class="crp_title">Font problem with TRADOS Translator&#8217;s Workbench</a></li><li>Powered by <a href="http://ajaydsouza.com/wordpress/plugins/contextual-related-posts/">Contextual Related Posts</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://dallascao.com/en/open-a-link-in-a-new-tab/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Use cookies to remember the language version users visited last time (php code)</title>
		<link>http://dallascao.com/en/use-cookies-to-remember/</link>
		<comments>http://dallascao.com/en/use-cookies-to-remember/#comments</comments>
		<pubDate>Thu, 30 Jul 2009 17:56:59 +0000</pubDate>
		<dc:creator>Dallas</dc:creator>
				<category><![CDATA[Coding Frenzy]]></category>
		<category><![CDATA[World Wide Web]]></category>
		<category><![CDATA[codes]]></category>
		<category><![CDATA[cookies]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://dallascao.com/en/?p=159</guid>
		<description><![CDATA[This site is bilingual. http://dallascao.com/cn/ is the Chinese version and http://dallscao.com/en/ is the English version. When you visit http://dallascao.com/, you are directed to either /cn/ or /en/ according to the default language of your browser or the version you visited last time. The site uses cookies to remember the version you visited last time and [...]]]></description>
			<content:encoded><![CDATA[<p>This site is bilingual. http://dallascao.com/cn/ is the Chinese version and http://dallscao.com/en/ is the English version. When you visit http://dallascao.com/, you are directed to either /cn/ or /en/ according to the default language of your browser or the version you visited last time. <span id="more-159"></span>The site uses cookies to remember the version you visited last time and direct you to that version when you visit again. If it is the first time to visit, you will open the version that matches your browser language.</p>
<p>To do this, you need to edit the header.php of the English version under the /en/ folder and add the following code before the <html><head> tag:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">&lt;!--set permanent cookie --&gt;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> 
<span style="color: #990000;">setcookie</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;lang&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;en&quot;</span><span style="color: #339933;">,</span> <span style="color: #990000;">time</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">+</span><span style="color: #cc66cc;">94608000</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;/&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;.dallascao.com&quot;</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>This code writes a variable &#8220;lang&#8221; on your computer and assigns a value &#8220;en&#8221;. 94608000 is the expiration time (3 years). &#8220;/&#8221; and &#8220;.dallascao.com&#8221; means it works from the root directory of dallascao.com and its subdomains. Inserting this code into header.php means that when you visit any page of the English version, your visit will be remembered.</p>
<p>Likewise, you need to insert the following code into the header.php of the Chinese version.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">&lt;!--set permanent cookie --&gt;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> 
<span style="color: #990000;">setcookie</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;lang&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;cn&quot;</span><span style="color: #339933;">,</span> <span style="color: #990000;">time</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">+</span><span style="color: #cc66cc;">94608000</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;/&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;.dallascao.com&quot;</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>It means when you visit the Chinese version, the variable &#8220;lang&#8221; will be assigned the value of &#8220;cn&#8221;.</p>
<p>At last, Create an index.php at the root containing the following 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;">$lang</span><span style="color: #339933;">=</span><span style="color: #000088;">$_COOKIE</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;lang&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">switch</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$lang</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
<span style="color: #b1b100;">case</span> <span style="color: #0000ff;">'cn'</span><span style="color: #339933;">:</span>
<span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Location:  http://dallascao.com/cn'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">break</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">case</span> <span style="color: #0000ff;">'en'</span><span style="color: #339933;">:</span>
<span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Location:  http://dallascao.com/en'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">break</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">#Get the default language of the browser if no cookies are found.
</span><span style="color: #b1b100;">default</span><span style="color: #339933;">:</span>
	<span style="color: #000088;">$lang</span> <span style="color: #339933;">=</span> getDefaultLanguage<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
	<span style="color: #b1b100;">switch</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$lang</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> 
       <span style="color: #b1b100;">case</span> <span style="color: #0000ff;">'zh-cn'</span> <span style="color: #339933;">:</span> 
               <span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Location:  http://dallascao.com/cn'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
               <span style="color: #b1b100;">break</span><span style="color: #339933;">;</span> 
       <span style="color: #b1b100;">default</span><span style="color: #339933;">:</span> 
	          <span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Location: http://dallascao.com/en'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
              <span style="color: #b1b100;">break</span><span style="color: #339933;">;</span> 
		<span style="color: #009900;">&#125;</span> 
<span style="color: #b1b100;">break</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span>
&nbsp;
&nbsp;
&nbsp;
<span style="color: #666666; font-style: italic;">#########################################################
</span><span style="color: #666666; font-style: italic;"># Copyright ? 2008 Darrin Yeager                        #
</span><span style="color: #666666; font-style: italic;"># http://www.dyeager.org/                               #
</span><span style="color: #666666; font-style: italic;"># Licensed under BSD license.                           #
</span><span style="color: #666666; font-style: italic;">#   http://www.dyeager.org/downloads/license-bsd.php    #
</span><span style="color: #666666; font-style: italic;">#########################################################
</span>
<span style="color: #000000; font-weight: bold;">function</span> getDefaultLanguage<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
   <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;HTTP_ACCEPT_LANGUAGE&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
      <span style="color: #b1b100;">return</span> parseDefaultLanguage<span style="color: #009900;">&#40;</span><span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;HTTP_ACCEPT_LANGUAGE&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
   <span style="color: #b1b100;">else</span>
      <span style="color: #b1b100;">return</span> parseDefaultLanguage<span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">NULL</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
   <span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> parseDefaultLanguage<span style="color: #009900;">&#40;</span><span style="color: #000088;">$http_accept</span><span style="color: #339933;">,</span> <span style="color: #000088;">$deflang</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;en&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
   <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$http_accept</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #990000;">strlen</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$http_accept</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&gt;</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span>  <span style="color: #009900;">&#123;</span>
      <span style="color: #666666; font-style: italic;"># Split possible languages into array
</span>      <span style="color: #000088;">$x</span> <span style="color: #339933;">=</span> <span style="color: #990000;">explode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;,&quot;</span><span style="color: #339933;">,</span><span style="color: #000088;">$http_accept</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$x</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$val</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
         <span style="color: #666666; font-style: italic;">#check for q-value and create associative array. No q-value means 1 by rule
</span>         <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">preg_match</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;/(.*);q=([0-1]{0,1}\.\d{0,4})/i&quot;</span><span style="color: #339933;">,</span><span style="color: #000088;">$val</span><span style="color: #339933;">,</span><span style="color: #000088;">$matches</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
            <span style="color: #000088;">$lang</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$matches</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>float<span style="color: #009900;">&#41;</span><span style="color: #000088;">$matches</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: #b1b100;">else</span>
            <span style="color: #000088;">$lang</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$val</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color:#800080;">1.0</span><span style="color: #339933;">;</span>
      <span style="color: #009900;">&#125;</span>
&nbsp;
      <span style="color: #666666; font-style: italic;">#return default language (highest q-value)
</span>      <span style="color: #000088;">$qval</span> <span style="color: #339933;">=</span> <span style="color:#800080;">0.0</span><span style="color: #339933;">;</span>
      <span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$lang</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$key</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$value</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
         <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$value</span> <span style="color: #339933;">&gt;</span> <span style="color: #000088;">$qval</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #000088;">$qval</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>float<span style="color: #009900;">&#41;</span><span style="color: #000088;">$value</span><span style="color: #339933;">;</span>
            <span style="color: #000088;">$deflang</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$key</span><span style="color: #339933;">;</span>
         <span style="color: #009900;">&#125;</span>
      <span style="color: #009900;">&#125;</span>
   <span style="color: #009900;">&#125;</span>
   <span style="color: #b1b100;">return</span> <span style="color: #990000;">strtolower</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$deflang</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
&nbsp;
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://dallascao.com/en/use-regular-expressions-in-htaccess-for-redirections/" rel="bookmark" class="crp_title">Use regular expressions in .htaccess for redirections</a></li><li><a href="http://dallascao.com/en/use-of-if-fields/" rel="bookmark" class="crp_title">Use of If field in Microsoft Word</a></li><li><a href="http://dallascao.com/en/the-context-sensitive-language-versions-link/" rel="bookmark" class="crp_title">The context sensitive Language Versions link</a></li><li><a href="http://dallascao.com/en/major-projects/" rel="bookmark" class="crp_title">projects</a></li><li><a href="http://dallascao.com/en/autohotkey-disable-the-close-button-x-of-a-gui-window/" rel="bookmark" class="crp_title">Autohotkey: Disable the close button [X] of a GUI window</a></li><li>Powered by <a href="http://ajaydsouza.com/wordpress/plugins/contextual-related-posts/">Contextual Related Posts</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://dallascao.com/en/use-cookies-to-remember/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>friendfeedTranslate: script that translate all languages on a page into one language</title>
		<link>http://dallascao.com/en/friendfeedtranslate/</link>
		<comments>http://dallascao.com/en/friendfeedtranslate/#comments</comments>
		<pubDate>Thu, 30 Jul 2009 06:36:53 +0000</pubDate>
		<dc:creator>Dallas</dc:creator>
				<category><![CDATA[Coding Frenzy]]></category>
		<category><![CDATA[Translations]]></category>
		<category><![CDATA[World Wide Web]]></category>
		<category><![CDATA[friendfeed.com]]></category>
		<category><![CDATA[greasemonkey]]></category>
		<category><![CDATA[Translaterize]]></category>

		<guid isPermaLink="false">http://dallascao.com/en/?p=154</guid>
		<description><![CDATA[In another post, I said it would be cool if we can translate contents of different languages on a page into one language. This now has become a reality: Micah Wittman created this tool using Google translate API that makes the translation only one click away.

I have tested on other browsers but I made it [...]]]></description>
			<content:encoded><![CDATA[<p>In another post, I said it would be cool if we can translate contents of different languages on a page into one language. This now has become a reality: <a href="http://wittman.org/about/" target=_blank>Micah Wittman</a> created this tool using Google translate API that makes the translation only one click away.<br />
<span id="more-154"></span><br />
I have tested on other browsers but I made it work on FireFox.</p>
<p>On FireFox, you need first install <a href="https://addons.mozilla.org/zh-CN/firefox/addon/748">Greasemonkey </a>plugin. Then you go to <a href="http://wittman.org/projects/friendfeedtranslate/install/" target=_blank>http://wittman.org/projects/friendfeedtranslate/install/</a> and click on one of the <img src="http://wittman.org/projects/friendfeedtranslate/fftranslate-bookmarklet.png" alt="friendfeed Translate" /> buttons. Then an &#8220;Translate X to English (or to any other languages)&#8221; button will appear on the right top corner of your friendfeed. Click that button and all the contents on the page you are viewing will be translated into English.&#8221;</p>
<p><img src="http://friendfeed-media.com/fe75f76e2e15553f18b3db1f6eed47c72c676b84" alt="friendfeed Translate" /></p>
<p>FriendfeedTranslate is part of a project called <a href="http://translatorize.com/for/">Translaterize</a>, which also includes &#8220;Translaterize for Facebook.&#8221;</p>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://dallascao.com/en/language-filter-for-friendfeedcom/" rel="bookmark" class="crp_title">Language filter for friendfeed.com?</a></li><li><a href="http://dallascao.com/en/chinese-friendfeedcom-receives-favorable-feedbacks-from-fans/" rel="bookmark" class="crp_title">Chinese friendfeed.com receives favorable feedbacks from fans</a></li><li><a href="http://dallascao.com/en/open-a-link-in-a-new-tab/" rel="bookmark" class="crp_title">Shortcut to open a link in a new tab instead of a new window</a></li><li><a href="http://dallascao.com/en" rel="bookmark" class="crp_title">home</a></li><li><a href="http://dallascao.com/en/business-opportunities-from-chinas-great-firewall/" rel="bookmark" class="crp_title">Business opportunities from China&#8217;s Great Firewall</a></li><li>Powered by <a href="http://ajaydsouza.com/wordpress/plugins/contextual-related-posts/">Contextual Related Posts</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://dallascao.com/en/friendfeedtranslate/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The context sensitive Language Versions link</title>
		<link>http://dallascao.com/en/the-context-sensitive-language-versions-link/</link>
		<comments>http://dallascao.com/en/the-context-sensitive-language-versions-link/#comments</comments>
		<pubDate>Mon, 27 Jul 2009 15:39:21 +0000</pubDate>
		<dc:creator>Dallas</dc:creator>
				<category><![CDATA[Coding Frenzy]]></category>
		<category><![CDATA[World Wide Web]]></category>
		<category><![CDATA[codes]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[string replace]]></category>
		<category><![CDATA[webmastering]]></category>

		<guid isPermaLink="false">http://dallascao.com/en/?p=127</guid>
		<description><![CDATA[Most bilingual sites only have a fixed link to the other language version. Wherever you are on one language version of a site, clicking on the Language Version link always takes you to the home page of the other version of the site. But I want my visitors get the exact page they are viewing written in the other language. I used the javascript replace method to make it work.]]></description>
			<content:encoded><![CDATA[<p>Most bilingual sites only have a fixed link to the other language version. Wherever you are on one language version of a site, clicking on the Language Version link always takes you to the home page of the other version of the site. But I want my visitors get the exact page they are viewing written in the other language. <span id="more-127"></span>For example, if my visitor is visiting</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">http://dallascao.com/en/2009/07/the-context-sensitive-language-versions-link/</pre></div></div>

<p>by clicking &#8220;中文&#8221; at the bottom, he is taken to</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">http://dallascao.com/cn/2009/07/the-context-sensitive-language-versions-link/</pre></div></div>

<p>So it involves replacing the &#8220;/en/&#8221; the URL of the current page with &#8220;/cn/&#8221;.</p>
<p>The following php code gives out wrong results:</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;">$url_old</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;http://&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$_SERVER</span> <span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'HTTP_HOST'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'PHP_SELF'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #000088;">$url_new</span><span style="color: #339933;">=</span><span style="color: #990000;">str_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;en&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;cn&quot;</span><span style="color: #339933;">,</span><span style="color: #000088;">$url_old</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>   
&lt;a href=<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$url_new</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>Chinese&lt;/a&gt;</pre></div></div>

<p>Whichever page you are visiting, $url_old always gives the home URL &#8220;/en/index.php&#8221;. This is because I turned Permalinks on and the URL is rewritten. The URL rewritting takes place <b>after</b> the execution of PHP codes on the server side, and therefore the php string &#8220;$url_old&#8221; cannot get the actual URL as it is rewritten afterwards. The following java script can get the right current URL as java script runs on the client&#8217;s computer:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>script<span style="color: #339933;">&gt;</span>
var s<span style="color: #339933;">=</span>window.<span style="color: #006633;">location</span>.<span style="color: #006633;">href</span>
r<span style="color: #339933;">=</span>s.<span style="color: #006633;">replace</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">/</span>en<span style="color: #339933;">/</span>, <span style="color: #0000ff;">&quot;cn&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
document.<span style="color: #006633;">write</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;&lt;li&gt;&lt;a title='English verion of this page' href=&quot;</span><span style="color: #339933;">+</span>r<span style="color: #339933;">+</span><span style="color: #0000ff;">&quot;&gt;Chinese&lt;/a&gt;&lt;/li&gt;&quot;</span><span style="color: #009900;">&#41;</span>
<span style="color: #339933;">&lt;/</span>script<span style="color: #339933;">&gt;</span></pre></div></div>

<p>More information:</p>
<p><a target=_blank href="http://www.w3schools.com/jsref/jsref_replace.asp">java replace () method</a></p>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://dallascao.com/en/use-of-if-fields/" rel="bookmark" class="crp_title">Use of If field in Microsoft Word</a></li><li><a href="http://dallascao.com/en/use-cookies-to-remember/" rel="bookmark" class="crp_title">Use cookies to remember the language version users visited last time (php code)</a></li><li><a href="http://dallascao.com/en/use-regular-expressions-in-htaccess-for-redirections/" rel="bookmark" class="crp_title">Use regular expressions in .htaccess for redirections</a></li><li><a href="http://dallascao.com/en/open-a-link-in-a-new-tab/" rel="bookmark" class="crp_title">Shortcut to open a link in a new tab instead of a new window</a></li><li><a href="http://dallascao.com/en/friendfeedtranslate/" rel="bookmark" class="crp_title">friendfeedTranslate: script that translate all languages on a page into one language</a></li><li>Powered by <a href="http://ajaydsouza.com/wordpress/plugins/contextual-related-posts/">Contextual Related Posts</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://dallascao.com/en/the-context-sensitive-language-versions-link/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Language filter for friendfeed.com?</title>
		<link>http://dallascao.com/en/language-filter-for-friendfeedcom/</link>
		<comments>http://dallascao.com/en/language-filter-for-friendfeedcom/#comments</comments>
		<pubDate>Sat, 10 Jan 2009 13:00:24 +0000</pubDate>
		<dc:creator>Dallas</dc:creator>
				<category><![CDATA[Translations]]></category>
		<category><![CDATA[World Wide Web]]></category>
		<category><![CDATA[friendfeed.com]]></category>
		<category><![CDATA[website localization]]></category>

		<guid isPermaLink="false">http://www.dallascao.cn/en/index.php/2009/01/10/language-filter-for-friendfeedcom/</guid>
		<description><![CDATA[One enhancement for friendfeed.com I can think of is language filter. If someone who knows one language subscribes to several multilingual friends, his homepage can be messy with items and comments in languages they don&#8217;t know. Sometimes  one item is followed by comments in several languages. If there is a language filter option, readers can choose only [...]]]></description>
			<content:encoded><![CDATA[<p>One enhancement for<a href="http://www.friendfeed.com/" target="_blank"> friendfeed.com</a> I can think of is language filter. If someone who knows one language subscribes to several multilingual friends, his homepage can be messy with items and comments in languages they don&#8217;t know. <span id="more-97"></span>Sometimes  one item is followed by comments in several languages. If there is a language filter option, readers can choose only to show information in languages they know. The language filter can benefit the feed owner too. I personally do not want to bore my English-spoken  &#8217;followers&#8217; with my Chinese contents.</p>
<p>The language filter can be applied to one feed or as a global parameter. When a user subscribes to a feed, they can choose to show only contents of that feed in languages they know, or they can go to the Option section, and pick the languages they know and click OK to set it as a global preference.</p>
<p>A even cooler stuff is to add an auto translation feature which can translate any language in a page into one language.</p>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://dallascao.com/en/friendfeedtranslate/" rel="bookmark" class="crp_title">friendfeedTranslate: script that translate all languages on a page into one language</a></li><li><a href="http://dallascao.com/en/opening-pdf-files-with-coreldraw/" rel="bookmark" class="crp_title">Opening PDF files with CorelDraw</a></li><li><a href="http://dallascao.com/en/chinese-friendfeedcom-receives-favorable-feedbacks-from-fans/" rel="bookmark" class="crp_title">Chinese friendfeed.com receives favorable feedbacks from fans</a></li><li><a href="http://dallascao.com/en" rel="bookmark" class="crp_title">home</a></li><li><a href="http://dallascao.com/en/business-opportunities-from-chinas-great-firewall/" rel="bookmark" class="crp_title">Business opportunities from China&#8217;s Great Firewall</a></li><li>Powered by <a href="http://ajaydsouza.com/wordpress/plugins/contextual-related-posts/">Contextual Related Posts</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://dallascao.com/en/language-filter-for-friendfeedcom/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

<!-- Served from: dallascao.com @ 2010-09-10 14:47:22 by W3 Total Cache -->