[Solved/Workaround] ViewPageTemplateFile not using translations when running under "bin/instance run ..."

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.

This topic may apply to your issue too: Using LANGUAGE_TOOL.LANGUAGE to specify language of translated strings in TAL template -what makes this work?

There is no plone.app.multilingual or something similar involved and the related hints did not help.
As a workaround I wrapped the used a view helper translate method that I call from the template instead...not nice but working...

Plone Foundation Code of Conduct