function uni_wc_login_error_translation( $translated, $original, $domain ) {
switch ($original) {
case '<strong>ERROR</strong>: The username or password you entered is incorrect. <a href="%2$s" title="Password Lost and Found">Lost your password</a>?':
$translated = '<strong>錯誤</strong>: 使用者的帳號或者密碼錯誤 <a href="%2$s" title="忘記密碼?">忘記密碼</a>?';
break;
}
return $translated;
}
add_filter( 'gettext', 'uni_wc_login_error_translation', 10, 3 );
以上很好理解,就直接抓取那串字串並且翻譯替代:
case ‘<strong>ERROR</strong>: The username or password you entered is incorrect. <a href=”%2$s” title=”Password Lost and Found”>Lost your password</a>?‘: