After having read https://www.drupal.org/docs/8/api/translation-api/overview and in particular Translation for shipped configuration and configuration schemas I tried to use this ability to have translatable text inside a YML config file :

uuid: 81b1dc30-4163-4d40-a62f-5eb6cc3193a9
langcode: 
    type: string
    label: 'Default language'
status: true
dependencies:
  config:
    - field.storage.user.field_first_name
  module:
    - user
id: user.user.field_first_name
field_name: field_first_name
entity_type: user
bundle: user
label: 
    type: text
    label: 'First name'
description: ''
required: true
translatable: false
default_value: {  }
default_value_callback: ''
settings: {  }
field_type: string

I'd rather use this technique because otherwise as my site is used in several countries I would need to split each config file that includes a translation which makes the YML files maintenance more complex.

When I run drush cim I have the following error

The import failed due to the following reasons: Unexpected error during import with operation update for field.field.user.u ser.field_first_name: The configuration property langcode.type doesn't exist.

To be honnest I don't have enough Drupal expertise to understand the problem. Do you have any idea ?

New contributor
RomainF is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.

Found why my test was incorrect : I was trying to modify the configuration file using the directives normally designed for the configuration schema (not the configuration file contents itself). Turned out my configuration value was already translated.

New contributor
Romain FROMHEIM is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.

Your Answer

RomainF is a new contributor. Be nice, and check out our Code of Conduct.

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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