I have created a plugin to customise the User Notification Email Template but I'm not able to get the translation working. If I switch the language in WordPress to Dutch the language of the Email stays in English.
I've setup the text domain:
Plugin Name: WPX Custom New User Email
Author: WPX
Author URI: https://localhost
Description: Changes the copy in the email sent out to new users
Version: 0.1
Text Domain: wpx-new-user-email
Domain Path: /languages
Setup the plugin text domain:
add_action( 'init', 'wpx_load_textdomain' );
/**
* Callback on the `plugins_loaded` hook.
* Loads the plugin text domain via load_plugin_textdomain()
*
* @uses load_plugin_textdomain()
* @since 1.0.0
*
* @access public
* @return void
*/
function wpx_load_textdomain() {
load_plugin_textdomain( 'wpx-new-user-email', false, dirname(
plugin_basename( __FILE__ ) ) . '/languages' );
}
And hereby a piece of the code that needs to be translated:
$message = sprintf( __( 'Dear %s,' ), $user->first_name ) . '<br><br>';
$message .= sprintf( __( 'Thank you very much for your registration at <a href="https://localhost">Local Host</a>!' ) ) . '<br><br>';
$message .= sprintf( __( 'You are now able to login with your login details.' ) ) . '<br><br>';
The .po and .mo files are within the languages directory and are named wpx-new-user-email-nl_NL.mo an wpx-new-user-email-nl_NL.po
Any suggestions?