Easy language switching for the documentation website

From: damien clochard <damien(at)dalibo(dot)info>
To: PostgreSQL WWW List <pgsql-www(at)postgresql(dot)org>
Subject: Easy language switching for the documentation website
Date: 2011-07-07 21:24:03
Message-ID: 4E1623F3.80804@dalibo.info
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-www

Hi guys,

For now, the documentation has only two full and up-to-date translations
: Japenese and French... so i guess what i'm gonna talk about will only
concern french and japanese speaking people.

From my personnal experience, I've talked with a lot of French-speaking
PostgreSQL users about the documentation. Most of them read both the
french and the english version, because when they have difficulties to
understand a paragraph, it's a good thing to go to the translations and
get a second chance to understand. It's also usefull when you're
confused by weird translations. For exemple "deadlock" is sometimes
translated as "verrous morts" which sounds really strange when you first
read it :)

Anyway, for the french documentation we ended putting a small javascript
link on each page to jump directly to the english version.

For now, it's only available on the 9.1 doc ( just click on the link
named "Version Anglaise" on the left ) :

http://docs.postgresql.fr/9.1/explicit-locking.html

This works with a very simple js that goes like that :

function jump_to_english() {
var fr_url = location.href;
var fr_pattern = "http://docs.postgresql(.fr|fr.org)/([7-9].[0-4])";
var en_pattern = "http://www.postgresql.org/docs/$2/static";
var reg=new RegExp(fr_pattern, "");
window.location = fr_url.replace(reg,en_pattern) ;
}

So far people seem to like, the only problem is that once you've jump
from French to English, you might want to go backward as easily :)

So here my question : could we add a javascript like the one above on
each english documentation page ? Of course i would have to adapted to
support also Japanese (and maybe german)

If think this would be a big improvements for non-english users and
probably it could motivate people to translate the doc in other
languages. By making existing translations more visible, some people may
ask themselves : "why not translating this page in my own language ?"

I know javascript is not active on every browser and this code is a
quick and dirty hack. But it's simple and it works fine so i really it's
worth trying :-)

Any comments on this is more than welcome !

Regards,

--
damien clochard
dalibo.com | dalibo.org

Responses

Browse pgsql-www by date

  From Date Subject
Next Message Magnus Hagander 2011-07-08 14:01:25 Re: Easy language switching for the documentation website
Previous Message Francisco Figueiredo Jr. 2011-07-05 15:14:12 Re: Pgfoundry problem with Npgsql bug tracker