Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Wordpress change default translation

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?

like image 866
phoenixwizard Avatar asked May 06 '13 16:05

phoenixwizard


1 Answers

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);
like image 176
MarZab Avatar answered Oct 18 '22 13:10

MarZab