Skip site navigation (1) Skip section navigation (2)

Re: Easy language switching for the documentation website

From: damien clochard <damien(at)dalibo(dot)info>
To: Magnus Hagander <magnus(at)hagander(dot)net>
Cc: PostgreSQL WWW List <pgsql-www(at)postgresql(dot)org>
Subject: Re: Easy language switching for the documentation website
Date: 2011-07-08 14:46:53
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-www
Le 08/07/2011 16:01, Magnus Hagander a écrit :
> 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 ) :
>> 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|[7-9].[0-4])";
>>  var en_pattern = "$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? 

Yes. For the french doc, we keep the  original english filenames. I
assume the japanese and germans do the same....

> 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?

Sure! I just don't know how to do that :) The javascript way was just
easier for me :)

If someone wants to implement a real link it's even better :)

damien clochard |

In response to

pgsql-www by date

Next:From: Dave PageDate: 2011-07-08 15:06:32
Subject: Re: Easy language switching for the documentation website
Previous:From: Magnus HaganderDate: 2011-07-08 14:01:25
Subject: Re: Easy language switching for the documentation website

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group