scratch/content/html/en/blog/2010-06-14-multi-language-choices.md
Yann Esposito (Yogsototh) faa298c7bf finished blog entry
2010-06-15 00:20:26 +02:00

1.9 KiB

isHidden menupriority kind created_at title author_name author_uri tags
false 1 article 2010-06-14T16:14:57+02:00 multi language choices Yann Esposito yannesposito.com
multi-language
blog

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:

Bonjour, 

voici un exemple de texte en français.
[image](url)
Hello, 

here is an example of english text.
[image](url)

This way of handling translations force you to write completely an article in one language, copy it, and translate it.

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.

This is why I preferred to handle it differently. I use tags on a single file. Finally my files looks like:

 fr:   Bonjour, 
 en:   Hello, 

 en:   here is an example of english text.
 fr:   voici un exemple de texte en français.
[image](url)

As I edit my files with vim, it is really easy to add fr: or en: at some line's beginning using the useful C-v. However nanoc 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.

You can get my blog code source (without most of articles) at github.com/yogsototh/nanoc3_blog. I'll make a new blog entry about how to use it. I added many scripts and libraries to help making nice website.