Translating custom field label in business.custom_fields

Hi,

I was currently having trouble translating a custom field label in the Business details (Reg-kood and Pank)
My code in the custom theme is:

            {% for field in business.custom_fields %}
            <div>
			    {% if field.label == "Reg-kood" %}
			    {{ field.label | replace: "Reg-kood", "Company Code" }}
				{% elsif field.label == "Pank" %}
				{{ field.label | replace: "Pank", "Bank" }}
				{% else field.label %}
                {{ field.label }}
				{% endif %}
			 &nbsp;{{ field.text }}
			</div>

However, these field labels are not translated in the output

Can anyone help in this regard?

Best regards

Maybe you have a spelling mismatch. Try replacing == with contains and see if it helps.

Also, why are you looping through the field when you can select them like this: business.custom_fields['Pank'].label

1 Like

Many thanks @Ealfardan!

Replacing == with contain solved the problem.

As for your second suggestion … then my knowledge about Liquid is … not so good, yet. But I’m learning :slight_smile:
I’m trying to test this solution, too.

Thanks and best regards

1 Like