How to keep plugin translations after updates?

You have to replace the call to BBpress’ language file.

A good place to do this is a language specific file in your general languages directory. For Turkish it would probably be a file named tr_TR.php. This will be loaded automatically and only if it matches the language of your blog. It will not be overwritten.

BBPress doesn’t use the function load_plugin_textdomain, it uses load_textdomain instead. Here you can find a filter:

$mofile = apply_filters( 'load_textdomain_mofile', $mofile, $domain );

So in your language php file just add a filter to change the path:

function load_bbpress_tr_mofile( $mofile, $domain )
{
    if ( 'bbpress' == $domain )
    {
        // replace this. :)
        return 'FULL_PATH_TO_YOUR_FILE';
    }
    return $mofile;
}
add_filter( 'load_textdomain_mofile', 'load_bbpress_tr_mofile', 10, 2 );

Leave a Comment