<?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>large scale systems &#8211; stoimen&#039;s web log</title>
	<atom:link href="/tag/large-scale-systems/feed/" rel="self" type="application/rss+xml" />
	<link></link>
	<description>on web development</description>
	<lastBuildDate>Tue, 13 Feb 2018 08:18:15 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=5.0.3</generator>
	<item>
		<title>Use Zend_Translate to Translate Your Web App</title>
		<link>/2010/06/15/use-zend_translate-to-translate-your-web-app/</link>
		<comments>/2010/06/15/use-zend_translate-to-translate-your-web-app/#comments</comments>
		<pubDate>Tue, 15 Jun 2010 17:38:39 +0000</pubDate>
		<dc:creator><![CDATA[Stoimen]]></dc:creator>
				<category><![CDATA[micro tutorial]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[zend framework]]></category>
		<category><![CDATA[Computing]]></category>
		<category><![CDATA[Configuration files]]></category>
		<category><![CDATA[Human Interest]]></category>
		<category><![CDATA[INI file]]></category>
		<category><![CDATA[large scale systems]]></category>
		<category><![CDATA[large web system]]></category>
		<category><![CDATA[multilingual site]]></category>
		<category><![CDATA[PHP programming language]]></category>
		<category><![CDATA[System software]]></category>
		<category><![CDATA[Technology/Internet]]></category>
		<category><![CDATA[Web 2.0]]></category>
		<category><![CDATA[zend]]></category>

		<guid isPermaLink="false">/?p=1614</guid>
		<description><![CDATA[There are some really good reasons to use Zend_Translate for your multilingual site instead of some other technique. Actually you can definitely simulate something like this Zend component with and array or ini file, but here are some good things to mention. 1. Write a human readable source file In fact you can do this &#8230; <a href="/2010/06/15/use-zend_translate-to-translate-your-web-app/" class="more-link">Continue reading <span class="screen-reader-text">Use Zend_Translate to Translate Your Web App</span> <span class="meta-nav">&#8594;</span></a><div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="/2010/07/21/setting-up-global-cache-in-zend-framework/" rel="bookmark" title="Setting Up Global Cache in Zend Framework">Setting Up Global Cache in Zend Framework </a></li>
<li><a href="/2009/05/10/phpini-for-two-web-servers/" rel="bookmark" title="php.ini for two web servers">php.ini for two web servers </a></li>
<li><a href="/2011/01/17/a-memcached-zend_cache/" rel="bookmark" title="A Memcached Zend_Cache">A Memcached Zend_Cache </a></li>
<li><a href="/2010/03/02/fast-way-to-manage-the-arabic-version-of-a-web-form/" rel="bookmark" title="Fast way to manage the Arabic version of a web form">Fast way to manage the Arabic version of a web form </a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<p>There are some really good reasons to use <a title="Zend_Translate" href="http://framework.zend.com/manual/en/zend.translate.html" target="_blank">Zend_Translate</a> for your multilingual site instead of some other technique. Actually you can definitely simulate something like this Zend component with and array or ini file, but here are some good things to mention.</p>
<h2>1. Write a human readable source file</h2>
<p>In fact you can do this even without Zend_Translate. Image you&#8217;ve an ini file with some pairs like:</p>
<pre>
lblMyLabel = "My Label"
</pre>
<p>Nobody says this cannot be &#8220;more&#8221; human readable &#8211; like so:</p>
<pre>
My Label = "My Label"
</pre>
<p>Than you can support several files i.e. en.ini, de.ini, etc. where you can translate this label. The problem is that once you read the ini file you&#8217;ve to deal with those white spaces into the labels, while with Zend_Translate you can simply call them with:</p>
<pre lang="php">
$translate->_("My Label");
</pre>
<h2>2. Default values for missing labels</h2>
<p>Zend_Translate forces you to define a source file. Which is really great, because you always have a default value. Assuming that you don&#8217;t have a specific label translated in one of the ini files, you&#8217;ll get the default value from the source file, and defining source and other files is as easy as:</p>
<pre lang="php">
// en.ini
My Label = "My Label"

// de.ini
...

// while the locale is de_DE you'll have 
// the default value returned
$translate->_("My Label"); // will return My Label from the en.ini
</pre>
<h2>3. Locales</h2>
<p>It&#8217;s really great that you can directly setup a locale for this module. Thus you have more flexibility when switching between languages and you can benefit from the power of the framework when reading some browser specific locales. Here&#8217;s some code:</p>
<pre lang="php">
$translate = new Zend_Translate('ini', 'en.ini', 'en');
$translate->addTranslation('de.ini', 'de');

// than when you setup the translation locale
$translate->setLocale('en');
</pre>
<h2>4. Cache</h2>
<p>One of the greatest things about Zend_Translate is the native support of cache. It&#8217;s so cool! Actually the labels of a large web system are pretty static and don&#8217;t change every day. In other hand in large scale systems there are lots of labels, and the load time will be faster with cache.</p>
<pre lang="php">
$frontendOptions = array('lifetime' => 600, 'automatic_serialization' => true);
$backendOptions  = array('cache_dir' => 'path_to_cache_dir');

$cache = Zend_Cache::factory('Core', 'File', $frontendOptions, $backendOptions);

Zend_Translate::setCache($cache);
</pre>
<p>It&#8217;s a great advantage to use Zend_Translate after all this. Actually I have finished projects without any use of it, but I really can&#8217;t imagine how I&#8217;ll work now without it!</p>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="/2010/07/21/setting-up-global-cache-in-zend-framework/" rel="bookmark" title="Setting Up Global Cache in Zend Framework">Setting Up Global Cache in Zend Framework </a></li>
<li><a href="/2009/05/10/phpini-for-two-web-servers/" rel="bookmark" title="php.ini for two web servers">php.ini for two web servers </a></li>
<li><a href="/2011/01/17/a-memcached-zend_cache/" rel="bookmark" title="A Memcached Zend_Cache">A Memcached Zend_Cache </a></li>
<li><a href="/2010/03/02/fast-way-to-manage-the-arabic-version-of-a-web-form/" rel="bookmark" title="Fast way to manage the Arabic version of a web form">Fast way to manage the Arabic version of a web form </a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>/2010/06/15/use-zend_translate-to-translate-your-web-app/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
