We have some Plone application with a particular template that uses i18n properly when used as standard Plone browser view. For different usecase we re-use the same code and template for scripts running under control of "bin/instance run ..." like:
obj = our_plone.restrictedTraverse("some/path/to/object")
app.request.LANGUAGE = 'de'
obj.request = app.request
from our_view import View
view = View(obj, obj.request)
view.render()
with an implementation of View
like
class View(BrowserView):
template = ViewPageTemplateFile("some.pt")
def render(self):
return self.template(self.context)
I assume that the translation is picked up from the request.LANGUAGE
attribute.
But I only see the untranslated original strings from the template. As said: translating properly when used inside a Plone browser view.