Hey guys

I'm using the smart trim module in a multilingual website, but can't seem to get my "read more" link translated.
I tried through the translate interface but no success.
The "read more" link field is not available when translating the field.

Am I doing something wrong?
Thank you!

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

yvesvanlaer created an issue. See original summary.

markie’s picture

Assigned: Unassigned » markie
Status: Active » Needs review
FileSize
1.03 KB

Thanks for your ticket. I have created the patch below that should allow you to see / translate your read more links in the admin menu. Please apply locally and let me know if it works.

yvesvanlaer’s picture

Hey Markie, thanks for looking into this ticket.

Although the patch adds a t() function around the variable, it won't show up in the translate interface. I also cleared my cache to verify :-).

yvesvanlaer’s picture

FileSize
924 bytes

In addition to your patch, I added a t() function around the output. Now it works.

Anonymous’s picture

It may be better to make a translation through Views Translate (/admin/structure/views/view/YOUR_VIEWS/translate/LANGCODE/edit). Same way for "More link label" of core. Because English is not always the default language. But now "more_text" is not translatable :(

juancasantito’s picture

Status: Needs review » Reviewed & tested by the community

I just created a similar issue for this and a patch that's very alike #4 (exactly the same), and it's working on a multilingual site English/Spanish. So obviously, it functions.

Anonymous’s picture

Status: Reviewed & tested by the community » Needs review

Once again, I point out that this approach is not correct. Because if the user is not the basic English (or no English at all), the result will be a waste and confusion. We need the ability translation via views translation UI. Thanks!

heddn’s picture

In our case, we aren't using Views at all. Only fields. Are we thinking it would be nice to do this as a config translation. I'm not thinking that is possible.

Anonymous’s picture

Perhaps you're right, as always)
But then you need to take care about View too. Because we are a need to remember that the English text should not be change. For example, add label "must be in English, using the classic translation to change it" :).

In fact, I dream about that in the core Drupal finally appeared truncateHTML, and then many problems will disappear.

heddn’s picture

Re-rolling. The patch in #4 doesn't apply.

heddn’s picture

Status: Needs review » Reviewed & tested by the community

Since #10 is only a re-roll, I think I can RTBC this.

  • markie committed dd87656 on 8.x-1.x authored by heddn
    Issue #2782689 by yvesvanlaer, heddn, markie: How to translate a custom...
markie’s picture

Status: Reviewed & tested by the community » Fixed

Patch has been added to the codebase. Looking at doing a new release by the end of the month. Thanks for your help!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

heddn’s picture

Did that release ever get pushed?

heyehren’s picture

It looks like it has been pushed. I have tried the latest dev version and it is working for me. Thanks.

jrochate’s picture

Priority: Normal » Major

At the current version 1.2 a and dev doesn't have this patch applied.

Anyway, the #10 can be applied to current stable and dev version, this should be commits on current code base as it works fine.

Ahmad Abbad’s picture

This issue is not fixed and current patch is not applied on version 1.2

Abdelrahman Amer’s picture

FileSize
1007 bytes
Abdelrahman Amer’s picture

FileSize
832 bytes
jrochate’s picture

This is still no fixed.

Patch on #20 can be applied on current dev version and make the text be translatable, using t().

PapaGrande’s picture

I created https://www.drupal.org/project/smart_trim/issues/3131842 to see if we can get the patch recommitted and a new release.

weri’s picture

In the newest dev version for 2.1.x (not working in the 2.1.0 release) you can use the hook "hook_smart_trim_link_modify" to modify this text or the link in general.

Example:

/**
 * Implements hook_smart_trim_link_modify()
 */
function MODULE_smart_trim_link_modify($entity, &$more, &$url) {
  $more = t('Read more');
}