<spanclass="tomenu"><ahref="#navigation">↓ Menu ↓</a></span>
<spanclass="flush"></span>
</div>
</div>
<divid="titre">
<h1>multi language choices</h1>
</div>
<divclass="flush"></div>
<divid="afterheader"class="article">
<divclass="corps">
<p>I translate most of my blog entries in French and English. Most people advice me to have one file per language. Generally it ends with:</p>
<preclass="twilight">
Bonjour,
voici un exemple de texte en français.
[image](url)
</pre>
<preclass="twilight">
Hello,
here is an example of english text.
[image](url)
</pre>
<p>This way of handling translations force you to write completely an article in one language, copy it, and translate it.</p>
<p>However, most of time, there are common parts like images, source code, etc… When I want to correct some mistake on these parts, I have to make twice the work. With sometimes adding another mistake in only one language.</p>
<p>This is why I preferred to handle it differently. I use <em>tags</em> on a single file. Finally my files looks like:</p>
<preclass="twilight">
fr: Bonjour,
en: Hello,
en: here is an example of english text.
fr: voici un exemple de texte en français.
[image](url)
</pre>
<p>As I edit my files with <ahref="http://vim.org">vim</a>, it is really easy to add <code>fr:</code> or <code>en:</code> at some line’s beginning using the useful <code>C-v</code>. However <ahref="http://nanoc.stoneship.org">nanoc</a> was conceived to be used for one language only. Or to be used with the first method. I tried to adapt nanoc to my usage. But after a while, I found it easier to pre-filter the nanoc work by a simple script. My script transform my file into two new files. And all work like a charm.</p>
<p>You can get my blog code source (without most of articles) at <ahref="http://github.com/yogsototh/Scratch">github.com/yogsototh/Scratch</a>.</p>