This post is part of the sub-series on Internationalizing a ClassicPress plugin which is part of the Internationalizing a ClassicPress plugin series.
When internationalizing a plugin, you should avoid including a URL in the translatable string.
While for ease it may be tempting to do this:
esc_html_e('Please visit <a href="https://development.azurecurve.co.uk/">azurecurve Development</a> for more details.','your-text-domain');
You should instead paramaterize it by doing this:
printf(esc_html__('Please visit %s for more details.', 'your-text-domain'), '<a href="'.esc_url('https://development.azurecurve.co.uk/').'">azurecurve Development</a>');
If you have a URL where you want the anchor text to be translated, you can do this:
printf(esc_html__('Please %sLogin or Register%s to leave a comment.', 'your-text-domain'), '<a href="'.esc_url('https://development.azurecurve.co.uk/login.php').'">', '</a>');
Using a printf
or sprintf
function will allow you to paramaterize the URL and prevent a translator from substituting your domain for a different one.