Opened 9 years ago
Closed 9 years ago
#35668 closed defect (bug) (wontfix)
Avoid using HTML tags in translation strings (wp-admin/credits.php)
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | |
Component: | I18N | Keywords: | has-patch |
Focuses: | Cc: |
Description
See the attached patch.
Attachments (4)
Change History (14)
#2
@
9 years ago
I tested several options for this.
Original string:
<p class="clear"><?php /* translators: %s: https://make.wordpress.org/ */ printf( __( 'Want to see your name in lights on this page? <a href="%s">Get involved in WordPress</a>.' ), __( 'https://make.wordpress.org/' ) ); ?></p>
Option 1:
<p class="clear"><?php printf( /* translators: %s: get involved link */ __( 'Want to see your name in lights on this page? %s' ), sprintf( /* translators: %s: https://make.wordpress.org/ */ __( '<a href="%s">Get involved in WordPress</a>.' ), __( 'https://make.wordpress.org/' ) ) ); ?></p>
Option 2:
<p class="clear"><?php printf( /* translators: %s: get involved link */ __( 'Want to see your name in lights on this page? %s' ), ' <a href="' . __( 'https://make.wordpress.org/' ) . '">' . __( 'Get involved in WordPress' ) . '</a>' ) ); ?></p>
Option 3:
<p class="clear"> <?php _e( 'Want to see your name in lights on this page?' ); ?> <a href="<?php echo esc_url( 'https://make.wordpress.org/' ); ?>"><?php _e( 'Get involved in WordPress' ); ?></a> </p>
I prefer the last one, it has no %s placeholders.
#3
follow-ups:
↓ 4
↓ 5
@
9 years ago
- Keywords has-patch removed
The link isn't translatable anymore and the period after "Get involved in WordPress" is missing.
I think we should leave the string as it is.
#4
in reply to:
↑ 3
@
9 years ago
- Keywords has-patch added
Replying to ocean90:
The link isn't translatable anymore and the period after "Get involved in WordPress" is missing.
Option 4:
<p class="clear"> <?php _e( 'Want to see your name in lights on this page?' ); ?> <a href="<?php echo esc_url( __( 'https://make.wordpress.org/' ) ); ?>"><?php _e( 'Get involved in WordPress' ); ?></a>. </p>
Option 5:
<p class="clear"> <?php _e( 'Want to see your name in lights on this page?' ); ?> <a href="<?php echo esc_url( __( 'https://make.wordpress.org/' ) ); ?>"><?php _e( 'Get involved in WordPress' ); ?></a><?php _e( '.' ); ?> </p>
#5
in reply to:
↑ 3
@
9 years ago
Replying to ocean90:
I think we should leave the string as it is.
If we want more locals to finish translating wordpress, we have to provide shorter and simpler translation string.
As a the Hebrew (he_IL) GTE, I see that most contributors tend to translate the simple strings, and I have to finish all the long strings by myself.
I also noticed that contributors avoid translating strings with HTML tags because in hebrew letters are RTL and the HTML tags are LRT. It's very confusing (even for me).
This is why I made it my mission to fix as many core translation strings as I can.
Unfortunately, core is only the first step - plugins and theme is the next step.
#6
@
9 years ago
Option 6:
<p class="clear"><?php printf( /* translators: %s: link to make.wordpress.org */ __( 'Want to see your name in lights on this page? %s.' ), '<a href="' . esc_url( __( 'https://make.wordpress.org/' ) ) . '">' . __( 'Get involved in WordPress' ) . '</a>' ); ?></p>
I think that this is the best approach.
#7
@
9 years ago
Option 7:
<p class="clear"><?php printf( /* translators: %s: link to make.wordpress.org */ __( 'Want to see your name in lights on this page? %s.' ), sprintf( '<a href="%1$s">%2$s</a>', esc_url( __( 'https://make.wordpress.org/' ) ), __( 'Get involved in WordPress' ) ) ); ?></p>
#8
@
9 years ago
Like in #35743, it's easy to forget or accidentally remove %s
at the end.
I understand the aspiration to make all the strings as simple as possible, but the original string seems simple enough. Removing all the tags from all the strings would not be feasible.
#9
@
9 years ago
Ok, last one. Option 8:
<p class="clear"><?php printf( '%1$s <a href="%2$s">%3$s</a>.', __( 'Want to see your name in lights on this page?' ), esc_url( __( 'https://make.wordpress.org/' ) ), __( 'Get involved in WordPress' ) ); ?></p>
This way you can't accidentally forget the placeholder, because the string has no placeholders.
#10
@
9 years ago
- Milestone Awaiting Review deleted
- Resolution set to wontfix
- Status changed from new to closed
35668.4.patch isn't an option because you can't translate/move the period anymore.
That strings looks good as is.
@SergeyBiryukov / @ocean90 , I would love to get your feedback on the patch.