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 multilingual Gramps Web Site

This multilingual (French, Polish and English) Chailloux - Żelaska Family Web Site uses the regular "Narrative Web" reporting tool provided by Gramps 4.2.5 with two small extensions (5 lines!). It allows, for each page, to switch from a language to another by clicking the corresponding flag located at the end of the navigation bar. I tried to make the minimum changes in the Gramps source in order to facilitate future updates.

The 2 extensions in 'NarrativeWeb.py'

Extension 1: add the 'changelang' javascript function #<JER> add in the 'write_header function', just 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> Extension 2: add the 3 flags in the navigation bar #<JER> insert the 3 flags, at the end of 'def display_nav_links' function unordered.extend('<li>&nbsp; &nbsp; &nbsp;</li>') unordered.extend('<li><a href="javascript:changelang(\'fr\')" title="page en français">' + '<img alt="drapeau français" title="drapeau français" src="' + self.report.build_url_fname("graphics/nav32x16_fr.png", None, self.up) + '" width="32" height="16" /></a></li>') unordered.extend('<li><a href="javascript:changelang(\'pl\')" title="Wersja Polska">' + '<img alt="Polska Flaga" title="Polska Flaga" src="' + self.report.build_url_fname("graphics/nav32x16_pl.png", None, self.up) + '" width="32" height="16" /></a></li>') unordered.extend('<li><a href="javascript:changelang(\'en\')" title="Page in English">' + '<img alt="English Flag" title="English Flag" src="' + self.report.build_url_fname("graphics/nav32x16_en.png", None, self.up) + '" width="32" height="16" /></a></li>') #</JER> just before the last container += unordered

The pages generation script

#/bin/bash HOME='/home/jerome' SITE="/u/sites" BASE="$SITE/www.chailloux.org/public/geneal/gramps" GRAMPS=gramps DB="$HOME/.gramps/grampsdb/4e8a2118" OPT1="of=$SITE,filter=0,living=0,incl_private=False,birthorder=True,yearsafterdeath=22," OPT2="incdownload=False,inc_events=False,inc_repository=False,inc_addressbook=False," OPT3="inc_families=False,gallery=True,create_thumbs_only=False," OPT4="encoding=UTF-8,papers=A4,name_format=2,cright=6," OPT5="pid=I0000,homenote=N0000,intronote=N0000,contactnote=N0000" OPT=$OPT1$OPT2$OPT3$OPT4$OPT5 rm -r $BASE/images/* rm -r $BASE/thumb/* for LANG in fr pl en do rm -r $BASE/$LANG/* ln -s $BASE/images $BASE/$LANG/images ln -s $BASE/thumb $BASE/$LANG/thumb ln -s $BASE/graphics $BASE/$LANG/graphics done # FR LANGUAGE=fr_FR:fr LANG=fr_FR.UTF-8 $GRAMPS -O $DB --action=report \ --options=name=navwebpage,target=$BASE/fr,title="Arbre des familles Chailloux - Zelaska",$OPT # PL LANGUAGE=pl_PL:pl LANG=pl_PL.UTF-8 $GRAMPS -O $DB --action=report \ --options=name=navwebpage,target=$BASE/pl,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,title="Chailloux - Zelaska family tree",$OPT

The resulting Web Site size

Why it is important to share the images and the thumb directories among the various languages:
 
$ du -s * 113708 en 114184 fr 64 graphics 337180 images 8 index.html 113920 pl 33712 thumb $