<?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>sapphire | Nerdpress.org</title>
	<atom:link href="https://nerdpress.org/tag/sapphire/feed/" rel="self" type="application/rss+xml" />
	<link>https://nerdpress.org</link>
	<description>...dev, tech problems and solutions.</description>
	<lastBuildDate>Mon, 28 Feb 2011 14:15:19 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>
	<item>
		<title>i18n-fieldtypes module für Silverstripe</title>
		<link>https://nerdpress.org/2011/02/28/i18n-fieldtypes-module-fur-silverstripe/</link>
		
		<dc:creator><![CDATA[Ivo Bathke]]></dc:creator>
		<pubDate>Mon, 28 Feb 2011 14:15:19 +0000</pubDate>
				<category><![CDATA[Silverstripe]]></category>
		<category><![CDATA[i18n]]></category>
		<category><![CDATA[sapphire]]></category>
		<guid isPermaLink="false">https://nerdpress.org/?p=1380</guid>

					<description><![CDATA[<p>Heute möchte ich mal ein Silverstripe Modul von mir vorstellen: silverstripe-i18n-fieldtypes Es ist eigentlich eher ein Work-around für fehlenden oder ungenügenden I18n Support in sapphire. Eigentlich sind wir hier alle Fans von Silverstripe, da es für Coder einfach anzupassen ist, aber speziell beim Umgang mit Datums und Currency Typen in Silverstripe merkt man, dass da &#8230; </p>
<p class="link-more"><a href="https://nerdpress.org/2011/02/28/i18n-fieldtypes-module-fur-silverstripe/" class="more-link">Continue reading<span class="screen-reader-text"> "i18n-fieldtypes module für Silverstripe"</span></a></p>
The post <a href="https://nerdpress.org/2011/02/28/i18n-fieldtypes-module-fur-silverstripe/">i18n-fieldtypes module für Silverstripe</a> first appeared on <a href="https://nerdpress.org">Nerdpress.org</a>.]]></description>
										<content:encoded><![CDATA[<p>Heute möchte ich mal ein Silverstripe Modul von mir vorstellen: <a href="http://code.google.com/p/silverstripe-i18n-fieldtypes/">silverstripe-i18n-fieldtypes</a><br />
Es ist eigentlich eher ein Work-around für fehlenden oder ungenügenden I18n Support in sapphire.<br />
Eigentlich sind wir hier alle Fans von Silverstripe, da es für Coder einfach anzupassen ist, aber<br />
speziell beim Umgang mit Datums und Currency Typen in Silverstripe merkt man, dass da noch was fehlt.<br />
Es kann gut sein, dass die nächste Version von sapphire das Modul obsolet machen -ich hoffe es sogar-<br />
aber bis dahin, soll dieses Modul helfen.</p>
<p>Für Datum Werte mit deutscher Formatierung muss man zB überall in den templates folgendes machen</p>
<pre class="brush: php; title: ; notranslate">
$Datetime.FormatI18N(%e. %B %G).
</pre>
<p>Es reicht nicht einfach sowas in der config anzugeben:</p>
<pre class="brush: php; title: ; notranslate">
i18n::set_locale('de_DE');
</pre>
<p>Und das ist schon ganz schön nervig.<br />
Aber hier hilft dann das Modul.</p>
<p>Sapphire kennt verschiedene Wege zur Formatierung, die in Zukunft wahrscheinlich noch vereinheitlicht werden.<br />
Im Groben sind das:</p>
<p><span id="more-1380"></span></p>
<ul>
<li>&#8211; PHP setlocale for LC_TIME</li>
<li>&#8211; Zend Date</li>
<li>&#8211; sapphire Money Class based on Zend Currency</li>
<li>&#8211; sapphire deprecated Currency class for compatibility</li>
</ul>
<p>
Da muss man dann schauen was für einen passt, das Modul unterstützt auf jeden Fall alle diese.</p>
<p>Installiert wird es, wie alle Silverstripe Module, einfach in die Root-ebene des Projects kopieren und fertig.</p>
<p>In der <em>mysite/_config.php</em> muss man dann einfach die jeweilige Datums oder Currency Klasse<br />
mit der Subklasse des Moduls ersetzen und schon hat man den vollen Zugriff auf zB die <a href="http://framework.zend.com/manual/en/zend.date.html">ZEND Datums Klasse</a></p>
<pre class="brush: php; title: ; notranslate">
i18n::set_default_locale('de_DE');
Object::useCustomClass('SS_Datetime','ZendDate',true);
</pre>
<p>Will man kein Zend benutzen, kann der PHP Weg über die locale gegangen werden.<br />
Die Formatierungen finden sich im lang file des Moduls, können aber auch explizit angegeben werden.</p>
<p>Alle Möglichkeiten sind in der <em>_config.php</em> erklärt:</p>
<pre class="brush: php; title: ; notranslate">
//Date Formating -the PHP way-
//Object::useCustomClass('SS_Datetime','I18nDatetime', true);
//values then come from the lang file
//if you want to use custom formating then set also:
//I18nDatetime::setFormatNice('%e. %B %G');

//Date Formating -the Zend way-
//Object::useCustomClass('SS_Datetime','ZendDate', true);
//values then come from the lang file
//if you want to use custom formating then set also:
//ZendDate::setFormatNice('j. F Y, G:i');

//Money Formating -the SS Currency Way-
//Object::useCustomClass('Currency','I18nCurrency', true)
//values then come from the lang file
//if you want to use custom formating then set also:
//I18nCurrency::setDecimalDelimiter(','); 
//I18nCurrency::setThousandDelimiter('.'); 

//Money Formating -the Money / Zend way -
//Object::useCustomClass('Money','CustomMoney', true);
//@see http://framework.zend.com/manual/en/zend.currency.options.html
//CustomMoney::setOptions(array('display' =&gt; Zend_Currency::USE_SHORTNAME,
//                                                        'position' =&gt; Zend_Currency::RIGHT));
</pre>
<p>Auf meiner TODO stehen dann noch weitere Sprachfiles, sowie ein paar UnitTests.<br />
Probierts mal aus und über feedback freut man sich natürlich.</p>The post <a href="https://nerdpress.org/2011/02/28/i18n-fieldtypes-module-fur-silverstripe/">i18n-fieldtypes module für Silverstripe</a> first appeared on <a href="https://nerdpress.org">Nerdpress.org</a>.]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
