<?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>Side Notes &#187; localization</title>
	<atom:link href="http://blog.snaky.org/tag/localization/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.snaky.org</link>
	<description>Relax, its only ONES and ZEROS!</description>
	<lastBuildDate>Sun, 11 Oct 2009 12:20:15 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
<image>
<link>http://blog.snaky.org</link>
<url>http://blog.snaky.org/wp-content/plugins/maxblogpress-favicon/icons/favicon-26.ico</url>
<title>Side Notes</title>
</image>
		<item>
		<title>Standard Sprachen anhand des Browsers definieren</title>
		<link>http://blog.snaky.org/2008/09/20/standard-sprachen-anhand-des-browsers-definieren/</link>
		<comments>http://blog.snaky.org/2008/09/20/standard-sprachen-anhand-des-browsers-definieren/#comments</comments>
		<pubDate>Sat, 20 Sep 2008 13:36:50 +0000</pubDate>
		<dc:creator>Simon</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[localization]]></category>
		<category><![CDATA[selfhtml]]></category>
		<category><![CDATA[Spache]]></category>

		<guid isPermaLink="false">http://blog.snaky.org/?p=84</guid>
		<description><![CDATA[<img src="http://blog.snaky.org/wp-content/uploads/2008/07/php_16.png" width="16" height="16" alt="" title="PHP" /><br/>Sobald man mehrere Sprachen unterstützt, ist es natürlich leicht den Besucher selbst aussuchen zu lassen welche Sprache er ansehen will. Um die Standard-Sprache zu setzen habe ich auf selfhtml eine schöne Sprachfunktion gefunden. Sinnvoll ist diese um eine Standardsprache auszuwählen und eine Menge an unterstützen Sprachen.]]></description>
			<content:encoded><![CDATA[<img src="http://blog.snaky.org/wp-content/uploads/2008/07/php_16.png" width="16" height="16" alt="" title="PHP" /><br/><p>Sobald man mehrere Sprachen unterstützt, ist es natürlich leicht den Besucher selbst aussuchen zu lassen welche Sprache er ansehen will.<br />
Um die Standard-Sprache zu setzen habe ich auf selfhtml eine schöne <a href="http://aktuell.de.selfhtml.org/artikel/php/httpsprache/">Sprachfunktion</a> gefunden.<br />
Sinnvoll ist diese um eine Standardsprache auszuwählen und eine Menge an unterstützen Sprachen.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.snaky.org/2008/09/20/standard-sprachen-anhand-des-browsers-definieren/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Localization Fun</title>
		<link>http://blog.snaky.org/2008/07/06/localization-fun/</link>
		<comments>http://blog.snaky.org/2008/07/06/localization-fun/#comments</comments>
		<pubDate>Sat, 05 Jul 2008 23:55:31 +0000</pubDate>
		<dc:creator>Simon</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Anleitung]]></category>
		<category><![CDATA[Coding]]></category>
		<category><![CDATA[Guide]]></category>
		<category><![CDATA[localization]]></category>
		<category><![CDATA[sprache]]></category>

		<guid isPermaLink="false">http://blog.snaky.org/?p=66</guid>
		<description><![CDATA[<img src="http://blog.snaky.org/wp-content/uploads/2008/07/php_16.png" width="16" height="16" alt="" title="PHP" /><br/>Um Webseiten zu internationalisieren, benötigt es mehr als nur die übersetzten Texte. Ich erkläre hier die Grundlagen die man benötigt um eine erfolgreiche Internationalisierung vorzunehmen. Nehmen wir an wir haben unsere normale Seite. Natürlich sind hier durchaus mehr Texte denkbar. 1 2 echo &#34;Herzlich Willkommen&#34;.&#34;\n&#34;; echo &#34;Link zum Gästebuch&#34;; Um nun mehrere Sprachen zu unterstützen [...]]]></description>
			<content:encoded><![CDATA[<img src="http://blog.snaky.org/wp-content/uploads/2008/07/php_16.png" width="16" height="16" alt="" title="PHP" /><br/><p>Um Webseiten zu internationalisieren, benötigt es mehr als nur die übersetzten Texte. Ich erkläre hier die Grundlagen die man benötigt um eine erfolgreiche Internationalisierung vorzunehmen.</p>
<p>Nehmen wir an wir haben unsere normale Seite. Natürlich sind hier durchaus mehr Texte denkbar.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="1" style="font-family:monospace;">echo &quot;Herzlich Willkommen&quot;.&quot;\n&quot;;
echo &quot;Link zum Gästebuch&quot;;</pre></td></tr></table></div>

<p><span id="more-66"></span><br />
Um nun mehrere Sprachen zu unterstützen passen wir zuerst unsere Seite an</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="1" style="font-family:monospace;">echo $message[&quot;welcome&quot;].&quot;\n&quot;;
echo $message[&quot;link_guestbook&quot;];</pre></td></tr></table></div>

<p>Da wir zu einer erfolgreichen Internationalisierung auch andere Sprachen brauchen hier ein Beispiel hierfür.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// lang_de.php - Deutsche Sprache</span>
<span style="color: #000088;">$message</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;welcome&quot;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;Herzlich Willkommen&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$message</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;link_guestbook&quot;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;Link zum Gästebuch&quot;</span><span style="color: #339933;">;</span></pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// lang_en.php - english language</span>
<span style="color: #000088;">$message</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;welcome&quot;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;Welcome&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$message</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;link_guestbook&quot;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;Link to guestbook&quot;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Nun müssen wir in unsere Seite noch eine Abfrage machen welche Sprache benutzt werden soll.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code"><pre class="1" style="font-family:monospace;">switch($_GET['lang'){
	default:
	case &quot;de&quot;: include(&quot;lang_de.php&quot;); break;
	case &quot;en&quot;: include(&quot;lang_en.php&quot;); break;
}
echo $message[&quot;welcome&quot;].&quot;\n&quot;;
echo $message[&quot;link_guestbook&quot;];</pre></td></tr></table></div>

<p>Manchmal kann es jedoch sein, dass man auch in Funktionen die Sprachblöcke benutzen will. Um ein</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$message</span></pre></div></div>

<p> in jeder Funktion zu vermeiden. Benutzen wir anstatt eines Arrays globale Konstanten. Wie auf den <a href="http://www.php.net/manual/de/language.constants.php">PHP-Seiten</a> zu erlesen ist sollte man für Konstanten immer GROSSBUCHSTABEN verwenden. Auch sollte den Konstantennamen kein <b>$</b> voran gestellt werden. So erhalten wir eine Sprachdatei die zum Beispiel so aussieht.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// lang_de.php - Deutsche Sprache</span>
<span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;WELCOME&quot;</span><span style="color: #339933;">,</span>		<span style="color: #0000ff;">&quot;Herzlich Willkommen&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;LINK_GUESTBOOK&quot;</span><span style="color: #339933;">,</span> 	<span style="color: #0000ff;">&quot;Link zum Gästebuch&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Nun müssen wir nurnoch unsere Seite anpassen.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code"><pre class="1" style="font-family:monospace;">switch($_GET['lang'){
	default:
	case &quot;de&quot;: include(&quot;lang_de.php&quot;); break;
	case &quot;en&quot;: include(&quot;lang_en.php&quot;); break;
}
echo WELCOME.&quot;\n&quot;;
echo LINK_GUESTBOOK;</pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://blog.snaky.org/2008/07/06/localization-fun/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
