Configuration translation uses default language on domain-enabled config forms

Created on 31 May 2024, 6 months ago
Updated 13 July 2024, 4 months ago

Drupal Version

10.2.6

Domain module version

2.0.0-beta1

Expected Behavior

Using a configuration translation form should get and save values for the selected language.

Actual Behavior

Configuration translation forms use values from the default site language when editing translations. Translations do not save.

Steps to reproduce

  1. Create and install a new Drupal site with composer, drush si, and default settings.
  2. Require the Domain module: composer install drupal/domain.
  3. Enable modules: drush en config_translation domain_config_ui language.
  4. Visit /admin/config/regional/language and add Spanish as a second language.
  5. Visit /admin/config/domain and configure two domain records.
  6. Visit /admin/config/system/site-information and configure a site title for all domains and languages. (Note that this is the Domain Configuration UI and is working as expected!)
  7. Visit /admin/config/system/site-information/translate and edit the Spanish translation. The values for English are displayed and will not save for Spanish.

Perhaps this is not a valid use case. However, be aware that some modules do not expose all configuration values in the main form. These must be edited from the configuration translation form for that module. For example, see the External Links β†’ module:

  1. Require the External Links module: composer require drupal/extlink.
  2. Enable the module: drush en extlink.
  3. Visit /admin/config/user-interface/extlink, enable domain configuration, and save values for each domain.
  4. Visit /admin/config/user-interface/extlink/translate and try to add a Spanish translation. The values are not retrieved or saved.

I didn't get far with Xdebug, but my first suspect is DomainConfigOverrider. Here the language manager was returning the site default language for me, rather than the actual language of the request.

✨ Feature request
Status

Active

Version

2.0

Component

- Domain Config

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @nicross-com
  • I'm not sure how common this issue is actually. I looked more into the External Link module and opened an issue πŸ› Add fields for alternative text labels to settings form Active which should expose the fields we need without needing to use the configuration translation form. However, it would be neat if Domain Config UI were more compatible with, or more explicit about its incompatibility, with the core Configuration Translation module.

  • πŸ‡ΊπŸ‡ΈUnited States agentrickard Georgia (US)

    This is likely related to #3060758: Investigate using config collections β†’ , which is a longstanding issue / complaint about the lack of core documentation for implementing "Collections" of config, which I think is a prerequisite for the described behavior.

    Domain Config UI allows selection of language and domain in order to work around this problem, so it's a known issue that has a work-around.

    Doimain Config UI also cannot perform magic on other forms, so may not be appropriate for all cases. It is a "convenience" module that I somewhat regret adding to the package.

  • πŸ‡¨πŸ‡³China hongqing

    I have the same issue.

Production build 0.71.5 2024