Allow to configure translation per property on link fields (for translating only the title, not the url itself)

Created on 17 June 2020, over 4 years ago
Updated 29 August 2024, 3 months ago

Problem/Motivation

In images, we can configure that only title and alt texts are translated, and not the original file.
I think it will make sense in some cases to do the same for links, where you may want to allow to translate the title but not the url.

Proposed resolution

Add columns to modules/link/src/Plugin/Field/FieldType/LinkItem.php definition.

Add a UI mark depending on #3152587: Add a mark when editing a field property will affect all the translations as we do with fields themselves β†’ outcome.

Remaining tasks

  • Ensure this is an acceptable feature request.
  • Have a working patch
  • Add tests
  • Right now, the (*all translation) markers doesn't work for subfields, so it's not obvious that this will affect all translations (see #3152587: Add a mark when editing a field property will affect all the translations as we do with fields themselves β†’ ). We need to figure out a way to do that before this lands, as the UI would remain the same but you won't know you are updating all the translations.
  • Decide on the defaults: should be translatable or not by default?
  • Add an upgrade path: for existing sites, the url should be always translatable on upgrade, for avoiding to change the expected behavior on sites upgrading.
  • Add upgrade path tests.

User interface changes

TBD

API changes

TBD

Data model changes

TBD

Release notes snippet

TBD

✨ Feature request
Status

Needs work

Version

11.0 πŸ”₯

Component
LinkΒ  β†’

Last updated about 3 hours ago

Created by

πŸ‡ͺπŸ‡ΈSpain penyaskito Seville πŸ’ƒ, Spain πŸ‡ͺπŸ‡Έ, UTC+2 πŸ‡ͺπŸ‡Ί

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

    (Drupal 8 Multilingual Initiative) is the tag used by the multilingual initiative to mark core issues (and some contributed module issues). For versions other than Drupal 8, use the i18n (Internationalization) tag on issues which involve or affect multilingual / multinational support. That is preferred over Translation.

  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

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

  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    This issue is being reviewed by the kind folks in Slack, #needs-review-queue-initiative. We are working to keep the size of Needs Review queue [2700+ issues] to around 400 (1 month or less), following Review a patch or merge request β†’ as a guide.

    Think it's a valid request to be able to translate links but isn't that already possible?

    During content translation you can change the title text to the language you are translating too.

    If the desire is to use for user interface translation not sure that's the correct way but tagging for subsystem maintainer for their thoughts. Would also leverage the #contribute slack channel.

  • πŸ‡ͺπŸ‡ΈSpain penyaskito Seville πŸ’ƒ, Spain πŸ‡ͺπŸ‡Έ, UTC+2 πŸ‡ͺπŸ‡Ί

    @smustgrave Right now, you can translate all or nothing. The issue is about adding that granularity. You might want to let translators translate the link title, but not the url destination itself.

  • πŸ‡ͺπŸ‡ΈSpain penyaskito Seville πŸ’ƒ, Spain πŸ‡ͺπŸ‡Έ, UTC+2 πŸ‡ͺπŸ‡Ί

    Adding screenshot so it's more clear.

  • Status changed to Needs work 6 months ago
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    We did something very similar for image fields lately so don't see why links could be any different.

  • First commit to issue fork.
  • πŸ‡«πŸ‡·France duaelfr Montpellier, France

    I rerolled @penyaskito's #4 patch on 11.x in a new MR

  • Pipeline finished with Failed
    4 months ago
    Total: 177s
    #225658
  • Pipeline finished with Success
    4 months ago
    Total: 590s
    #227503
  • Status changed to Needs review 3 months ago
  • πŸ‡«πŸ‡·France duaelfr Montpellier, France

    Rerolled on the latest 11.x
    + added the ability to configure link options translatability (might be used by contrib like Link Target β†’ )

  • Pipeline finished with Success
    3 months ago
    Total: 759s
    #261740
  • Status changed to Needs work 3 months ago
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Thanks for reviving, Moving to NW for test coverage.

  • πŸ‡ͺπŸ‡ΈSpain ipitbiz

    Hi all,

    I add a patch for version 10.3 and 11 because the one that is visible now only works for 10.2.

Production build 0.71.5 2024