Chailloux - Żelaska

  drapeau français  Arbre des familles Chailloux - Żelaska

  flaga polska  Drzewa Chailloux - Żelaskich

  English flag  Chailloux - Żelaska family tree

An attempt to produce a Gramps multilingual Web Site

This multilingual (French, Polish and English) Chailloux - Żelaska Family Web Site uses the regular "Narrative Web" reporting tool provided by Gramps 3.3.1 with some very small extensions. It allows each page to switch from a language to another using a simple javascript function. I tried to make the minimum changes in the Gramps source in order to facilitate the future updates. The flags are located at the end of the navigation bar.

The 2 changes in 'NarrativeWeb.py'

Change 1: add the changelang function #<JER> add, after 'head += links' instruction, the changelang function head += "\n <script>function changelang(lang) { var nang = '/' + lang + '/'; var ourl = window.location.href; var nurl = ourl.replace ('/fr/', nang); nurl = nurl.replace ('/pl/', nang); window.location.href = nurl.replace ('/en/', nang); } </script> \n" #</JER> Change 2: add the 3 flags #<JER> the 3 flags, close to the end of 'def display_nav_links' ul += '<li>     </li>' fr_url = self.report.build_url_fname("graphics/nav32x16_fr.png", None, self.up) ul += '<li><a href="javascript:changelang(\'fr\')" title="page en français">' + '<img alt="drapeau français" title="drapeau français" src="' + fr_url + '" width="32" height="16" /></a></li>' pl_url = self.report.build_url_fname("graphics/nav32x16_pl.png", None, self.up) ul += '<li><a href="javascript:changelang(\'pl\')" title="Wersja Polska">' + '<img alt="Polska Flaga" title="Polska Flaga" src="' + pl_url + '" width="32" height="16" /></a></li>' en_url = self.report.build_url_fname("graphics/nav32x16_en.png", None, self.up) ul += '<li><a href="javascript:changelang(\'en\')" title="Page in English">' + '<img alt="English Flag" title="English Flag" src="' + en_url + '" width="32" height="16" /></a></li>' #</JER> just before the last navigation += ul

The pages generation script

#/bin/sh HOME='/home/jerome' SITE="/u/sites" BASE="$SITE/www.chailloux.org/public/geneal/gramps" rm -r $BASE/images/* rm -r $BASE/thumb/* rm -r $BASE/fr/* rm -r $BASE/pl/* rm -r $BASE/en/* ln -s $BASE/images $BASE/fr/images ln -s $BASE/thumb $BASE/fr/thumb ln -s $BASE/images $BASE/pl/images ln -s $BASE/thumb $BASE/pl/thumb ln -s $BASE/images $BASE/en/images ln -s $BASE/thumb $BASE/en/thumb DB="$HOME/.gramps/grampsdb/4a79636a" OPT1="of=$SITE," OPT2="filter=0,living=True,incpriv=False,yearsafterdeath=21," OPT3="incdownload=False,inc_events=False,inc_repository=False,birthorder=True," OPT4="encoding=UTF-8,papers=A4,pid=I0000," OPT5="homenote=N0000,intronote=N0000,contactnote=N0000" OPT=$OPT1$OPT2$OPT3$OPT4$OPT5 # FR LANGUAGE=fr_FR:fr LANG=fr_FR.UTF-8 gramps -O $DB --action=report \ --options=name=navwebpage,target=$BASE/fr,homenote=N1010,title="Arbre des familles Chailloux - Żelaska",$OPT # PL LANGUAGE=pl_PL:pl LANG=pl_PL.UTF-8 gramps -O $DB --action=report \ --options=name=navwebpage,target=$BASE/pl,homenote=N1011,title="Drzewo rodziny Chailloux - Żelaskich",$OPT # EN LANGUAGE=en_EN:en LANG=en_EN.UTF-8 gramps -O $DB --action=report \ --options=name=navwebpage,target=$BASE/en,homenote=N1012,title="Chailloux - Å»elaska family tree",$OPT

The resulting Web Site size

Why it is so important to share the images and the thumb directories among the various languages:
 
$ du -s * 84220 en 84456 fr 64 graphics 281528 images 8 index.html 86672 pl 28532 thumb $