wordpress - Wordpress 网站翻译 - 翻译字符串的严重困难
问题描述
我没有丰富的经验,在 wordpress 中翻译门户网站时遇到了很大的困难。尽管进行了所有测试,但有些字符串无法翻译:
在文件夹中的各种 .po 文件中搜索字符串的所有匹配项后,直接使用 Loco Translate 翻译主题
在functions.php中强制翻译
add_filter('gettext', 'translate_text');
add_filter('ngettext', 'translate_text');
function translate_text($translated) {
$translated = str_ireplace('mystring', 'mystrintraslated', $translated);
return $translated;
}
- 修改所有出现的源,以查看更改是否影响了站点:
public function single_dummy_post() {
bp_theme_compat_reset_post(
array(
'ID' => 0,
'post_title' => __( 'mystringtranslated', 'mytheme),
'post_author' => 0,
'post_date' => 0,
'post_content' => '',
'post_type' => 'page',
'post_status' => 'publish',
'is_page' => true,
'comment_status' => 'closed',
)
);
}
更改后还清除缓存。
无事可做,网站保持不变。我还能尝试做什么?
解决方案
推荐阅读
- mysql - MySQL:如何将参数传递给触发器
- amazon-web-services - 我在控制台中是哪个 IAM 用户?
- android - Android中的空menuPopup Window
- powershell - 在 PowerShell Core 中获取目标框架属性
- python - PyTorch 中的连接张量
- ember.js - 是否可以创建私有或内部 ember.js 插件?
- c++ - 将范围从成员更改为全局功能
- r - 正确使用 mlr::mergeBenchmarkResults
- node.js - 需要通过模式拼接来查找连接订阅的错误
- javascript - 如何为 Visual Studio 代码扩展创建自定义 ColorProvider?