<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="bbPress/1.1" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
		>
	<channel>
		<title>bbPress Support Forums &#187; Topic: How to read bbPress Theme Switcher&#039;s theme user choice cookie outside of bbPress</title>
		<link>http://bbpress.org/forums/topic/how-to-read-bbpress-theme-switchers-theme-user-choice-cookie-outside-of-bbpress</link>
		<description>bbPress Support Forums &#187; Topic: How to read bbPress Theme Switcher&#039;s theme user choice cookie outside of bbPress</description>
		<language>en-US</language>
		<pubDate>Fri, 10 Feb 2012 10:53:50 +0000</pubDate>
		<generator>http://bbpress.org/?v=1.1</generator>
				<atom:link href="http://bbpress.org/forums/rss/topic/how-to-read-bbpress-theme-switchers-theme-user-choice-cookie-outside-of-bbpress" rel="self" type="application/rss+xml" />

		<item>
			<title>yokima on "How to read bbPress Theme Switcher&#039;s theme user choice cookie outside of bbPress"</title>
			<link>http://bbpress.org/forums/topic/how-to-read-bbpress-theme-switchers-theme-user-choice-cookie-outside-of-bbpress#post-23469</link>
			<pubDate>Sun, 25 Jan 2009 07:14:20 +0000</pubDate>
			<dc:creator>yokima</dc:creator>
			<guid isPermaLink="false">23469@http://bbpress.org/forums/</guid>
			<description><![CDATA[<p>bump?
</p>]]></description>
					</item>
		<item>
			<title>yokima on "How to read bbPress Theme Switcher&#039;s theme user choice cookie outside of bbPress"</title>
			<link>http://bbpress.org/forums/topic/how-to-read-bbpress-theme-switchers-theme-user-choice-cookie-outside-of-bbpress#post-23314</link>
			<pubDate>Wed, 21 Jan 2009 17:22:39 +0000</pubDate>
			<dc:creator>yokima</dc:creator>
			<guid isPermaLink="false">23314@http://bbpress.org/forums/</guid>
			<description><![CDATA[<p>Hello,</p>
<p>I would like to have bbPress in two languages, using the same forum DB. So when viewing in language 1, the forum's interface would be in language 1 with all the postings listed, and in language 2, the interface would be in language 2 with the same postings listed.</p>
<p>I plan on achieving this with bbPress theme switcher ( <a href="http://bbpress.org/plugins/topic/bbpress-theme-switcher/" rel="nofollow">http://bbpress.org/plugins/topic/bbpress-theme-switcher/</a> ) and the link to switch between the themes/languages would be /bbpress/?bbtheme=lang1 and  /bbpress/?bbtheme=lang2</p>
<p>I would also like to set up a php page at the root of the web domain to auto-detect and forward to the appropriate mediawiki language page based on<br />
1) user's browser language preferences if this is a first time visit<br />
2) last connection's languages preferences, which would be saved in the form of bbPress's theme preference cookie.</p>
<p>with a file structure of</p>
<p>/blog<br />
/blog/bbpress<br />
/blog/wiki<br />
/langdetect.php</p>
<p>My code so far is:</p>
<p>?php<br />
/* langdetect.php */</p>
<p>$defaultlang = 'en'<br />
    $lang = $defaultlang;</p>
<p>/* bbPress theme cookie detection */<br />
if cookie exists {<br />
(read cookie and set $lang to either en or ko.. bla bla)<br />
}</p>
<p>/* WordPress and/or MediaWiki last visit language detection */<br />
elseif previous visit info exists {<br />
(i'll figure this out later)<br />
}</p>
<p>/* detect in-browser lang pref ...  modified from <a href="http://kaldung.com/en/php_detectbrowserlanguage.html" rel="nofollow">http://kaldung.com/en/php_detectbrowserlanguage.html</a>  */<br />
else {<br />
    $langlist = explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']);<br />
    foreach($langlist as $curLang) {<br />
        $curLang = explode(';', $curLang);<br />
        /* use regular expression for language detection */<br />
        if (preg_match('/(ko&#124;en)-?.*/', $curLang<a href="http://trac.bbpress.org/changeset/0">[0]</a>, $reg)) {<br />
            $lang = $reg<a href="http://trac.bbpress.org/changeset/1">[1]</a>;<br />
            break;<br />
        }<br />
    }<br />
}</p>
<p>/* redirect */<br />
if ( $lang=='ko' ) { header( 'Location: <a href="http://ENGLISHPAGE" rel="nofollow">http://ENGLISHPAGE</a>' ) ; }<br />
else { header( 'Location: <a href="http://ENGLISHPAGE" rel="nofollow">http://ENGLISHPAGE</a>' ) ; }</p>
<p>?&#62;</p>
<p>How can I read the bbPress cookie that contains the Theme Switcher theme preference?
</p>]]></description>
					</item>

	</channel>
</rss>

