Translate wordpress plugin in childtheme

Find the folder for the plugin and then search for translation files. Choose the one that suits you and make a copy of it on your computer. Translate the file using eg Poedit. Rename file TEXTDOMAIN-fi.mo where fi is your target locale.

Create a lang folder in a child theme and add translation files in the folder. Then add the following code to in child themes functions.php file. Change TEXTDOMAIN plugins textdomain name.

function plugin_name_load_plugin_textdomain() {
	$domain = 'TEXTDOMAIN';
	$mofile = get_stylesheet_directory(). '/lang/' . $domain . '-' . get_locale() . '.mo';
	load_textdomain( $domain, $mofile);
add_action( 'init', 'plugin_name_load_plugin_textdomain' );

Leave a Reply

Your email address will not be published.