Context

Localizable, Scopable fields can hold multiple values per attribute, in order to render the correct value we define a context.

The context is initiated pre render of all PDF generation, by default the locale and scope are set on the template.

$context = ['locale' => 'nl_BE'];
 
$productData = [
    'values' => [
        'description' => [
             [
                 'locale' => 'nl_BE',
                 'scope' => null,
                 'data' => 'informatie : ...',
             ],
             [
                 'locale' => 'en_GB',
                 'scope' => null,
                 'data' => 'information : ...',
             ],
        ],
    ],
];

Default value coming from the template context

{{ normalize('description') }}

# becomes : informatie ...

But we can override this context

{{ normalize('description', {'locale': 'en_GB'}) }}

# becomes : information : ...