<?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>Talk Unafraid &#187; i18n</title>
	<atom:link href="http://www.talkunafraid.co.uk/tag/i18n/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.talkunafraid.co.uk</link>
	<description>The (occasionally coherent) ramblings of a geek</description>
	<lastBuildDate>Sat, 07 Jan 2012 22:24:46 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Rails I18n Tips</title>
		<link>http://www.talkunafraid.co.uk/2008/10/rails-i18n-tips/</link>
		<comments>http://www.talkunafraid.co.uk/2008/10/rails-i18n-tips/#comments</comments>
		<pubDate>Mon, 27 Oct 2008 19:59:15 +0000</pubDate>
		<dc:creator>James Harrison</dc:creator>
				<category><![CDATA[Code Snippets and Examples]]></category>
		<category><![CDATA[Nexus]]></category>
		<category><![CDATA[i18n]]></category>
		<category><![CDATA[rails]]></category>

		<guid isPermaLink="false">http://www.talkunafraid.co.uk/?p=37</guid>
		<description><![CDATA[I&#8217;ve just finished implementing and localising Nexus in it&#8217;s entirety. It&#8217;s a weighty YAML file of translations, weighing in at just over 350 phrases and words. I thought I&#8217;d share my tips on implementation as there seem to be a few gotchas. For me, load_path didn&#8217;t quite work as intended, so I came up with [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve just finished implementing and localising Nexus in it&#8217;s entirety. It&#8217;s a weighty YAML file of translations, weighing in at just over 350 phrases and words.</p>
<p>I thought I&#8217;d share my tips on implementation as there seem to be a few gotchas. For me, load_path didn&#8217;t quite work as intended, so I came up with this:</p>
<div class="geshi no ruby">
<div class="head">I18n.default_locale = &#39;en-GB&#39;</div>
<ol>
<li class="li1">
<div class="de1"><span class="kw4">Dir</span>.<span class="me1">glob</span><span class="br0">&#40;</span><span class="st0">&quot;#{RAILS_ROOT}/lib/locale/*.{yml|rb}&quot;</span><span class="br0">&#41;</span>.<span class="me1">each</span> <span class="kw1">do</span> <span class="sy0">|</span>f<span class="sy0">|</span></div>
</li>
<li class="li1">
<div class="de1">  I18n.<span class="me1">backend</span>.<span class="me1">load_translations</span> f</div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">end</span></div>
</li>
</ol>
</div>
<p>This goes in environment.rb after the Rails Initializer, and loads in all the translation files I have in /lib/locale. Once loaded, you can set the locale you want in a set_locale method as before_filter in ApplicationController and you&#8217;re set. You can now use I18n.t(&#8216;key&#8217;) in views and so on</p>
<p>Some tips and warnings, however.</p>
<ul>
<li>Don&#8217;t reuse phrases. What&#8217;s reusable in one language may not be in another.</li>
<li>Namespace. I made the fatal mistake of not namespacing enough- I would recommend models, views and controllers as your bases.</li>
<li>Where possible, keep HTML out of your YAML. It makes it easier to read and keeps formatting and style to views instead of localisation material.</li>
</ul>
<p>And don&#8217;t lose hope. It took me a solid day sat down working through the app to get everything sorted out for Nexus, but it&#8217;s very much worth it! Now the next challenge-finding translators&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.talkunafraid.co.uk/2008/10/rails-i18n-tips/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Nexus, Rails 2.2, I18n</title>
		<link>http://www.talkunafraid.co.uk/2008/10/nexus-rails-22-i18n/</link>
		<comments>http://www.talkunafraid.co.uk/2008/10/nexus-rails-22-i18n/#comments</comments>
		<pubDate>Mon, 27 Oct 2008 01:39:30 +0000</pubDate>
		<dc:creator>James Harrison</dc:creator>
				<category><![CDATA[Nexus]]></category>
		<category><![CDATA[Odds and Ends]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[EVE]]></category>
		<category><![CDATA[frontend]]></category>
		<category><![CDATA[i18n]]></category>
		<category><![CDATA[nexus]]></category>
		<category><![CDATA[rails]]></category>

		<guid isPermaLink="false">http://www.talkunafraid.co.uk/?p=34</guid>
		<description><![CDATA[Now I&#8217;ve finished off EVE Metrics&#8217;s indexes (Performance tweaks are nearly done, just waiting on a few external patches for various bits and pieces) I&#8217;m cracking on with Nexus. I figured a good thing to do would be to rewrite all my views, partly to tidy them up a bit in places, partly to ensure [...]]]></description>
			<content:encoded><![CDATA[<p>Now I&#8217;ve finished off EVE Metrics&#8217;s indexes (Performance tweaks are nearly done, just waiting on a few external patches for various bits and pieces) I&#8217;m cracking on with Nexus. I figured a good thing to do would be to rewrite all my views, partly to tidy them up a bit in places, partly to ensure everything was written to W3C standards, and partly to implement Internationalisation (Otherwise known as I18n).</p>
<p>Rails 2.2 comes with I18n built in, so I&#8217;ve been using that. It&#8217;s a slow process, turning every string into it&#8217;s own categorised, indexed line. It&#8217;s all in YAML though, so I can easily work on it freehand without needing to worry about complex systems for storage. The one downside is I get to reload my development server to see changes to the pages, but that&#8217;s not too big an issue. It&#8217;s easy to use and works like a charm, so it fits the bill for my purposes.</p>
<p>Also, Rails 2.2 is thread safe! I&#8217;m interested to see what this does performance-wise on Passenger. Load on my server isn&#8217;t a problem but memory is my main concern- Passenger with Ruby Enterprise Edition works great by sharing common elements in memory to reduce usage, but thread safe Rails means I should be able to get away with running fewer servers in the first place. I&#8217;ll spend some time with JMeter and New Relic RPM at some point to see what the real-world gains are.</p>
<p>My next challenge is going to be creating a decent looking fittings/kill display interface. I&#8217;ve learned a lot working on the TacMap, and have some ideas for how I&#8217;m going to display fittings. I don&#8217;t think I&#8217;ll use the ingame fittings screen picture with overlays; it&#8217;s overly complex and imo there&#8217;s better ways to show fittings. Considering one of the main goals with Nexus is high performance and given the slashdot-effect style killboard spammings that occur whenever a big kill gets scored, I&#8217;d like to try and keep the SQL loading down to a minimum.</p>
<p>I&#8217;m also trying to work out what the best way of handling caching will be. My whole configuration system thus far is getting looked at sternly- I&#8217;m using Configatron, but think I need something a little beefier than that which supports some kind of webinterface for editing configuration values. Still, that&#8217;s a problem for another day.</p>
<p>On the EVE front, Shrike lost his titan. Again. In exactly the same way (cloaked off a gate). Yay.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.talkunafraid.co.uk/2008/10/nexus-rails-22-i18n/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

