Support language of parts for file description

Created on 7 August 2020, over 4 years ago
Updated 20 January 2023, almost 2 years ago

Problem/Motivation

If the description field on a file field is in a different language from the page, there is no way to mark the description as being in that other language. This is a violation of WCAG 2.0 3.1.2 Language of Parts.

Steps to reproduce

1. Go to /admin/structure/types/add
2. Add content type File Container
3. Go to /admin/structure/types/manage/file_container/fields
4. Add field of type File named File
5. Go to /admin/structure/types/manage/file_container/fields/add-field Field Settings tab
6. Set File field to allow Unlimited values (I also enabled Display and Default to Display and I believe this would not affect the behavior relevant to this issue.)
7. Go to Edit tab
8. Check Enable Description field
9. Go to /admin/modules
10. Enable Content Translation and Language
11. Go to /admin/config/regional/content-language
12. Check Content, File, URL Alias
13. Check the Translatable checkbox for all content types

Expected result: File Description field has a checkbox that enables translation, and this checkbox is checked
Actual result: File Description field does not have a checkbox that enables translation.

14. Ensure that all fields are checked for translation
15. Click Save Configuration

Expected result: File remains checked
Actual result: File loses check

16. Go to /admin/config/regional/language
17. Add Spanish
18. /node/add/file_container
19. Provide a page title in English
20. Page language should be English
21. In the File field, click Choose Files
22. Navigate to and select an English-language file
23. Click Choose (or whatever button your interface provides)
24. Enter an English-language description in the description field
25. In the File field, click Choose Files
26. Navigate to and select a Spanish-language file
27. Click Choose (or whatever button your interface provides)
28. Enter an Spanish-language description in the description field

Expected result: I have a way to mark this text as being in Spanish, for instance, in a drop-down beside or below the field.
Actual result: I have no way to mark this text as being in Spanish.

29. Save and publish page.
30. Navigate to the new page.
31. Right-click the Spanish file description.
32. Inspect element

Expected result: Spanish file description is wrapped in a tag with the attribute lang="ES"
Actual result: Spanish file description is not wrapped in a tag with the attribute lang="ES"

Proposed resolution

Minimum requirement:
On /admin/config/regional/content-language, allow File Description to be marked as translatable.
If File Description has been marked as translatable, then on /node/add/[content type] for content types which have a file field that has a file description, beside each file description, show a drop-down which default's to the page's language and which can be set to any permitted language.

Optional support:
Allow adding additional concatenated file descriptions to a file, each with a language drop-down to allow for a file description in more than one language. For example,

Use of the Subjunctive in Spanish "Es posible/probable que" constructions

Note: The words "Es posible/probable que" would correctly be wrapped in a rendered description with a span tag with a lang attribute with the value "ES".

This would have three description parts:

  1. Use of the Subjunctive in Spanish (left as default language English)
  2. "Es posible/probable que" (marked as Spanish)
  3. constructions (left as default language English)

Additional notes:

For consistency, this might be best solved the same way as ✨ Allow text field to enforce a specific text format Fixed by allowing the description to provide a single-field file format which only allows the span tag, and then only with a language attribute.

Remaining tasks

Reporter requests that this be filled in by someone who knows how to fill this in.

User interface changes

See proposed resolution.

API changes

Reporter requests that this be filled in by someone who knows how to fill this in.

Data model changes

Reporter requests that this be filled in by someone who knows how to fill this in.

Release notes snippet

Reporter requests that this be filled in by someone who knows how to fill this in.

Workarounds

While there is the workaround to make the content type translatable and create translation pages, we have gotten pushback from staff. Because some documents are posted in 10 additional languages, this would require staff to create 10 translations for each of two translated files, and the files are replaced on a recurring basis. And of course this workaround would only work for descriptions where the entire title is translated - admittedly our use case - and not where there is a mix of languages in a single description.

πŸ› Bug report
Status

Needs work

Version

10.1 ✨

Component
File systemΒ  β†’

Last updated 1 day ago

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.

No activities found.

Production build 0.71.5 2024