<?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>meier-online &#187; Translation</title>
	<atom:link href="http://meier-online.com/tag/translation/feed/" rel="self" type="application/rss+xml" />
	<link>http://meier-online.com</link>
	<description>Der Blog von Karsten Meier</description>
	<lastBuildDate>Sun, 09 Oct 2011 13:27:57 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Multilingual Websites with Ruby on Rails</title>
		<link>http://meier-online.com/en/2009/04/localize-ruby-on-rails/</link>
		<comments>http://meier-online.com/en/2009/04/localize-ruby-on-rails/#comments</comments>
		<pubDate>Sat, 11 Apr 2009 21:09:44 +0000</pubDate>
		<dc:creator>meier</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[multilingualism]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Translation]]></category>

		<guid isPermaLink="false">http://meier-online.com/?p=370</guid>
		<description><![CDATA[Part 1 &#8211; Overview Writing software for several languages is an ever recurrent challenge. Ruby on Rails provides solutions to most of the standard problems in web development. But it needed time until the version 2.2. for the &#8220;Internationalization API &#8221; to become an official part of Ruby on Rails. . Structure of the framework [...]]]></description>
			<content:encoded><![CDATA[<h3>Part 1 &#8211; Overview</h3>
<p>Writing software for several languages is an ever recurrent challenge. Ruby on Rails provides  solutions to most of the standard problems in web development. But it needed time until the version 2.2. for the &#8220;Internationalization API &#8221; to become an official part of Ruby on Rails. .</p>
<p><img class="alignnone size-full wp-image-374" title="The Ruby-On-Rails Internationalization module" src="http://meier-online.com/blog/uploads/rails-i18n.png" alt="The Ruby-On-Rails Internationalization module" width="480" height="300" /></p>
<p><span id="more-370"></span></p>
<h3>Structure of the framework</h3>
<p>The framework consists of a &#8220;public&#8221; and a &#8220;private&#8221; part. The I18N module forms the public part with the methods that we call in our code. The private backend is interchangeable. The standard implementation reads the texts from files in Yaml format or from normal ruby files.</p>
<h3>Calling</h3>
<p>In our code, we replace all the text to be translated with the <em>I18N.translate()</em> method. Thanks to an alias definition, we can simply write <em>t()</em>. We give a key as parameter, and the backend uses this key to look up the correct translation.</p>
<p>The key is a string or a symbol. Normally, look up by symbol is slightly more efficient. But since the key gets decomposed into its components during the processing, I expect that this advantage disappears.</p>
<p>In a typical web application, many of the texts to be translated are found in the views, ie. Erb templates. As an abbreviation for pure HTML text, there is the following tag:</p>
<pre>&lt;%=t 'key' %&gt;</pre>
<h3>Organization of keys</h3>
<p>The keys have a hierarchical structure. The suggested organization is:</p>
<p>&#8220;Controllername.viewname.key&#8221;, for example &#8216;companies.show.header&#8217;</p>
<h3>The language files</h3>
<p>The language files can either be Ruby code files or text files in Yaml format.  The person who translates is often a person without Ruby knowledge. That is why the Yaml file format is recommended.</p>
<p>The format looks like this:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">de:
  users:
    show:
      header: &quot;Company Data&quot;
      intro: &quot;For this company, we have stored the following data:&quot;</pre></div></div>

<p>The first key part the language code. This has the disadvantage that it separates the text entries of different languages. To help the translators, you can insert comments by marking a line with a beginning &#8216;#&#8217; character . And of course, you should name the keys as clear as possible.</p>
<p>But even then, when developer and translator are not the same person, I think the Yaml file format is not optimal.</p>
<p>Part 2 of this article will soon be translated to English.</p>
]]></content:encoded>
			<wfw:commentRss>http://meier-online.com/en/2009/04/localize-ruby-on-rails/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

