Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
$message = t('The breakpoints from theme %theme are imported and !grouplink.', array(
'%theme' => check_plain($themes[$theme_key]->info['name']),
'!grouplink' => l(t('a new group is created'), 'admin/config/media/breakpoints/groups/' . $theme_key),
));
The complete sentence should be in the first parameter to t(). This is because sentence fragments like 'a new group is created' do not carry enough context for translators. The correct way to make a link here is to put the A tag inside that too, and use a !url replacement token, and url() to make the URL from the path.
Comment | File | Size | Author |
---|---|---|---|
#13 | incorrect_use_of_t-2558573-13.patch | 926 bytes | rakesh.gectcr |
#10 | incorrect_use_of_t-2558573-10.patch | 870 bytes | rakesh.gectcr |
#5 | incorrect_use_of_t-2558573-5.patch | 870 bytes | Pravin Ajaaz |
#2 | incorrect_use_of_t-2558573-2.patch | 873 bytes | Pravin Ajaaz |
Comments
Comment #2
Pravin Ajaaz CreditAttribution: Pravin Ajaaz as a volunteer and at Ameex-Drupal Geeks commentedA patch based on joachim's suggestion
Comment #3
Pravin Ajaaz CreditAttribution: Pravin Ajaaz as a volunteer and at Ameex-Drupal Geeks commentedComment #4
joachim CreditAttribution: joachim commentedThanks for the patch! Just one thing though:
The path should go in the url().
Comment #5
Pravin Ajaaz CreditAttribution: Pravin Ajaaz as a volunteer and at Ameex-Drupal Geeks commentedOkay here it is.
Comment #6
joachim CreditAttribution: joachim commentedLooks good! Setting to RTBC.
Comment #7
joelpittetThis should really use @url not !url. And adding drupal_strip_dangerous_protocols() around the url wouldn't hurt much.
This is also wrong. drupal_placeholder() will check_plain() so this will double escape.
Comment #8
joachim CreditAttribution: joachim commented> '!url' => url('admin/config/media/breakpoints/groups/' . $theme_key),
> This should really use @url not !url
But the only non-hardcoded bit there is $theme_key, which isn't user input AFAICT.
Comment #9
joelpittetWe did some serious thought around this in core in d8 core and that was the hold up for RC release in
AmsterdamEdit: Barcelona.It's recommended to use :url in d8 and @url in d7. :url is one further and equivalent to check_url()
Comment #10
rakesh.gectcr@joachim and @joelpittet
I rolled back your comments here is the changes
Comment #11
rakesh.gectcrComment #12
joelpittetThank you @rakesh.gectcr, couple things still here:
!url needs to be @url here too.
So %theme doesn't need check_plain still.
Comment #13
rakesh.gectcr@joelpittet
I have done the changes you mentioned
Comment #14
rakesh.gectcrComment #15
joelpittetI'm reviewing from my phone but looks good from here
Thanks for the new patch:)
Comment #16
rakesh.gectcrComment #17
Pravin Ajaaz CreditAttribution: Pravin Ajaaz as a volunteer and at Young Globes commentedComment #18
attiks CreditAttribution: attiks at Attiks commentedFixed, thanks