duanlun4411 2018-09-03 11:53
浏览 70

如何翻译wp_new_user_notification电子邮件文本

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?

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 素材场景中光线烘焙后灯光失效
    • ¥15 请教一下各位,为什么我这个没有实现模拟点击
    • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
    • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
    • ¥20 有关区间dp的问题求解
    • ¥15 多电路系统共用电源的串扰问题
    • ¥15 slam rangenet++配置
    • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
    • ¥15 ubuntu子系统密码忘记
    • ¥15 保护模式-系统加载-段寄存器