<?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>i18n | Nerdpress.org</title>
	<atom:link href="https://nerdpress.org/tag/i18n/feed/" rel="self" type="application/rss+xml" />
	<link>https://nerdpress.org</link>
	<description>...dev, tech problems and solutions.</description>
	<lastBuildDate>Thu, 07 Sep 2017 13:08:51 +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>Symfony and Angular: shared translations</title>
		<link>https://nerdpress.org/2017/09/04/symfony-and-angular-shared-translations/</link>
		
		<dc:creator><![CDATA[Max Girkens]]></dc:creator>
		<pubDate>Mon, 04 Sep 2017 15:21:51 +0000</pubDate>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Project Setup]]></category>
		<category><![CDATA[Symfony]]></category>
		<category><![CDATA[Angular.js]]></category>
		<category><![CDATA[i18n]]></category>
		<guid isPermaLink="false">https://nerdpress.org/?p=2742</guid>

					<description><![CDATA[<p>Angular for frontend with symfony delivering the data have become quite a common setup. When working with this constellation you will sooner or later come across the i18n topic. Most likely you would want to share translations between front- and backend. So that you could keep translations in one single location while using it for &#8230; </p>
<p class="link-more"><a href="https://nerdpress.org/2017/09/04/symfony-and-angular-shared-translations/" class="more-link">Continue reading<span class="screen-reader-text"> "Symfony and Angular: shared translations"</span></a></p>
The post <a href="https://nerdpress.org/2017/09/04/symfony-and-angular-shared-translations/">Symfony and Angular: shared translations</a> first appeared on <a href="https://nerdpress.org">Nerdpress.org</a>.]]></description>
										<content:encoded><![CDATA[<p><a href="https://angularjs.org/">Angular</a> for frontend with <a href="http://symfony.com/">symfony</a> delivering the data have become quite a common setup.</p>
<p>When working with this constellation you will sooner or later come across the i18n topic. Most likely you would want to share translations between front- and backend. So that you could keep translations in one single location while using it for frontend templates as well as server-side error messages etc.</p>
<p>One <a href="https://stackoverflow.com/questions/19686291/translations-shared-between-symfony2-and-angular-js">approach</a> would be to store translations in the symfony yml or xml files and deliver those to the frontend via an api endpoint.<br />
Given that front- and backend-code run <strong>on the same server</strong>, there is an even simpler solution.<br />
<span id="more-2742"></span></p>
<p>Since symfony does not only read <a href="https://symfony.com/doc/current/components/translation.html#loading-message-catalogs">yml or xml</a> but also translations in the <a href="https://symfony.com/doc/current/components/translation.html#loading-message-catalogs">json format</a>, you can simply keep translations in the frontend and read those files with symfony directly.</p>
<p>All you need to do to achieve this is <a href="https://en.wikipedia.org/wiki/Symbolic_link">symlink</a> the angular translation files to your symfony translation catalog location. </p>
<pre class="brush: bash; title: ; notranslate">
messages.de.json -&gt; ../../../web/ng/I18n/de_DE.json
messages.en.json -&gt; ../../../web/ng/I18n/en_EN.json
</pre>
<p><em>Disclaimer: This works only for relatively simple use cases with no complex translation patterns. But hey&#8230;</em></p>The post <a href="https://nerdpress.org/2017/09/04/symfony-and-angular-shared-translations/">Symfony and Angular: shared translations</a> first appeared on <a href="https://nerdpress.org">Nerdpress.org</a>.]]></content:encoded>
					
		
		
			</item>
		<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>
