Jan
11
关于在Bluehost上Wordpress中文版变成英文版的解决方案
昨晚突然发现我的wordpress中文版莫名其妙的变成英文版了,查阅一些资料得知:在64位空间上安装wordpress会出不汉化的情况,这是Wordpress自身缺陷,问题的根源原来是Wordpress在64位的CPU下(linux系统)运行时,由于PHP-gettext解析.mo语言文件出错,以至于Wordpress在使用中文版本时失败,这是由于PHP-gettext在加载.mo文件时,没有正确匹配验证位导致stream自动关闭。WordPress 官方还没弄出个最终解决方案,只能自行修改。
步骤如下:
在操作之前,首先确认你安装的Wordpress确实是中文版,然后备份需要修改的文件
1、在\wordpress\wp-includes\这个目录下找到gettext.php
2、打开gettext.php这个文件找到以下代码
- if ($magic == ($MAGIC1 & 0xFFFFFFFF)) { // to make sure it works for 64-bit platforms
- $this->BYTEORDER = 0;
- } elseif ($magic == ($MAGIC2 & 0xFFFFFFFF)) {
3、将上面的代码修改为
- if ($magic == $MAGIC1) {
- $this->BYTEORDER = 0;
- } elseif ($magic == $MAGIC2) {
4、现在重新登陆wordpress,看到是中文就证明成功了,如果还是不行,就将代码修改成
- if ($magic == ($MAGIC1 & 0xFFFFFFFF) || ($magic == ($MAGIC3 & 0xFFFFFFFF)) { // to make sure it works for 64-bit platforms
- $this->BYTEORDER = 0;
- } elseif ($magic == ($MAGIC2 & 0xFFFFFFFF)) {
- $this->BYTEORDER = 1;
- } else {
- $this->BYTEORDER = 0;
- //$this->error = 1; // not MO file
- //return false;
- }
- ?>
如果再不行的话,我也就没办法了,因为我完成第3步之后就发现已经回到中文版了。
相关日志
|





Merci beaucoup pour cette solution rapide à ce problème de traduction de langues!
I found your site, I was having the same problem with my translation in wordpress from english to french, but thanks to your URL, I was able to find your article with the keywords in it
Hi, dave. I am so glad that I can help you for something about wordpress, You are the first foreigner who came to my blog and gave a comment to me. Thanks a lot.
我晕,折腾一上午才看见这有办法。
我弄到第二步就搞定了。
哈哈。。。谢谢Bruce。
但是,今天我升级到2.3.2后,又变成英文的了。郁闷
我用第二种方法成功了,不过要把第10行删除。
菠菜,那是因为你覆盖了修改过的文件啊。
I’ve found another solution which seems easier, you can find it here: http://bluehostforum.com/showthread.php?t=11536
Dave, thanks so much. That’s really a nice solution about the translation problem about wordpress.