Change to use Config Translation for More label

Created on 26 August 2023, over 1 year ago
Updated 28 February 2024, 9 months ago

Problem/Motivation

Currently, the module has a t() function wrapper around the config setting for the More label.

This is not considered best practice, as UI translation should only be used for static UI text.

Proposed resolution

The recommended solution is to use config translation, which uses the module's schema to enable translation.

Unfortunately, at present Drupal core does not support translation of field formatters, but there is a core issue, 🐛 Entity view/form mode formatter/widget settings have no translation UI Needs review , open to develop a fix that is moving towards completion. As it's a new feature, it will need a minor release, but it's looking like it may make it into Drupal 10.2.

As this change will depend on that issue, it is postponed until that issue has been merged. It will need to increase the core_version_requirement to that version. It will also break compatibility of the More link translation with older Smart Trim versions, so I suggest we target this change for a 3.0 release of Smart Trim.

We may want to maintain 2.x and 3.x in parallel, at least until the next minor core release so people can continue using it until they upgrade their Drupal version, and are ready to move to config translation.

Remaining tasks

  1. Wait for 🐛 Entity view/form mode formatter/widget settings have no translation UI Needs review to be merged (and probably for at least a beta release).
  2. Make schema changes from string to label for translatable settings.
  3. Remove t() wrapper for config setting.
  4. Rewrite the testSmartTrimMoreTextTranslation test to use config translation.

User interface changes

None in the module itself, but the UI for translating the label will change.

API changes

None.

Data model changes

Change to module schema to change strings to labels, but as labels are just strings with translation enabled, this does not break compatibility or require a migration script.

🐛 Bug report
Status

Fixed

Version

2.1

Component

Code

Created by

🇮🇪Ireland lostcarpark

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024