I have translated many string successfully previously, but this one gives me a headache. This part is used inside my content-related.php file which I use to display related posts
Here is the current string I’m using
<?php echo 'Click <a href="'. esc_url( get_permalink() ) . '">here</a> to go and wacth the video.' ?>
My problem in the localization process is the
<a href="'. esc_url( get_permalink() ) . '">here</a>
part in the middle.
The best I could come up with is
<?php printf(__('Click %s to go and wacth the video.', 'pietergoosen'), '<a href="'. esc_url( get_permalink() ) . '">here</a>'); ?>
OK, I know I can just create a variable for the <a>
tag and rather use the variable in the printf()
string instead of the whole <a>
tag, but that is not the concern now, and that was only done to test the result first.
With the string in its changed order, the string translates, except for the word “here” which is inside the <a>
tag. How can I get the string to translate the word “here” as well. I’ve read somewhere, think it was in the Codex, that it is not a good idea breaking up a string into several strings as it may cause problems for certain languages as word order differ in some languages.
Any more suggestions to solve this problem?