Untranslatable fields do not respect language of parts

Created on 30 July 2022, over 2 years ago
Updated 23 January 2023, almost 2 years ago

Problem/Motivation

If a field is not translatable, then WCAG 2.0 language of parts requires a lang attribute be applied to that field giving the source language to render on all translations which display that untranslated field. This is not being done.

Steps to reproduce

1. Create a site
2. Extend > enable Content Translation and Language
3. Configure > Languages > add Spanish
4. Structure > Content Types > Basic Page > edit > Language Settings > check Show Language Selector and Enable Translation
5. Content > Add content > create a test page in English, including typing into the Title and Body fields in English > leave Published checked > click Save
6. Click Translate tab
7. On the row for Spanish, click Add
8. Enter the page title in Spanish
9. Don't type in the Body field, as that is not translatable.
10. Save
11. View the Spanish translation
12. Inspect the Body field text

Expected result: Untranslated body field has lang="en" attribute on the Spanish translation to mark that its content has been taken from the English.
Actual result: Untranslated body field on the Spanish translation does not have any language attribute, and therefore is considered to have the page's language, Spanish.

Proposed resolution

If translation is not allowed on a field, add lang="[site language]" attribute. That said, there may not be a good setting for this, since we don't know what language is in the field. Perhaps we need to have the editor state what language the content is in that is being shared across the original and all translations.

For discussion.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

πŸ› Bug report
Status

Active

Version

10.1 ✨

Component
Language systemΒ  β†’

Last updated about 2 hours ago

  • Maintained by
  • πŸ‡©πŸ‡ͺGermany @sun
Created by

πŸ‡ΊπŸ‡ΈUnited States charles belov San Francisco, CA, US

Live updates comments and jobs are added and updated live.
  • Accessibility

    It affects the ability of people with disabilities or special needs (such as blindness or color-blindness) to use Drupal.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024