由于伟大的墙的存在,亲们使用不了这个插件,不过可以往主题里添加以下代码,让百度自动翻译标题为文章的英文slug:
function translate_chinese_post_title_to_en_for_slug( $title ) {
/*
transtype:
trans
realtime
*/
$translation_render = 'https://fanyi.baidu.com/v2transapi?from=zh&to=en&transtype=realtime&simple_means_flag=3&query='.$title;
$wp_http_get = wp_safe_remote_get( $translation_render );
if ( empty( $wp_http_get->errors ) ) {
if ( ! empty( $wp_http_get['body'] ) ) {
$trans_result = json_decode( $wp_http_get['body'], true );
$trans_title = $trans_result['trans_result']['data'][0]['dst'];
return $trans_title;
}
}
return $title;
}
add_filter( 'sanitize_title', 'translate_chinese_post_title_to_en_for_slug', 1 );
不谢,我叫雷锋。
]]>hi
in the first : i tanks very very much for this useful plugin .
how i can change failure mode from id to post title or don’t translate ?
for example i have sending a post and this plugin can’t translate and doing the failure mode and saving post permalink with id but how i can change this mode to don’t translate and saving this post that no translate with original language permalink ?
thank you .
]]>Hi,
If I paid for google translate, is there any option for it?
The result from translate API and bing translate website is different.
The result of website is much much better.
Is there any option to fix it? or change to google translate?
Thanks very much
https://www.ads-software.com/extend/plugins/google-slug-translate/
https://www.ads-software.com/extend/plugins/wp-slug-translate/
]]>