<?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>Angular.js | Nerdpress.org</title>
	<atom:link href="https://nerdpress.org/tag/angular-js/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>
	</channel>
</rss>
