Translation of custom srtings
-
Hello
I installed your plugin and set custom text messages that appear on my page.
I noticed that I can’t translate them with WPML String Translation and I managed to fix it by changing one line in the plugin.I changed:
$content = sprintf( '<div id="catapult-cookie-bar">%s<button id="catapultCookie" tabindex=1 onclick="catapultAcceptCookies();">%s</button><a tabindex=1 href="%s">%s</a></div>', htmlspecialchars( $current_text ), htmlspecialchars( $accept_text ), home_url( $link_text ), htmlspecialchars( $more_text ) );
to:
$content = sprintf( '<div id="catapult-cookie-bar">%s<button id="catapultCookie" tabindex=1 onclick="catapultAcceptCookies();">%s</button><a tabindex=1 href="%s">%s</a></div>', htmlspecialchars( __($current_text,'uk-cookie-consent') ), htmlspecialchars( __($accept_text,'uk-cookie-consent') ), home_url( __($link_text,'uk-cookie-consent') ), htmlspecialchars( __($more_text,'uk-cookie-consent') ) );
So basically I added __() function to every custom string. Could you do the same in your official version of this plugin?
I would like to install your plugin on about 10 pages and it would be really helpful if I didn’t have to change this one line on every plugin update.
Thanks a lot in advance!
- The topic ‘Translation of custom srtings’ is closed to new replies.