Re: Easy language switching for the documentation website

From: Magnus Hagander <magnus(at)hagander(dot)net>
To: damien clochard <damien(at)dalibo(dot)info>
Cc: PostgreSQL WWW List <pgsql-www(at)postgresql(dot)org>
Subject: Re: Easy language switching for the documentation website
Date: 2011-07-08 14:01:25
Message-ID: CABUevEznDhhZxD6ds2KU2QQM1RS9WiuKwHxXC_8ObWz=wR_8dg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-www

On Thu, Jul 7, 2011 at 23:24, damien clochard <damien(at)dalibo(dot)info> wrote:
> 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 !

This thing relies upon the URLs being the same, right? So if we want
to do that, why do we need to fiddle with javascript - we could just
put links directly into the templates and have "real links" instead of
javascript, no?

--
 Magnus Hagander
 Me: http://www.hagander.net/
 Work: http://www.redpill-linpro.com/

In response to

Responses

Browse pgsql-www by date

  From Date Subject
Next Message damien clochard 2011-07-08 14:46:53 Re: Easy language switching for the documentation website
Previous Message damien clochard 2011-07-07 21:24:03 Easy language switching for the documentation website