String Issue – Invalid handling of string variable
-
Hello,
While translating for en_CA I noticed an oddity with a beginning span that didn’t have an ending span here;
https://translate.ww.wp.xz.cn/projects/wp-plugins/options-for-twenty-seventeen/dev/en-ca/default?filters%5Bstatus%5D=either&filters%5Boriginal_id%5D=6953476&filters%5Btranslation_id%5D=59283232The string – Continue reading<span class=”screen-reader-text”>
This code is found here – https://plugins.trac.ww.wp.xz.cn/browser/options-for-twenty-seventeen/trunk/options-for-twenty-seventeen.php#L3369
The code is breaking due to variable usage within the _() function;
$more_link_text = __( 'Continue reading<span class="screen-reader-text">' . $post->post_title . '</span>', 'twentyseventeen' );The solution is to use the printf family of functions as mentioned in the plugin handbook;
https://developer.ww.wp.xz.cn/plugins/internationalization/how-to-internationalize-your-plugin/#variablesOnce this is addressed the system can fully parse the string as currently it stops at the variable inclusion leaving the string looking broken.
Let me know if you have any questions,
CheersThe page I need help with: [log in to see the link]
The topic ‘String Issue – Invalid handling of string variable’ is closed to new replies.