1

I have a website with three locales (de, fr, it). On a Matrix Field i have Assets where are only uploaded in German language. Now i'm trying to show those assets also in French and Italian language.

Any ideas to solve this? I have tried to put a .locale('de') to get the german fields, but if i change the language, the assets are not displayed.

Here is my code:

    {% for entry in craft.entries.section('sitemap','staticContent').status('live').slug(lastSegment).limit(1) %}

    {% for block in entry.multiContent %}

        {% if block.type == "documents" and block.downloadbarAlsDigitalesDokument == "1" %}

            <div class="section-content-downloads">

                <div class="container">

                    {% set items = block.datei %}

                    <ul class="list-unstyled">

                        {% for item in items %}

                            <li>
                                <a href="{{ item.url() }}" title="Download: {{ item.title }}" target="_blank"><i class="fa fa-file-{{ item.extension }}-o"></i> {{ item.title }}</a>
                            </li>

                        {% endfor %}

                    </ul>

                </div>

            </div>
        {% endif %}

    {% endfor %}

{% endfor %}
  • 1
    Did you try to append that locale('de') parameter to the matrix criteria entry.multiContent? – carlcs Mar 31 '16 at 23:11
  • yes, but the prob is, that then all the content from this matrix field is served in german. i only need the german assets to be shown in all locales. the other matrix fields are translated as usual. – Omar De-Giuli Apr 1 '16 at 9:36
  • How do you determine the position of the asset blocks, if they only exist in the german matrix? – carlcs Apr 1 '16 at 9:39
  • not yet... i do a normal for loop like described in the craft docs. the only exception are the uploaded assets. they are only set in the german language, because i whant that those downloads are presented similar on the other two languages. we don't upload a localized version on each locale. i hope you understand me, my english is very bad. – Omar De-Giuli Apr 1 '16 at 10:18
1

@carlcs helped me in Craft Slack. Many thx to him. The solution at the end was to pull out the asset field from the main matrix field and to put them in a separate without localisation enabled.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.