How to set Translation Domain for all Viewhelpers

We have an web application with the following configuration:

  • we use lamias-i18n, laminas-view and laminas-form
  • the app is customized for some partners, the language configuration is stored in the db and is loaded dynamically

Some of our partners want special texts in their layout. We configured translation domains for that.

Actual we translate the texts inside the view script and set them into the forms after that. This causes a lot of Translation-not-found-Messages for the the already translated texts.

I created a service to configure the translator with the partner specific locale.

But how can I set the translation domain globally?

I have never tried this, but here is a suggestion.

The trait Laminas\View\Helper\TranslatorAwareTrait contains methods for setting and retrieving a translation domain which are used by the different view helpers:

A delegator that sets the translation domain and is registered for all relevant view helpers could help here.