Opened 8 years ago
Closed 8 years ago
#32817 closed defect (bug) (fixed)
Avoid HTML tags in translation strings (WP_Customize_Themes_Section)
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 4.3 | Priority: | normal |
Severity: | normal | Version: | 4.3 |
Component: | Customize | Keywords: | has-patch needs-refresh |
Focuses: | Cc: |
Description
I have setup the translation to only evaluate the text, not the html tags.
Attachments (3)
Change History (11)
#1
@
8 years ago
Hi @henrikakselsen, thanks for submitting your first report and patch!
A couple of points:
- The first pair of
echo
have got a pair of()
around the content - these are not needed and should be removed. - Instead of using
.
to echo, you can use,
, which has a slight performance benefit, as it echos the values straight away, instead of building up into a single string first.
If you do a new patch, just upload it as the same name (leave the existing one there for historical reference), and Trac will append a suffix so that it becomes a new file name.
#3
@
8 years ago
- Keywords has-patch added
- Milestone changed from Awaiting Review to 4.3
I've never seen ,
as opposed to .
used in core, but I'm not personally opposed. This looks like it should be fine for 4.3 if it gets committed in a reasonably timely manner. Only possible issue would be if you wanted to move the theme placeholder, but not sure that that would be needed (this isn't my area of expertise).
#4
follow-up:
↓ 5
@
8 years ago
- Milestone 4.3 deleted
- Resolution set to wontfix
- Status changed from new to closed
We need the placeholder for RTL languages to be able to shift that value around.
Generally it should be avoided to use HTML in translation strings, but things like a single anchor or scenarios like this are exceptions to that rule.
#5
in reply to:
↑ 4
@
8 years ago
- Milestone set to 4.3
- Resolution wontfix deleted
- Status changed from closed to reopened
Replying to obenland:
We need the placeholder for RTL languages to be able to shift that value around.
.customize-action
is a block element, so there's no need to move the placeholder here: 32817.rtl.png.
Generally, I don't think RTL languages have to shift placeholders often, text direction should take care of that.
Replying to GaryJ:
Instead of using
.
to echo, you can use,
, which has a slight performance benefit, as it echos the values straight away, instead of building up into a single string first.
I'd suggest leaving this discussion for #31950 and using concatenation for now for consistency with other core files.
#6
follow-up:
↓ 7
@
8 years ago
- Keywords needs-refresh added
I agree that it's safe to remove the placeholder here. We should do the same in WP_Customize_Themes_Section::render()
.
Only translate text portion of strings