Localization

This schema snippet shows how you can define localized properties for use with Dynamic Content's field level localization feature. Field level localization allows you to define content type schemas that contain one or more localizable properties. Users can then enter separate values for each of these properties for each locale on their hub. You can find more information on the creating a localizable content type page.

This example includes:

  • Localized strings
  • Localized image links
  • Localized content links
  • Localized rich text
  • Localized arrays

Pre-requisites

You must have a least one locale added to your hub.

How to use

This example shows most of the supported localizable property types and you should be able to adapt it to meet your own requirements.

Localized properties example

{
  "$schema":"http://json-schema.org/draft-07/schema#",
  "$id":"https://schema-examples.com/localization",
  "title":"Localization example",
  "description":"Localized properties including strings, lists, media and content links",
  "allOf":[
    {
      "$ref":"http://bigcontent.io/cms/schema/v1/core#/definitions/content"
    }
  ],
  "type":"object",
  "properties":{
    "localized_String":{
      "$comment": "Users can enter a string for each of the locales on their hub",
      "title":"Localized string",
      "description":"Enter the string value for this locale",
      "allOf":[
        {
          "$ref":"http://bigcontent.io/cms/schema/v1/localization#/definitions/localized-string"
        }
      ]
    },
    "localized_Image":{
      "$comment": "A separate image can be chosen for each locale",
      "title":"Image for this locale",
      "allOf":[
        {
          "$ref":"http://bigcontent.io/cms/schema/v1/localization#/definitions/localized-image"
        }
      ]
    },
    "localized_RichText":{
      "$comment": "Text can be entered in rich text format for each locale",
      "title":"Localized rich text",
      "allOf":[
        {
          "$ref":"http://bigcontent.io/cms/schema/v1/core#/definitions/localized-value"
        }
      ],
      "properties":{
        "values":{
          "items":{
            "properties":{
              "value":{
                "title":"Localized rich text",
                "description":"Localized rich text for this locale",
                "type":"string",
                "format":"markdown",
                "minLength":5
              }
            }
          }
        }
      }
    },
    "localized_list":{
      "$comment": "The user can enter up to 4 strings for each locale",
      "title":"Localized list",
      "allOf":[
        {
          "$ref":"http://bigcontent.io/cms/schema/v1/core#/definitions/localized-value"
        }
      ],
      "properties":{
        "values":{
          "items":{
            "properties":{
              "value":{
                "type":"array",
                "maxItems":4,
                "items":{
                  "description":"A string for this locale",
                  "type":"string",
                  "title":"List value"
                }
              }
            }
          }
        }
      }
    },
    "localized_ContentItem":{
      "$comment": "The user can choose a separate media content item for each locale",
      "title":"Localized content item",
      "allOf":[
        {
          "$ref":"http://bigcontent.io/cms/schema/v1/core#/definitions/localized-value"
        },
        {
          "properties":{
            "values":{
              "items":{
                "properties":{
                  "value":{
                    "title":"Localized content item",
                    "type":"object",
                    "allOf":[
                      {
                        "$ref":"http://bigcontent.io/cms/schema/v1/core#/definitions/content-link"
                      },
                      {
                        "properties":{
                          "contentType":{
                            "enum":[
                              "https://schema-examples.com/media"
                            ]
                          }
                        }
                      }
                    ]
                  }
                }
              }
            }
          }
        }
      ]
    }
  }
}

Content form preview

An example of creating a content item using a content type registered from the localization example schema is shown in the image below.

Adding a content item from the localization example schema
Adding a content item from the localization example schema

Creating a localizable content type

Localization overview

results matching ""

    No results matching ""