<linkrel="alternate"lang="fr"xml:lang="fr"title="choix liés à l'écriture dans plusieurs langues"type="text/html"hreflang="fr"href="/Scratch/fr/blog/2010-06-14-multi-language-choices/"/>
<linkrel="alternate"lang="en"xml:lang="en"title="multi language choices"type="text/html"hreflang="en"href="/Scratch/en/blog/2010-06-14-multi-language-choices/"/>
<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/nanoc3_blog">github.com/yogsototh/nanoc3_blog</a>. I’ll make a new blog entry about how to use it. I added many scripts and libraries to help making nice website.</p>