Read more and Read less values are not translated

Created on 18 June 2021, about 3 years ago
Updated 28 March 2024, 3 months ago

Problem/Motivation

I have failed to have working translations for "read more" / "read less" values.
Problem is probably in ckeditor-readmore.js, in this part:

      var more_text = Drupal.t($ckeditorReadmore.data('readmore-more-text'));
      var less_text = Drupal.t($ckeditorReadmore.data('readmore-less-text'));

According to documentation https://www.drupal.org/docs/8/api/translation-api/overview#s-translation... this is not supposed to work.

Tested with ckeditor_readmore 2.0.0 and Drupal 9.1.10

Proposed resolution

With this modification it worked.

      var more_text = Drupal.t('@readmore-more-text', {'@readmore-more-text': $ckeditorReadmore.data('readmore-more-text')});
      var less_text = Drupal.t('@readmore-less-text', {'@readmore-less-text': $ckeditorReadmore.data('readmore-less-text')});

Please note, when translating, you have to search for "@readmore-more-text" or "@readmore-less-text'" strings.

🐛 Bug report
Status

Needs work

Version

3.0

Component

Code

Created by

🇨🇿Czech Republic Bohus Ulrych Pilsen (Czechia)

Live updates comments and jobs are added and updated live.
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.69.0 2024