Custom Field Localization (beta)

Status

This feature is currently in beta . Please reply to this post with questions and feedback!

Requirements

Currently, level localization requires using our React SDK

Usage

Localization for Custom Fields works in a very similar manner to our field level localization, with the difference being that custom field localization setup will be handled on the model level. To add localization to a custom field, find your way to the model you want to update, and open the Custom Field input


You will see the new Localized toggle, set to off by default. When you toggle it to On you will see input fields displayed below. You can add more locales by clicking the Add locales here link, which will bring up the add local modal
Feb-07-2022 14-32-38

Here you can enter any locales that you use in your app. This value will now be added as a possible input field for that custom field. You can enter in a default value for that input field for each locale as well. When you have added all locales and defaults, don’t forget to save your model!

Now, navigate to the content entry you would like to author or edit.

For Data model entries, the fields will appear as fields in the content entry page.

For Section and Page models, these custom fields will appear in the Options tab on the content page

Accessing localized data

These entries will then be available on the content entry as an object. So, for example, say we have an article data model that we have pulled onto a page. If we look at a article in our content inspector, you can see:
Screen Shot 2022-02-07 at 3.36.16 PM

Within your code, you could access the same article entries with something like:

const content = await builder.get('article', { ...options });
const localizedDescription = content.data.description[locale];

And that should do it! Custom fields should now be available within your content blocks to access localized content authored within Builder.

To manage locales go to builder.io/account/space and choose the pencil button next to “Custom targeting attributes” and you can add and remove locales next to the locale field

Follow Ups and More Info

As with any beta features, we would love to hear your thoughts! Please provide any feedback or bugs you may have found in the comments below!

For more info on localization for an entire content entry, see our forum post here: Localization in Builder

For more info on standard input field localization, see our forum post here:
Field Level localization: Field level localization (beta)

Hi @TimG!

Here I wrote a detailed issue with it.