I want to change the translation value of a text when the language is the default English USA locale. What is the correct way to accomplish this so we don't have to change the file every time we upgrade the wordpress version?
This is a nice plugin that does just that: http://wordpress.org/plugins/quick-localization/
But if you have only a few, you can also use this code:
function filter_gettext($translation, $text, $domain) {
if ( $text == 'Recent Comments' ) {
$translations = &get_translations_for_domain( $domain );
return $translations->translate( 'Something else' );
}
return $translation;
}
add_filter('gettext', 'filter_gettext', 10, 4);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With