**`rife-free-child/functions.php` 末尾追加翻译过滤器**(gettext/ngettext,升级插件不丢失):
// ============================================================
// WPUF / WPUF Pro 界面英文 -> 中文(gettext 翻译补充,升级不丢失)
// ============================================================
function cpe_wpuf_zh( $translated, $text, $domain ) {
if ( 'wpuf-pro' === $domain || 'wp-user-frontend' === $domain ) {
$map = array(
'Change Password' => '更改密码',
'Edit Profile' => '编辑个人资料',
'Billing Address' => '账单地址',
'Log out' => '退出登录',
'My Invoices' => '我的发票',
'Invoices' => '发票',
'No invoices found' => '未找到发票',
'Transaction ID' => '交易编号',
'Link' => '链接',
'Amount' => '金额',
'Options' => '操作',
'View' => '查看',
'N/A' => '无',
'View Invoice' => '查看发票',
'Download' => '下载',
'Previous' => '上一页',
'Next' => '下一页',
'Dashboard' => '仪表盘',
'Subscription' => '订阅',
);
if ( isset( $map[ $text ] ) ) {
return $map[ $text ];
}
}
return $translated;
}
add_filter( 'gettext', 'cpe_wpuf_zh', 10, 3 );
function cpe_wpuf_zh_n( $translated, $single, $plural, $number, $domain = '' ) {
if ( 'wpuf-pro' === $domain || 'wp-user-frontend' === $domain ) {
if ( '%s item' === $single && '%s items' === $plural ) {
return '%s 条';
}
}
return $translated;
}
add_filter( 'ngettext', 'cpe_wpuf_zh_n', 10, 5 );
2. 新建子主题覆盖模板 wpuf/account.php(角色名中文化)——Administrator → 管理员、editor → 编辑、author → 作者等。
验证结果(模拟登录渲染发票页
| 位置 | 显示 |
|---|---|
| 页面标题 | 我的发票 |
| 计数 | 0 条 |
| 空状态 | 未找到发票 |
| 侧边栏菜单 | 更改密码 / 发票 / 订阅 / 提交 / 仪表盘 / 文章 / 页面 / 编辑个人资料 等全部中文 |
| 角色 | 管理员 |
| 英文残留 | Change Password、My Invoices、No invoices found、Administrator、Log out 全部清除 |
两点说明
- 头像旁的 vincent 是用户名 / 显示名(不是界面文案),保留原样;想改成中文昵称的话,在后台「用户 → 个人资料 → 昵称 / 显示名」里改即可。
- 如果发票列表有数据,表格列头也会显示中文(交易编号 / 链接 / 金额 / 操作等)—— 已一并覆盖。







