[Product-Developers] functional test in translated portal

Carsten Senger senger at rehfisch.de
Sun Jan 25 18:14:13 UTC 2009

I've an functional test where I use Five's testbrowser. Everything 
generally works. Now I want to browser through a translated user 
interface in German.
But I don't get translatable parts of the page in German. Maybe the 
message catalogs or other part of the translation machinery are not 
loaded? I tried to load the zcml from PloneTranslations, but that did 
not make a difference.

Here are some parts of my doctest:

   >>> from Products.Five.testbrowser import Browser
   >>> browser = Browser()
   >>> browser.addHeader('Accept-Language', 'de,de-DE')

Without configuring Plone, the content language is English.

   >>> browser.open('http://nohost/plone')
   >>> browser.headers['content-language']

I switched the portal's language to German

   >>> from plone.app.controlpanel.language import \
   ... LanguageControlPanelAdapter

   >>> lcpa = LanguageControlPanelAdapter(self.portal)
   >>> lcpa.set_default_language('de')

If I now use the browser I get a response where the
content-language is German.

   >>> browser.open('http://nohost/plone')
   >>> browser.headers['content-language']

But translatable strings in the response are still English

   >>> 'Log in' in browser.contents
   >>> 'Anmelden' in browser.contents


More information about the Product-Developers mailing list