Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
We have an option to append "all languages" to fields which are shared between translations.
If a field has more than one value, then the suffix is currently added as shown in this screenshot:
It would be better if the "all languages" suffix was added to the field label instead; ("Multiple Integers" in this case).
Comment | File | Size | Author |
---|---|---|---|
#3 | et-translatability-clue-fix-1829636-3.patch | 951 bytes | stefanos.petrakis@gmail.com |
#2 | et-translatability-clue-fix-1829636-2.patch | 1.71 KB | bforchhammer |
multi-values-fields-label-problem.png | 5.78 KB | bforchhammer |
Comments
Comment #1
plachComment #2
bforchhammer CreditAttribution: bforchhammer commentedAttached patch fixes the issue with multiple field values.
This seems to work well for core number, text, lists, and file/image fields (anything else I should test with?). It doesn't work with the "Media File Selector" widget (provided by media module), and that's probably easier to fix directly in the media module...
If this is the way to go, we probably have to do the same change in core (8.x).
Comment #3
stefanos.petrakis@gmail.comStill applies cleanly to 7.x-1.x-dev. Tested with all core field types and widgets on a clean D7.50
Pros:
Cons:
It is probably not wise to skip checking which FAPI elements should get the 'all languages' suffix. Letting this run without constraints could present problems with nested containers that get a '#title' property, as per the inline comment already state:
Alternative:
The current logic dictates that we should respect the FAPI definitions for elements with a #title property.
This presents the problem discussed here, that the suffix will apply to all children of a multivalue field. And this problem is actually specific to the cardinality property of a FAPI element (call me multivalue).
Maybe it would be wiser instead of doing away with the sanity checks provided by the current code, to try this instead:
Supplied patch attempts to solve the reported problem with a bit less "disruptive" means.
Comment #4
plach@stefanos.petrakis:
I fully agree on your analysis and the fix looks good and works well. I'm fixing the minor nitpick below on commit, thanks!
Missing trailing dot :)
Comment #6
plachCommitted and pushed, thanks.