<?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>gouranga &#187; 2008 &#187; Mai</title>
	<atom:link href="http://www.gouranga.me/2008/05/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.gouranga.me</link>
	<description>ein wenig von fast allem</description>
	<lastBuildDate>Tue, 09 Mar 2010 19:15:10 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Rage against the fucking Machine!! HELL YEAH!</title>
		<link>http://www.gouranga.me/2008/05/27/rage-against-the-fucking-machine-hell-yeah/</link>
		<comments>http://www.gouranga.me/2008/05/27/rage-against-the-fucking-machine-hell-yeah/#comments</comments>
		<pubDate>Tue, 27 May 2008 21:03:32 +0000</pubDate>
		<dc:creator>Steffen</dc:creator>
				<category><![CDATA[Allgemein]]></category>
		<category><![CDATA[rar08]]></category>
		<category><![CDATA[ratm]]></category>

		<guid isPermaLink="false">http://www.steffen-goertz.de/?p=176</guid>
		<description><![CDATA[Vorbereitungen zum besten Tag meines Lebens laufen.

Zahnschutz (Ober- / Unterkiefer) &#8211; Check!
Rock am Ring Karte &#8211; Check (Wenn die Penner von GETMEIN.co.uk die ENDLICH!!! schicken! Ich brech dennen die Kiefer sollte die unpünklich kommen und ich RATM verpassen. I swear, Mates! Penner, blöde)
Kondition &#8211; Check!
Tägliche Dosis RAGE and HATE &#8211; Check!
Mexikanischer Dialekt und Hautton &#8211; [...]]]></description>
			<content:encoded><![CDATA[<p>Vorbereitungen zum besten Tag meines Lebens laufen.</p>
<ul>
<li>Zahnschutz (Ober- / Unterkiefer) &#8211; Check!</li>
<li>Rock am Ring Karte &#8211; Check (<em>Wenn die Penner von GETMEIN.co.uk die ENDLICH!!! schicken! Ich brech dennen die Kiefer sollte die unpünklich kommen und ich RATM verpassen. I swear, Mates! Penner, blöde</em>)</li>
<li>Kondition &#8211; Check!</li>
<li>Tägliche Dosis RAGE and HATE &#8211; Check!</li>
<li>Mexikanischer Dialekt und Hautton &#8211; Si Si Señor!</li>
<li>Rote Flagge und Antiflagge &#8211; Check!</li>
</ul>
<p><object width="425" height="355"><param name="movie" value="http://www.youtube.com/v/INMQBT-k77U&#038;hl=en"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/INMQBT-k77U&#038;hl=en" type="application/x-shockwave-flash" wmode="transparent" width="425" height="355"></embed></object></p>
]]></content:encoded>
			<wfw:commentRss>http://www.gouranga.me/2008/05/27/rage-against-the-fucking-machine-hell-yeah/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CakePHP I18n &amp; l10n</title>
		<link>http://www.gouranga.me/2008/05/09/cakephp-i18n-l10n/</link>
		<comments>http://www.gouranga.me/2008/05/09/cakephp-i18n-l10n/#comments</comments>
		<pubDate>Thu, 08 May 2008 22:51:37 +0000</pubDate>
		<dc:creator>Steffen</dc:creator>
				<category><![CDATA[Allgemein]]></category>
		<category><![CDATA[cakephp]]></category>
		<category><![CDATA[i18n]]></category>
		<category><![CDATA[l10n]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.steffen-goertz.de/?p=152</guid>
		<description><![CDATA[Internationalisierung von Internet-Anwendungen ist ein wichtiges Thema, auf das schon zu Beginn der Entwicklung ein Schwerpunkt gelegt werden sollte. Zwar ist nicht bei jeder Internetpräzens Internationalisierung notwendig, die Seiten sollte jedoch mindestens in Englischer Version vorliegen. Bei Internetanwendungen ist Internationalisierung absolut notwendig, möchte man nicht einen Großteil der potentiellen Nutzer ausschließen. Hier erfährst du, wie du deine CakePHP-Anwendung internationali- und lokalisierst.]]></description>
			<content:encoded><![CDATA[<p>Internationalisierung von Internet-Anwendungen ist ein wichtiges Thema, auf das schon zu Beginn der Entwicklung ein Schwerpunkt gelegt werden sollte. Zwar ist nicht bei jeder Internetpräzens Internationalisierung <em>notwendig,</em> die Seiten sollte jedoch mindestens in Englischer Version vorliegen. Bei Internetanwendungen ist Internationalisierung absolut notwendig, möchte man nicht einen Großteil der potentiellen Nutzer ausschließen. <span id="more-152"></span></p>
<p>Zuerst einmal sollten die zwei wichtigen Begriffe Internationalisierung und Lokalisierung geklärt werden.</p>
<p>Unter <strong>Internationalisierung </strong>(am. engl. <em>internationalization</em> Abk. <strong>i18n</strong>, wobei 18 für die 18 Buchstaben zwischen ersten und letztem Buchstaben steht) versteht man die technische Fähigkeit einer Anwendung, sich leicht in andere Sprachen/Sprachräume/Kulturen überführen zu lassen. Diesen Vorgang der Überführung an die lokalen Gegebenheiten nennt man <strong>Lokalisierung.</strong></p>
<p>Unter <strong>Lokalisierung </strong>(am. engl. <em>localization </em>Abk. <strong>l10n</strong>) verseht man die Überführung von Sprache, Zeit/Datumsstempel, Farben, Formatierungen usw. in einen anderen Sprachraum oder Kultur. Lokalisierung setzt (nicht zwingend) Internationalisierung vorraus.</p>
<p>Mit CakePHP 1.2 haben wir bereits ein weitesgehend internationalisiertes Werkzeug zur Hand. Alle Angaben beziehen sich auf CakePHP 1.2.0.6311.</p>
<h3>Struktur</h3>
<div class="inline">In eurem App-Ordner befindet sich bereits der Ordner <em>locale</em>. In diesem werden alle Lokalisationsdaten gespeichert. Da die I18n-Funktionen an GNU-gettext angelehnt sind wurde auch die Ordnerstruktur von gettext übernommen <em>(CakePHP implementiert die gettext-Funktionen übrings selbst, sodass keine gettext-Erweiterung installiert werden muss)</em>. In <em>locale</em> befinden sich die Ordner der verschiedenen Sprachen, abgekürzt durch den Sprachcode entsprechend <strong><a href="http://www.loc.gov/standards/iso639-2/php/code_list.php">ISO-639-2</a></strong>. Es ist jeweils der Code für <strong>T</strong>erminology zu wählen. Für Deutsch wäre dies <em>deu</em>. In den Sprachordnern befinden sich die Ordner der jeweiligen <em><strong><a href="http://publib.boulder.ibm.com/infocenter/systems/index.jsp?topic=/com.ibm.aix.nls/doc/nlsgdrf/locale_cat.htm">Locale Categorie</a></strong> (LC_*)</em>. Möglich sind</p>
<ul>
<li>LC_CTYPE</li>
<li>LC_NUMERIC</li>
<li>LC_TIME</li>
<li>LC_COLLATE</li>
<li>LC_MONETARY</li>
<li>LC_MESSAGES</li>
<li>LC_ALL</li>
</ul>
<p>.</p>
</div>
<p>In der Regel kommt man LC_MESSAGES aus. In nächster Zeit werden hoffentlich der TimeHelper und andere kritische Komponenten von CakePHP I18n. Dann könnten auch LC_TIME und der Rest eine Rolle spielen. Unterhalb der Categories befinden sich die Sprachdateien, wir werden sie als <strong>Domänen</strong> bezeichnen. Die <strong>Standard</strong>- und Fallback-Domäne ist <strong>default.mo</strong> bzw. <strong>default.po</strong>. Domänen werden im <strong>Portable-Object-Format</strong> <em>(.po)</em> bzw. in binärer Form im Maschine-Object-Format <em>(.mo)</em> gespeichert. Ich persönlich finde .mo&#8217;s unpraktisch, da sie das Editieren erschweren.</p>
<p>Der Pfad sieht also so aus: app/locale/{3-Stelliger-Sprachcode oder Dialekt wie de_at, de usw.}/{Kategoriename, LC_MESSAGES etc.}/{default.po, core.mo usw.}</p>
<p>Sie sind eher für Desktop-Anwendungen gedacht. Der Aufbau einer .po-Datei ist sehr simpel. Zunächst benötigt die Datei einen Header.</p>
<pre>msgid ""
msgstr ""
"Plural-Forms: nplurals=2; plural=n==0?0:(n==1?1:2);\n"
"Project-Id-Version: 123 Projekt\n"
"Last-Translator: Steffen Görtz &lt;steffen.goertz@multicept.de&gt;\n"
"Language-Team: Multicept Gbr &lt;info@multicept.de&gt;\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"</pre>
<p>Nach dem Header (der nicht zwingend vorhanden sein muss) folgen die Übersetzungen der einzelnen Strings</p>
<pre>msgid "untranslated-string"
msgstr "translated-string"</pre>
<p><em>(mehr Infos zum .po-Format gibt es in der offiziellen <a href="http://www.gnu.org/software/gettext/manual/gettext.html#PO-Files">GNU-gettext Dokumentation</a>)</em></p>
<p>Besondere Bedeutung hat der Header &#8220;<a title="Pluralformen für verschiedene Sprachen" href="http://www.gnu.org/software/gettext/manual/html_mono/gettext.html#Plural-forms">Plural-Forms</a>&#8220;. Er gibt an, wieviele Pluralformen in der Zielsprache vorkommen <span style="text-decoration: underline;"><em>können</em></span> und wann welche Form zu wählen ist. Im Beispiel (für Deutsch) folgt zuerst mit &#8220;<em>nplurals=%d</em>;&#8221; die Anzahl der  <a title="Pluralformen für verschiedene Sprachen" href="http://www.gnu.org/software/gettext/manual/html_mono/gettext.html#Plural-forms">Pluralformen</a> in der zu übersetzenden Sprache, hier 2. Danach folgt ein C-Ausdruck in Abhängigkeit von n, dessen Ergebnis bestimmt, welcher Plural in Frage kommt.</p>
<p>An dieser Stelle sei leider gesagt, dass CakePHP in der aktuellen Version keinen validen Automaten implementiert, der jeden möglichen Ausdruck auswerten kann. Es können daher nur bestimmte Ausdrucke verwertet werden; zumindest ein paar die sich auf der <em><a href="http://www.gnu.org/software/gettext/manual/gettext.html#PO-Files">GNU-gettext Dokumentation</a> </em>befinden. Ich habe bereits ein <a href="https://trac.cakephp.org/ticket/4607">Ticket </a>eröffnet, mal sehen wie Gwoo und Co. reagieren werden.</p>
<p>Die Plurale werden in der .po-Datei so angelegt</p>
<pre>msgid "Kommentar"
msgid_plural "%d Kommentare"
msgstr[0] "Keine Kommentare"
msgstr[1] "Ein Kommentar"
msgstr[2] "%d Kommentare"</pre>
<p>Die .po-Dateien lassen sich per Hand oder komfortabler mit freien Werkzeugen, wie etwa <a href="http://www.poedit.net/download.php">poEdit</a>, bearbeiten.</p>
<p>Es lassen sich beliebig viele Domänen anlegen und verwalten. In der Regel wird man mit einer auskommen, es sein denn man hat Komponenten mit sehr vielen Übersetzungen. In diesem Fall sollte man über eine Domäne nur für diese Komponente nachdenken.</p>
<h3>CakePHP I18n Funktionen</h3>
<p>Wie bereits gesagt kommt CakePHP mit allen benötigten Werkzeugen frei Haus. Folgende Funktionen sind überall verfügbar<em> (werden in basics.php definiert)</em>:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #009933; font-style: italic;">/**
* Returns a translated string if one is found, or the submitted message if not found.
*
* @param string $singular Text to translate
* @param boolean $return Set to true to return translated string, or false to echo
* @return mixed translated string if $return is false string will be echoed
*/</span>
<span style="color: #000000; font-weight: bold;">function</span> __<span style="color: #009900;">&#40;</span><span style="color: #000088;">$singular</span><span style="color: #339933;">,</span> <span style="color: #000088;">$return</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">;</span></pre></div></div>

<p>Die simpelste Funktion. Es werden lediglich Singulare unterstützt.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #009933; font-style: italic;">/**
* Returns correct plural form of message identified by $singular and $plural for count $count.
* Some languages have more than one form for plural messages dependent on the count.
*
* @param string $singular Singular text to translate
* @param string $plural Plural text
* @param integer $count Count
* @param boolean $return true to return, false to echo
* @return mixed plural form of translated string if $return is false string will be echoed
*/</span>
<span style="color: #000000; font-weight: bold;">function</span> __n<span style="color: #009900;">&#40;</span><span style="color: #000088;">$singular</span><span style="color: #339933;">,</span> <span style="color: #000088;">$plural</span><span style="color: #339933;">,</span> <span style="color: #000088;">$count</span><span style="color: #339933;">,</span> <span style="color: #000088;">$return</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">;</span></pre></div></div>

<p>Mit <em>__n(&#8230;)</em> können Ausdrücke wie <em>Keine Kommentare, Ein Kommentar, x Kommentare</em> übersetzt werden. Anhand von $n wird die richtige Form ausgewählt.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #009933; font-style: italic;">/**
* Allows you to override the current domain for a single message lookup.
*
* @param string $domain Domain
* @param string $msg String to translate
* @param string $return true to return, false to echo
* @return translated string if $return is false string will be echoed
*/</span>
<span style="color: #000000; font-weight: bold;">function</span> __d<span style="color: #009900;">&#40;</span><span style="color: #000088;">$domain</span><span style="color: #339933;">,</span> <span style="color: #000088;">$msg</span><span style="color: #339933;">,</span> <span style="color: #000088;">$return</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">;</span></pre></div></div>

<p>Holt eine einfache Nachricht aus einer anderen Domäne als der derzeitg gewählten. Sowas ist für Komponenten nützlich.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #009933; font-style: italic;">/**
* Allows you to override the current domain for a single plural message lookup
* Returns correct plural form of message identified by $singular and $plural for count $count
* from domain $domain
*
* @param string $domain Domain
* @param string $singular Singular string to translate
* @param string $plural Plural
* @param integer $count Count
* @param boolean $return true to return, false to echo
* @return plural form of translated string if $return is false string will be echoed
*/</span>
<span style="color: #000000; font-weight: bold;">function</span> __dn<span style="color: #009900;">&#40;</span><span style="color: #000088;">$domain</span><span style="color: #339933;">,</span> <span style="color: #000088;">$singular</span><span style="color: #339933;">,</span> <span style="color: #000088;">$plural</span><span style="color: #339933;">,</span> <span style="color: #000088;">$count</span><span style="color: #339933;">,</span> <span style="color: #000088;">$return</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Plurale Übersetzung für andere Domäne.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #009933; font-style: italic;">/**
* Allows you to override the current domain for a single message lookup.
* It also allows you to specify a category.
*
* The category argument allows a specific category of the locale settings to be used for fetching a message.
* Valid categories are: LC_CTYPE, LC_NUMERIC, LC_TIME, LC_COLLATE, LC_MONETARY, LC_MESSAGES and LC_ALL.
*
* Note that the category must be specified with a numeric value, instead of the constant name.  The values are:
* LC_CTYPE     0
* LC_NUMERIC   1
* LC_TIME      2
* LC_COLLATE   3
* LC_MONETARY  4
* LC_MESSAGES  5
* LC_ALL       6
*
* @param string $domain Domain
* @param string $msg Message to translate
* @param integer $category Category
* @param boolean $return true to return, false to echo
* @return translated string if $return is false string will be echoed
*/</span>
<span style="color: #000000; font-weight: bold;">function</span> __dc<span style="color: #009900;">&#40;</span><span style="color: #000088;">$domain</span><span style="color: #339933;">,</span> <span style="color: #000088;">$msg</span><span style="color: #339933;">,</span> <span style="color: #000088;">$category</span><span style="color: #339933;">,</span> <span style="color: #000088;">$return</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Singulare Übersetzung einer anderen Domäne und Kategorie</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #009933; font-style: italic;">/**
* Allows you to override the current domain for a single plural message lookup.
* It also allows you to specify a category.
* Returns correct plural form of message identified by $singular and $plural for count $count
* from domain $domain
*
* The category argument allows a specific category of the locale settings to be used for fetching a message.
* Valid categories are: LC_CTYPE, LC_NUMERIC, LC_TIME, LC_COLLATE, LC_MONETARY, LC_MESSAGES and LC_ALL.
*
* Note that the category must be specified with a numeric value, instead of the constant name.  The values are:
* LC_CTYPE     0
* LC_NUMERIC   1
* LC_TIME      2
* LC_COLLATE   3
* LC_MONETARY  4
* LC_MESSAGES  5
* LC_ALL       6
*
* @param string $domain Domain
* @param string $singular Singular string to translate
* @param string $plural Plural
* @param integer $count Count
* @param integer $category Category
* @param boolean $return true to return, false to echo
* @return plural form of translated string if $return is false string will be echoed
*/</span>
<span style="color: #000000; font-weight: bold;">function</span> __dcn<span style="color: #009900;">&#40;</span><span style="color: #000088;">$domain</span><span style="color: #339933;">,</span> <span style="color: #000088;">$singular</span><span style="color: #339933;">,</span> <span style="color: #000088;">$plural</span><span style="color: #339933;">,</span> <span style="color: #000088;">$count</span><span style="color: #339933;">,</span> <span style="color: #000088;">$category</span><span style="color: #339933;">,</span> <span style="color: #000088;">$return</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Plurale Übersetzung einer anderen Domäne und Kategorie.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #009933; font-style: italic;">/**
* The category argument allows a specific category of the locale settings to be used for fetching a message.
* Valid categories are: LC_CTYPE, LC_NUMERIC, LC_TIME, LC_COLLATE, LC_MONETARY, LC_MESSAGES and LC_ALL.
*
* Note that the category must be specified with a numeric value, instead of the constant name.  The values are:
* LC_CTYPE     0
* LC_NUMERIC   1
* LC_TIME      2
* LC_COLLATE   3
* LC_MONETARY  4
* LC_MESSAGES  5
* LC_ALL       6
*
* @param string $msg String to translate
* @param integer $category Category
* @param string $return true to return, false to echo
* @return translated string if $return is false string will be echoed
*/</span>
<span style="color: #000000; font-weight: bold;">function</span> __c<span style="color: #009900;">&#40;</span><span style="color: #000088;">$msg</span><span style="color: #339933;">,</span> <span style="color: #000088;">$category</span><span style="color: #339933;">,</span> <span style="color: #000088;">$return</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Singulare Übersetzung einer anderen Kategorie</p>
<h3>Sprachen konfigurieren und I18n einsetzen</h3>
<p>Zunächst sollte man die Standardsprache seiner Anwendung einstellen. Hierzu definieren die Konstante <em>DEFAULT_LANGUAGE</em> in unserer App-Config.</p>
<p><strong>app/config/bootstrap.php</strong></p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">/* SVN FILE: $Id: bootstrap.php 6311 2008-01-02 06:33:52Z phpnut $ */</span>
<span style="color: #009933; font-style: italic;">/**
* Short description for file.
*
* Long description for file
*
* PHP versions 4 and 5
*
* CakePHP(tm) :  Rapid Development Framework
* Copyright 2005-2008, Cake Software Foundation, Inc.
*								1785 E. Sahara Avenue, Suite 490-204
*								Las Vegas, Nevada 89104
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @filesource
* @copyright		Copyright 2005-2008, Cake Software Foundation, Inc.
* @link				http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project
* @package			cake
* @subpackage		cake.app.config
* @since			CakePHP(tm) v 0.10.8.2117
* @version			$Revision: 6311 $
* @modifiedby		$LastChangedBy: phpnut $
* @lastmodified	$Date: 2008-01-02 00:33:52 -0600 (Wed, 02 Jan 2008) $
* @license			http://www.opensource.org/licenses/mit-license.php The MIT License
*/</span>
<span style="color: #009933; font-style: italic;">/**
*
* This file is loaded automatically by the app/webroot/index.php file after the core bootstrap.php is loaded
* This is an application wide file to load any function that is not used within a class define.
* You can also use this to include or require any files in your application.
*
*/</span>
<span style="color: #009933; font-style: italic;">/**
* The settings below can be used to set additional paths to models, views and controllers.
* This is related to Ticket #470 (https://trac.cakephp.org/ticket/470)
*
* $modelPaths = array('full path to models', 'second full path to models', 'etc...');
* $viewPaths = array('this path to views', 'second full path to views', 'etc...');
* $controllerPaths = array('this path to controllers', 'second full path to controllers', 'etc...');
*
*/</span>
Configure<span style="color: #339933;">::</span><span style="color: #004000;">load</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'testapp'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">//EOF</span>
?<span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;</span></pre></div></div>

<p><strong>app/config/testapp.php</strong></p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// Spracheinstellungen</span>
<span style="color: #666666; font-style: italic;"># Standardsprache
</span><span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'DEFAULT_LANGUAGE'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'deu'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #666666; font-style: italic;"># Sprache erzwingen
</span>
<span style="color: #666666; font-style: italic;">#Configure::write('Config.language','de');
</span>
<span style="color: #000088;">$config</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'myapp'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> Configure<span style="color: #339933;">::</span><span style="color: #004000;">read</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'myapp'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #339933;">....</span></pre></div></div>

<p>Zunächst definieren wir unsere Standardsprache in 3-Stellen-Notation. Diese wird ausgewählt, wenn die bevorzugte Sprache des Benutzers nicht über HTTP_ACCEPT_LANGUAGE festgestellt werden kann <span style="text-decoration: underline;">oder</span> keine dieser Sprachen verfügbar ist. Danach können wir eine Sprache erzwingen. Diese Funktion kann man nutzen, wenn man ein Menu mit Sprachauswahl erstellen möchte. Soll eine ausgewählte Sprache dauerhaft erhalten bleiben kann man diese als Sessionvariable <em>Config.language</em> speichern.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">  MyController <span style="color: #000000; font-weight: bold;">extends</span> AppController  <span style="color: #009900;">&#123;</span>
<span style="color: #000000; font-weight: bold;">function</span> setLanguage<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: #000088;">$this</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;;</span>Session<span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>write<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Config.language'</span><span style="color: #339933;">,</span><span style="color: #000088;">$lang</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
?<span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;</span></pre></div></div>

<p>Viel Spaß beim ausprobieren!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gouranga.me/2008/05/09/cakephp-i18n-l10n/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Neue Last.fm Post Ext Version</title>
		<link>http://www.gouranga.me/2008/05/05/neue-lastfm-post-ext-version/</link>
		<comments>http://www.gouranga.me/2008/05/05/neue-lastfm-post-ext-version/#comments</comments>
		<pubDate>Mon, 05 May 2008 14:34:26 +0000</pubDate>
		<dc:creator>Steffen</dc:creator>
				<category><![CDATA[Allgemein]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.steffen-goertz.de/?p=145</guid>
		<description><![CDATA[Gibt ne neue Last.fm Post Ext Version, nachdem mich Fabian dazu angeregt hat einen Check der PHP Umgebung einzubauen, damit der Nutzer auf bestehende Probleme hingewiesen wird und sich nicht darüber wundern muss, warum das Plugin nicht funktioniert. Überprüft wird, ob der HTTP Wrapper aktiviert ist und ob SimpleXML verfügbar ist. Die neue Version steht [...]]]></description>
			<content:encoded><![CDATA[<p>Gibt ne neue Last.fm Post Ext Version, nachdem mich <a href="http://blog.musicjunkie.de/">Fabian</a> dazu angeregt hat einen Check der PHP Umgebung einzubauen, damit der Nutzer auf bestehende Probleme hingewiesen wird und sich nicht darüber wundern muss, warum das Plugin nicht funktioniert. Überprüft wird, ob der HTTP Wrapper aktiviert ist und ob SimpleXML verfügbar ist. Die neue Version steht euch ganz normal über das <a href="http://wordpress.org/extend/plugins/lastfm-post-extension/">Wordpress.org Plugin Repository</a> zur Verfügung.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gouranga.me/2008/05/05/neue-lastfm-post-ext-version/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
