2

The question is fairly straight forward. I have several config entities with various fields.

I haven't found a way to translate config entity fields in the Drupal 8 documentation(or maybe I haven't looked hard enough, both are a strong possibility).

1 Answer 1

5

You need a schema of the type config_entity.

See for example the one for the node type config entity:

/node/config/schema/node.schema.yml:

node.type.*:
  type: config_entity
  label: 'Content type'
  mapping:
    name:
      type: label
      label: 'Name'
    type:
      type: string
      label: 'Machine-readable name'
    description:
      type: text
      label: 'Description'
    help:
      type: text
      label: 'Explanation or submission guidelines'
    new_revision:
      type: boolean
      label: 'Whether a new revision should be created by default'
    preview_mode:
      type: integer
      label: 'Preview before submitting'
    display_submitted:
      type: boolean
      label: 'Display setting for author and date Submitted by post information'

Choose for fields you want to make translatable the types label and text. See also D8 How to create custom configurational form translatable?

1
  • 1
    This is a little more complicate than I imagined. Either way, it's seem this is the way. Thanks.
    – Andrew
    Commented Sep 15, 2017 at 13:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.