修改Translate Widget以适应中文Blog
Translate Widget是一个加拿大小伙子为Wordpress Blog编写的翻译插件,使用了Google的翻译服务,但由于作者是基于英文站点编写的,因此插件默认的Blog语言为英文,并且没有提供直观的选项更改,对于中文站点并不适用,如果我们想使用这个服务,需要手动修改这个插件,所幸并不复杂:wink:
- 用一个文本编辑器打开translate.php文件
- 将第41行的‘Chinese’ => ‘zh-CN’改为‘English’ => ‘en’
- 将第53和54行的
$langname=’English’;
$langcode=’en’;
改为
$langname=’Chinese’;
$langcode=’zh-CN’; - 将第51和68行中的en替换为zh-CN,如http://www.google.com/translate?hl=en&ie=UTF8&langpair=en%7C$langcode&u=$url改为
http://www.google.com/translate?hl=zh-CN&ie=UTF8&langpair=zh-CN%7C$langcode&u=$url
这样就可以把中文Blog翻译成其他语言了,可以参考本站点左侧的Translate栏目。
May 1st, 2006 at 5:23 am
Great explanation!
I might add that as an option in future versions.
It’s neat to see my plugin modified to work with other languages
May 1st, 2006 at 10:40 am
Hi, Trevor, I am very pleased to see your comment:wink:, and looking forward to the next version, I think it will be more wonderful!
March 16th, 2007 at 2:12 am
Hi,
I have now added this functionality to my plugin by default. You can find it here: http://trevorcreech.com/blog/2007/02/17/translate-widget-20/
March 16th, 2007 at 9:15 am
[quote comment="3349"]Hi,
I have now added this functionality to my plugin by default. You can find it here: http://trevorcreech.com/blog/2007/02/17/translate-widget-20//quote
Good job!