I've solved the initial problem by doing a language check in the Twig template. So far so good.
But I still suffer som problems from the Admin panel. When I save a page it changes the header in a way that makes it not work anymore.
The error I get looks like this:
Twig_Error_Runtime thrown with message "An exception has been thrown during the rendering of a template ("Array to string conversion") in "partials/product-preview.html.twig" at line 6."
Line 6 in the Twig-file looks like this:
<h4>{{ product.header.taxonomy.type }}</h4>
The original working header looks like this:
title: foo
menu: foo
slug: foo
taxonomy:
category: something
tag: something
type: something
content:
items: '@self.modular'
order:
by: default
dir: asc
custom:
- _foo
- _bar
short_facts:
- fact_name: foo
fact: bar
- fact_name: foo
fact: bar
- fact_name: foo
fact: bar
- fact_name: foo
fact: bar
and after saving the page in the Admin panel it looks like this:
title: something
menu: something
slug: something
taxonomy:
type:
- 'something'
tag:
- something
category:
- 'Something'
content:
items: '@self.modular'
order:
by: default
dir: asc
custom:
- _foo
- _bar
short_facts:
-
fact_name: 'Foo'
fact: 'Bar'
-
fact_name: 'Foo'
fact: 'Bar'
-
fact_name: 'Foo'
fact: 'Bar'
-
fact_name: 'Foo'
fact: 'Bar'
The error I get suggest that it has something to do with the taxonomy type property. But the only difference I can see are the citation marks and the spacing. What am I missing?