Welcome | Get started | Dive | Contribute | Topics | Reference | Changes | More

Code snippets for testing Lino’s i18n

Users Overview in different languages

We use the users.UsersOverview table for testing some basic i18n functionality. Since we are interested only in the column headers and not to see all users, we add a filter:

>>> kw = dict(known_values=dict(username='robin'))

The non-translated result is:

>>> ses = rt.login('robin')
>>> ses.show('users.UsersOverview', language='en', **kw)
========== ===================== ==========
 Username   User type             Language
---------- --------------------- ----------
 robin      900 (Administrator)   en
========== ===================== ==========

Now we look at this table in different languages:

>>> ses.show('users.UsersOverview', language='de', **kw)
============== ================= =========
 Benutzername   Benutzerart       Sprache
-------------- ----------------- ---------
 robin          900 (Verwalter)   en
============== ================= =========
>>> ses.show('users.UsersOverview', language='fr', **kw)
=================== ====================== ========
 Nom d'utilisateur   Type d'utilisateur     Langue
------------------- ---------------------- --------
 robin               900 (Administrateur)   en
=================== ====================== ========
>>> ses.show('users.UsersOverview', language='et', **kw)
============== ====================== ======
 Kasutajanimi   Kasutajaliik           Keel
-------------- ---------------------- ------
 robin          900 (Administraator)   en
============== ====================== ======
>>> ses.show('users.UsersOverview', language='pt', **kw)
================= ===================== ========
 Nome de usuário   User type             Idioma
----------------- --------------------- --------
 robin             900 (Administrador)   en
================= ===================== ========
>>> ses.show('users.UsersOverview', language='pt-br', **kw)
================= ===================== ========
 Nome de usuário   User type             Idioma
----------------- --------------------- --------
 robin             900 (Administrador)   en
================= ===================== ========