20130727 (Saturday, 27 July 2013)

Multilingual userdocs

Fixed a bug in yesterday’s select_lang.html.

A project with multilingual userdocs no longer needs its own select_lang.html template, and the conf.py should no longer set templates_path because atelier.sphinxconf.configure() now sets it to:

['.templates',Path(__file__).parent.absolute()]

The select_lang.html template is now part of the atelier.sphinxconf package.

The fabfile.py of a project with multlingual userdocs should now specify the Django settings module of the demo database as second argument to atelier.fablib.setup_from_project(). Example:

from atelier.fablib import *
setup_from_project('lino_faggio','lino_faggio.settings.demo')

This will automatically set env.demo_databases and env.languages to the correct value.

The userdocs for Lino-Welfare were French-based until now. I switched to EN also for this project. This has the disadvantage that I must sometimes research certain specialized vocabulary, but certain advantages which I (meanwhile) consider more important:

  • reusability of userdocs from or to other projects
  • a chance for non-Belgians to read about what it does

Belgian vocabulary

Added two new entries to lino.projects.belref.fixtures.demo.

yield C(
“LEA (Local Employment Agency)”, “LBA (Lokale Beschäftigungsagentur)”, “ALE (Agence locale pour l’emploi)”, “PWA (Plaatselijk werkgelegenheidsagentschap)”)
yield C(
“NEO (National Employment Office)”, “LfA (Landesamt für Arbeitsbeschaffung)”, “ONEM (Office national de l’emploi)”, “RVA (Rijksdienst voor Arbeidsvoorziening)”)

Upgraded to Babel 1.0

Armin Ronacher has released the long-awaited Babel 1.0. I just did pip install -U Babel.

The new Babel version even fixes a bug in Estonian full date format which I hadn’t yet noticed. After upgrading Babel, one of my test suites failed in Multilingual database content which –as i then noticed– contained indeed a wrong example.

A hide_languages set per UserProfile

The test suite for Lino Welfare failed because now the demo database has one language more. Instead of adapting lots of test cases in test docs I decided to use this as an excuse to implement a new feature which nobody has asked until now but which I had been wanting for some time: it is about multilingual Lino sites with many different languages (more than four or five). Such sites (until now) would have a problem because Lino always wants to expand all babel fields horizontally. Users of such sites probably don’t want to see all languages at once. So Lino needs to provide a possibility to specify per UserProfile a subset of the site’s languages.

  • New method north.north_site.Site.resolve_languages()
  • Applications can use the new feature by specifying a hide_languages attribut for either the whole UserProfiles list or for individual profiles.

The new feature works nice but didn’t spare me from going through the tested docs.

The new languages distribution of the Welfare demo database required another change: until now the default language for new partners was simply the database’s default language. This approach might be too simple in centres in Brussels where a Flemish user won’t like to have French as default when she creates a new client. And vice-versa.

Another problem is that we can’t deny the fact that Lino-Welfare is currently being used only in the German-speaking region. This is why I added a new method north.north_site.Site.get_default_language().