Closed ryelle closed 1 year ago
This updates the button parser and list item parser to allow translating link destinations as well as link text.
For buttons, the block parser can interpret the destination as its own item to translate, so only the link is wrapped in _e().
_e()
<div class="wp-block-button"> <a class="wp-block-button__link wp-element-button" href="<?php _e( 'https://wordpress.org/hosting/', 'wporg' ); ?>"> <?php _e( 'See all recommended hosts', 'wporg' ); ?> </a> </div>
For list items, it makes more sense to fall back to the same behavior as paragraphs and other default blocks, where the whole link element is translated.
<li><?php _e( '<a href="https://learn.wordpress.org/course/getting-started-with-wordpress-get-setup/">WordPress courses ↗</a>', 'wporg' ); ?></li>
See #266.
yarn build:patterns
This updates the button parser and list item parser to allow translating link destinations as well as link text.
For buttons, the block parser can interpret the destination as its own item to translate, so only the link is wrapped in
_e()
.For list items, it makes more sense to fall back to the same behavior as paragraphs and other default blocks, where the whole link element is translated.
See #266.
How to test the changes in this Pull Request:
yarn build:patterns