Accentuate Custom Fields
  • Welcome!
  • Introduction
    • Getting started with ACF
    • Field scopes
    • How to show fields in your storefront
  • Dashboard
    • Reference Manager
      • Creating a new reference within Reference Manager
    • Filter & Group
      • Filter editor
      • Filter usage
    • Activity log
    • App settings
  • Field Definitions
    • Fields & Sections
    • Deciding on a field type
    • ACF Field types
      • Text
      • Markdown text
      • HTML
      • Checkbox
      • Selection
      • Tags
      • Number
      • Date
      • Color
      • Media v1 (legacy)
      • Media v2
      • Custom Object (JSON)
      • Multi-language Text
      • Reference fields
      • References to Global fields
    • Shopify Field types
      • Shopify » Single line text
      • Shopify » Multi-line text
      • Shopify » Boolean
      • Shopify » Color
      • Shopify » Custom objects (JSON)
      • Shopify » URL
      • Shopify » Date
      • Shopify » Date and Time
      • Shopify » Integer
      • Shopify » Decimal
      • Shopify » Weight
      • Shopify » Volume
      • Shopify » Dimensions
      • Shopify » Reference fields
    • Automatic tagging
    • Large sets
    • Field contexts
    • Field context filters
    • Copy and paste fields
    • Change field name and type
    • Import existing fields
    • Linking multiple stores
  • The Editor
    • Using the editor
    • Promote fields to sidebar
    • Layouts
    • Hide from search
    • Repeatable fields
    • Version control
    • Update value on order creation
  • Bulk Import & Export
    • Export custom field values
    • Import custom field values
    • Metaobject export / import
  • METAOBJECTS
    • What are Metaobjects?
    • Metaobject Definitions
    • Metaobject instances / values
    • Displaying Metaobjects on your storefront
    • Metaobject export / import
  • THEME EXTENSIONS
    • SEO keywords
    • Sticky promo bar
    • Products promotion
  • Liquid Guides
    • Learning Liquid
    • Resize & crop images
    • Check for empty values
    • Access field definitions
    • Order notifications
    • Allow customers to change their field values
  • OTHER
    • Webhooks
    • API
      • Access to custom fields
      • Endpoints
  • Help
    • FAQ
      • Why are one of my products no longer showing in my reference field?
      • I have multiple products/variants with the same name
      • How do I make changes to my field values in bulk?
      • I added a new field definition but it is not showing in my storefront
      • How do I copy my field setup to another store?
      • My fields are still showing after I have deleted their field definition
      • Why are none of my fields showing in the editor?
      • My newly created object in Shopify is not available in ACF
      • Reference lists are empty?
      • Why am I seeing a "value cannot exceed 100,000 characters" error when saving?
      • Why can't I name my field "first", "last" or "size"?
    • Need help?
  • Product
    • Changelog
    • Feedback & Suggestions
Powered by GitBook
On this page
  • Matching a language to the visitor's preference
  • Showing a default value
  • Multi-language Markdown example
  • Setting up the languages
  • Translating content to other languages
  • How to enable DeepL
  1. Field Definitions
  2. ACF Field types

Multi-language Text

PreviousCustom Object (JSON)NextReference fields

Last updated 10 months ago

Three different field types are available as multi-language types:

  • Text

  • Markdown text

  • HTML

Each of these behave as described for their "single language" counterparts (Text, Markdown, and HTML) but with an important difference as outlined here. All content for the custom field (i.e. across languages) is stored in the same Metafield, so it is important in Liquid to specify which language you need. If you omit this, all languages will be shown This example grabs the English (ISO code 'en') title from a custom field called "title":

{{ product.metafields.accentuate.title.en }}

Matching a language to the visitor's preference

But if we always wanted to show the title in English, there would be no need for multiple languages. We can match the custom field output to any Shopify-translated content by using the language noted in the URL via shop.locale. For example, if you have , you can grab the es language and use it as a key to access your custom field snippet:

{{ product.metafields.accentuate.title[shop.locale] }}

We can also detect the visitor's browser language using a little to show the "title" custom field in the language preferred by the visitor:

{% assign user_language = request.locale.iso_code %}
{{ product.metafields.accentuate.title[user_language] }}

Showing a default value

The above examples will return an empty string if no content was provided for the visitor's language. To properly test if we have some content to show and revert to a safe default, we can apply the code below. This code also showcases that the configured locales (country names' ISO codes) are available in a special Metafield shop.metafields.acf_settings.locales for precisely this purpose:

{% assign default_language = shop.metafields.acf_settings.locales | first %}

{% if product.metafields.accentuate.title[shop.locale] %}
  <p>{{ product.metafields.accentuate.title[shop.locale] }}</p>
{% else %}
  <p>{{ product.metafields.accentuate.title[default_language] }}</p>
{% endif %}

Multi-language Markdown example

In case you were wondering how multi-language Markdown fields work, here is an example (note the .html at the end to get the rendered HTML from the markdown code):

<p>{{ product.metafields.accentuate.markdown_title[shop.locale].html }}</p>

Setting up the languages

Before you can edit content for multi-language fields, you need to tell ACF which languages to handle content for and optionally provide a DeepL API key for built-in translation. So, from your admin side menu, click the "Settings" button to open the settings dialog and go to the "Languages" tab:

In the selection box for "Multiple languages setup", select the languages you need to provide content for. You can select as few or as many languages as you need. Note that languages can be added or removed dynamically, so you don't need to know your complete setup before adding content for each language. If you need to add a language later after setting up content for other languages, you can just do so.

Mind the ordering as this will be reflected in the editor. You can also use the ordering to provide a default language in case a visitor's language is not defined (see below)

When you edit a multi-language custom field, the ACF editor will allow you to input content for each language selected in the above setup. Here is an example of a multi-language text field called "Greetings", allowing input in all three defined languages:

Translating content to other languages

  • Bulgarian

  • Czech

  • Danish

  • German

  • Greek

  • English

  • Spanish

  • Estonian

  • Finnish

  • French

  • Hungarian

  • Italian

  • Japanese

  • Lithuanian

  • Latvian

  • Dutch

  • Polish

  • Portuguese

  • Brazilian Portuguese

  • Romanian

  • Russian

  • Slovak

  • Slovenian

  • Swedish

When you have multiple languages defined in ACF and your primary language is one of the above, ACF will allow you to translate content in a multi-language field from that primary language to any other language that is listed above. For example, you have English listed as a primary language (the first one in the ordering) with German, French, and Finnish as secondary languages.

With DeepL enabled, ACF will now allow you to translate from English to both German, French, and Finnish. The translation service is available directly from each field. This is an example of a simple text field:

Example for HTML fields with translation available directly from the toolbar:

How to enable DeepL

Copy the API key using the copy button to the right of the key and from your Shopify admin, click the "Settings" button in the side menu to open the settings dialog, go to the "Languages" tab, and paste the key into the field for "DeepL API key":

Click "Save" and you're ready to translate your texts in-house.

Disclaimer: DeepL does not give any guarantee regarding the correctness of the translations created by the machine translation system. This is not meant to replace a professional translation service for mission-critical content.

ACF supports in-app translation of content in multi-language fields via an integration with . DeepL combines deep learning and artificial intelligence to understand and translate text between these different languages:

To use DeepL within ACF, you need a DeepL Pro API subscription. DeepL Pro is a 3rd party service with both a free and a paid option. . Once signed up, you can go to your DeepL account page and see your API key:

myshopifystore.com/es/products/great-shirt
Shopify magic
DeepL
See details and sign up here