Leon Schwanitz
Leon Schwanitz

Reputation: 283

Shopware 6 App | How to translate custom fields

We build an app and want a snippet / translation for Shopware 6 custom fields (https://developer.shopware.com/docs/guides/plugins/apps/custom-data/custom-fields)

Is it possible to add a translation text for every category?

<custom-fields>
        <custom-field-set>
            <name>minds_show_category_discount</name>
            <label>Show Discount</label>
            <label lang="de-DE">Rabatt anzeigen</label>
            <related-entities>
                <category />
            </related-entities>
            <fields>
                <bool name="minds_scd_category_enabled">
                    <label>Show discount</label>
                    <label lang="de-DE">Rabatt anzeigen</label>
                    <position>1</position>
                </bool>

                <!-- Here I would like to input a text that is translatable -->
            </fields>
        </custom-field-set>
    </custom-fields>

Upvotes: 1

Views: 918

Answers (1)

dneustadt
dneustadt

Reputation: 13161

There is no plain text element to use in custom fields. As the name suggests the elements are types of different inputs, dropdowns, checkboxes and so on. If you want to add a descriptive text to one of those UI elements you can use the help-text property, which is also translatable.

<label>Lorem</label>
<label lang="de-DE">Ipsum</label>
<help-text>Lorem</help-text>
<help-text lang="de-DE">Ipsum</help-text>

All translations for labels and help-texts etc will be the same across all categories and can't be different on a category-by-category level if that is what you meant.

Upvotes: 2

Related Questions