Problem/Motivation

System site translation shouldn't migrate properties which are not translatable (neither based on config schema, nor on the UI).

Proposed resolution

Migrate only the site name (name) and the site slogan (slogan).

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Comments

huzooka created an issue. See original summary.

huzooka’s picture

huzooka’s picture

Assigned: huzooka » Unassigned
Status: Active » Needs review
wim leers’s picture

This was introduced in #2970847: i18n Variable to config: system site settings [d7] .

Obviously this causes tests to fail. And #2970847: i18n Variable to config: system site settings [d7] introduced additional rows in the D7 DB fixture so that there would be values to migrate.

So while this may have been translatable in D7 (I did not verify this), it definitely is not translatable in D8|9. #1905152: Integrate config schema with locale, so shipped configuration is translated introduced the config schema translation infrastructure. And per the change record at https://www.drupal.org/node/1977368:

you should use the label and text types in your schemas for translatable pieces of the configuration to participate in this system. If you don't use config schemas, your configuration will just not be translatable.

You can see this reflected in core.data_types.schema.yml:

# Human readable string that must be plain text and editable with a text field.
label:
  type: string
  label: 'Label'
  translatable: true

but for example not on

email:
  label: 'Email'
  class: '\Drupal\Core\TypedData\Plugin\DataType\Email'
…
string:
  label: 'String'
  class: '\Drupal\Core\TypedData\Plugin\DataType\StringData'

And if we look at system.schema.yml, we see:

system.site:
  type: config_object
  label: 'Site information'
  mapping:
    uuid:
      type: uuid
      label: 'Site UUID'
      constraints:
        Uuid: []
        NotNull: []
    name:
      type: label
      label: 'Site name'
    mail:
      type: email
      label: 'Email address'
    slogan:
      type: label
      label: 'Slogan'
    page:
      type: mapping
      label: 'Pages'
      mapping:
        403:
          type: path
          label: 'Default 403 (access denied) page'
        404:
          type: path
          label: 'Default 404 (not found) page'
        front:
          type: path
          label: 'Default front page'
    admin_compact_mode:
      type: boolean
      label: 'Compact mode'
    weight_select_max:
      type: integer
      label: 'Weight element maximum value'
    default_langcode:
      type: string
      label: 'Site default language code'
    mail_notification:
      type: string
      label: 'Notification email address'

then the following stand out:

    name:
      type: label
      label: 'Site name'
…
    slogan:
      type: label
      label: 'Slogan'

Everything else uses <code>type: boolean

, type: string, type: email, type: path et cetera.

This indeed means they're not translatable. Which confirms what @huzooka wrote in the issue summary:

Migrate only the site name (name) and the site slogan (slogan).


In fact, when searching the web to find if there's an ongoing issue to make more things translatable, I stumbled upon @Gábor Hojtsy's blog post http://hojtsy.hu/blog/2014-may-26/drupal-8-multilingual-tidbits-16-confi..., which again says:

There are clearly some translatable elements here. Which ones? Well, at least the site name and slogan would be. How would Drupal know though? …


So: 👍for this patch!

I'll update the test expectations and will then RTBC this.

wim leers’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new2.09 KB
new2.72 KB
alexpott’s picture

Version: 9.2.x-dev » 9.1.x-dev
Status: Reviewed & tested by the community » Fixed

Committed and pushed c5eada7408 to 9.2.x and 6f5b187da5 to 9.1.x. Thanks!

Do we think that we could introduce something that could test all migrated translated configuration to ensure it only contains config that is translatable in Drupal 8/9?

  • alexpott committed c5eada7 on 9.2.x
    Issue #3187418 by Wim Leers, huzooka: System site translation shouldn't...

  • alexpott committed 6f5b187 on 9.1.x
    Issue #3187418 by Wim Leers, huzooka: System site translation shouldn't...
wim leers’s picture

Do we think that we could introduce something that could test all migrated translated configuration to ensure it only contains config that is translatable in Drupal 8/9?

Interesting idea! 🤔

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.