This is a bad string for translators.

Also, at least in 7.x, calling l() within system_token_info() triggers a theme registry rebuild, which adds 11 seconds to a call to drupal_flush_all_caches() on the site I'm profiling, which is how I found this.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

catch’s picture

Status: Active » Needs review
FileSize
718 bytes
catch’s picture

7.x patch.

larowlan’s picture

Status: Needs review » Reviewed & tested by the community

Wow. 11 seconds. Just wow.

alexpott’s picture

Version: 8.0.x-dev » 7.x-dev
Status: Reviewed & tested by the community » Patch (to be ported)

Committed db253b0 and pushed to 8.0.x. Thanks!

  • alexpott committed db253b0 on 8.0.x
    Issue #2339021 by catch: Fixed Incorrect call to l() in...
er.pushpinderrana’s picture

Status: Patch (to be ported) » Needs review
FileSize
704 bytes

just uploading #2 patch again for D7 to get pass through testbot.

tstoeckler’s picture

Actually the proper way to do this is

$this->t('foo <a href="@url">abc</a>', ['@url' => 'http://example.com']);

Let's not backport a suboptimal patch. Not touching the issue metadata because I always get yelled at when "re-opening" issues.

catch’s picture

@tstoeckler see #2339219: [meta] Finalize URL generation API (naming, docs, deprecation) - we currently don't have a non-deprecated replacement for url() that handles this case. Also since the URL isn't user input url() wouldn't do anything here.

tstoeckler’s picture

Well, I still think it's preferable for translators to just have '@url' instead of the actual URL in the string, as in the code example above. Not a biggie, either way though and the committed patch is certainly an improvement.

mgifford’s picture

Status: Needs review » Reviewed & tested by the community

Looks good, applies nicely, bot likes it, it's a simple patch, already in D8. Let's RTBC it....

catch’s picture

@tstoeckler we could do !url to keep the placeholder substitution? Although also with that particular link it may be possible for translators to change the link to point to the correct language too?

tstoeckler’s picture

Version: 7.x-dev » 8.0.x-dev
Status: Reviewed & tested by the community » Needs work

@catch: Interesting, that's actually a fair point, that you'd want the link to change per language. So in that case, putting the URL into the translated text makes sense. In that case, however, we should strive to make the URL a little bit less painful to look at: http://php.net/en/date should be completely sufficient and allows translators to switch the language code transparently (instead of http://php.net/date which would work as well).

Moving back to D8 for that.

  • alexpott committed db253b0 on 8.1.x
    Issue #2339021 by catch: Fixed Incorrect call to l() in...

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

  • alexpott committed db253b0 on 8.3.x
    Issue #2339021 by catch: Fixed Incorrect call to l() in...

  • alexpott committed db253b0 on 8.3.x
    Issue #2339021 by catch: Fixed Incorrect call to l() in...

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

  • alexpott committed db253b0 on 8.4.x
    Issue #2339021 by catch: Fixed Incorrect call to l() in...

  • alexpott committed db253b0 on 8.4.x
    Issue #2339021 by catch: Fixed Incorrect call to l() in...

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.6 was released on August 2, 2017 and is the final full bugfix release for the Drupal 8.3.x series. Drupal 8.3.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.4.0 on October 4, 2017. (Drupal 8.4.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.4.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.4 was released on January 3, 2018 and is the final full bugfix release for the Drupal 8.4.x series. Drupal 8.4.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.5.0 on March 7, 2018. (Drupal 8.5.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.5.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.6 was released on August 1, 2018 and is the final bugfix release for the Drupal 8.5.x series. Drupal 8.5.x will not receive any further development aside from security fixes. Sites should prepare to update to 8.6.0 on September 5, 2018. (Drupal 8.6.0-rc1 is available for testing.)

Bug reports should be targeted against the 8.6.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.6.x-dev » 8.8.x-dev

Drupal 8.6.x will not receive any further development aside from security fixes. Bug reports should be targeted against the 8.8.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.9.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.7 was released on June 3, 2020 and is the final full bugfix release for the Drupal 8.8.x series. Drupal 8.8.x will not receive any further development aside from security fixes. Sites should prepare to update to Drupal 8.9.0 or Drupal 9.0.0 for ongoing support.

Bug reports should be targeted against the 8.9.x-dev branch from now on, and new development or disruptive changes should be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

quietone’s picture

Version: 8.9.x-dev » 9.3.x-dev
Status: Needs work » Fixed
Issue tags: -Needs backport to D7 +Bug Smash Initiative

This issue was committed in 2014 and re-opened to make another improvement to the change made here. The Bugsmash initiative has found that progress is made by closing issues like this and opening a new issue to make the improvement. Therefor I am closing this issue and opening a new one to make for the change suggested in #11 and mark that one as needing backport. After all, it modifies the one line changed in the commit.

The followup is #3238194: Use !url placeholder in description string in system_token_info and added credit there.

Status: Fixed » Closed (fixed)

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