<?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>Serenity &#187; Language</title>
	<atom:link href="http://seanchenxi.com/tag/language/feed" rel="self" type="application/rss+xml" />
	<link>http://seanchenxi.com</link>
	<description>-非淡泊无以明志，非宁静无以致远</description>
	<lastBuildDate>Sun, 11 Mar 2012 17:30:18 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Fix the problem of language recognition</title>
		<link>http://seanchenxi.com/fix-the-problem-of-language-recognition.html</link>
		<comments>http://seanchenxi.com/fix-the-problem-of-language-recognition.html#comments</comments>
		<pubDate>Tue, 01 Apr 2008 22:13:25 +0000</pubDate>
		<dc:creator>Xi</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[English]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[Browser]]></category>
		<category><![CDATA[Language]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://seanchenxi.com/?p=66</guid>
		<description><![CDATA[Finally, I&#8217;ve fixed the problem of language recognition. Before, my site can not filter the posts very well in a language which is determined by the browser&#8217;s language setting to show on the homepage. When I use the code : &#60;?php if ($_SERVER["HTTP_ACCEPT_LANGUAGE"] != &#8220;zh-CN&#8221;) {query_posts(&#8216;cat=57,16&#8242;);} ?&#62; in homepage, the posts can be filtered correctly in IE7: If your [...]]]></description>
			<content:encoded><![CDATA[<p>Finally, I&#8217;ve fixed the problem of language recognition.</p>
<p>Before, my site can not filter the posts very well in a language which is determined by the browser&#8217;s language setting to show on the homepage.<br />
When I use the code :<br />
&lt;?php if ($_SERVER["HTTP_ACCEPT_LANGUAGE"] != &#8220;zh-CN&#8221;) {query_posts(&#8216;cat=57,16&#8242;);} ?&gt;<br />
in homepage, the posts can be filtered correctly in IE7: If your browser&#8217;s language setting is zh-CN, the homepage will show all the posts, else, the homepage will show all the posts in category ID 57/16.<br />
But in IE6 or FireFox, it doesn&#8217;t work. Because the browser&#8217;s language setting is &#8220;zh-cn&#8221;, it&#8217;s not &#8220;zh-CN&#8221;.</p>
<p>So I added a condition :<br />
&lt;?php<br />
            $lan=&amp;$_SERVER["HTTP_ACCEPT_LANGUAGE"];<br />
            if (($lan != &#8220;zh-CN&#8221;)&amp;&amp;($lan != &#8220;zh-cn&#8221;)) {query_posts(&#8216;cat=57,16&#8242;);}<br />
?&gt;</p>
<p>Maybe it is not very &#8220;beautiful&#8221;, but it works very well for me! So hope it can help you! Maybe one day, I can make it smarter!</p>
<p>Ps: The codition part is a general format in PHP code, but the execute part is only for WordPress!</p>
]]></content:encoded>
			<wfw:commentRss>http://seanchenxi.com/fix-the-problem-of-language-recognition.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

