XEmacs 菜单汉化方法[2012/8/31更新]

Vim、Emacs配置和使用
回复
头像
careone
帖子: 839
注册时间: 2007-12-17 21:41

XEmacs 菜单汉化方法[2012/8/31更新]

#1

帖子 careone » 2012-07-26 22:28

XEmacs 菜单汉化方法
2012-08-31更新
xemacs-locale-zh-cn4windows_20120831.zip
2012-8-31更新,针对xemacs21.4.22/21.5.31独立翻译。建议使用
(121.93 KiB) 已下载 140 次
xemacs-locale-zh-cn.v1.2012-07-26.zip
基于 XEmacs 21.5.31 for Windows, 原则上通用于 Linux
(78.65 KiB) 已下载 134 次
补充了翻译及其它,详见3楼
2012-08-04
测试平台:
* XEmacs 21.5.31 beta for Windows
* XEmacs 21.4.22 stable for Windows/Ubuntu 10.04
已知问题:
一、菜单的中文显示
* XEmacs 21.4.22 (当前稳定版) FOR Windows:在翻译完 lisp/menubar-items.el 文件后,必须保存为除UTF-8以外的其它文件编码,否则中文菜单仍会乱码(如GB2312, GBK,GB18030, UNICODE 都可以,偏偏使用UTF-8就不行);
* XEmacs 21.4.22 (当前稳定版) FOR Linux:经实测,不管menubar-items.el 文件编码保存为什么格式,均无法正常显示中文菜单;

* XEmacs 21.5.31(当前开发版) FOR Windows:menubar-items.el 的文件编码应保存为UTF-8或UNICODE都能有效显示中文菜单,但是如果保存为gbk或gb2312编码,菜单会出现乱码;

* XEmacs 21.5.31(当前开发版)FOR Linux:暂无测试平台

二、显示中文文本内容:
* XEmacs 21.5.31 测试版 for Windows: 可以正常显示包括utf-8, gb18030,gbk, gb2312,unicode 在内的中文编码文件;

* XEmacs 21.4.22 稳定版for Windows:
可以正常显示gbk, gb2312, 编码的中文文件;
对gb18030编码的文件部分字符仍会乱码;
unicode 和 utf-8 编码的文件则完全乱码;

* XEmacs 21.4.22 稳定版for Ubuntu 10.04:
经实测,无法正常显示中文内容;

* XEmacs 21.5.31 测试版for Linux:
暂无测试平台,但根据同版本对 Windows 的支持,推测能完美显示各种中文编码格式的文件;

三、输入中文
* XEmacs 21.5.31 测试版for Windows:
能正常输入中文;

* XEmacs 21.4.22 稳定版for Windows:
无法在文件中输入中文;

* XEmacs 21.4.22 稳定版for Linux:
无法在文件中输入中文;

* XEmacs 21.5.31 测试版for Windows:
暂无测试平台
下载地址: http://ftp.xemacs.org/xemacs/binaries/win32/InnoSetup/
XEmacs_Setup_21.4.19.exe 28-Jan-2006 22:45 10.0M
XEmacs_Setup_21.4.20.exe 09-Dec-2006 22:04 20.3M
XEmacs_Setup_21.4.21.exe 12-Oct-2007 12:40 20.5M
XEmacs_Setup_21.4.22.exe 03-Dec-2011 23:26 28.6M

XEmacs_Setup_21.5.28.exe 07-Jan-2009 00:13 23.7M
XEmacs_Setup_21.5.29.exe 17-Jun-2009 23:02 25.7M
XEmacs_Setup_21.5.31.exe 03-Dec-2011 23:27 35.0M
原理:
与之前我写的两篇贴子介绍的 GNU Emacs 的汉化原理相同:

* emacs-locale-zh-cn for Ubuntu/Debian (.deb) 
http://forum.ubuntu.org.cn/viewtopic.php?f=17&t=212467

* emacs-locale-zh-cn for Windows/Linux (.zip)
http://forum.ubuntu.org.cn/viewtopic.php?f=68&t=375876
xemacs-locale-zh-cn.jpg
xemacs 21.4.22/21.531 for Windows都能正常显示中文菜单,但保存翻译好的menubar-items.el 时文字编码有严格要求:xemacs 21.4.22必须使用除utf-8和unicode的其它编码;xemacs 21.5.31则必须是utf-8或unicode, 反而不能是gbk/gb2312
xemacs 21.4.22/21.531 for Windows都能正常显示中文菜单,但保存翻译好的menubar-items.el 时文字编码有严格要求:xemacs 21.4.22必须使用除utf-8和unicode的其它编码;xemacs 21.5.31则必须是utf-8或unicode, 反而不能是gbk/gb2312
*1 翻译最主要的菜单文件 menubar-items.el ,并放在 site-lisp/ 目录下;

默认的XEmacs 的安装位置如下:

C:\Program Files\XEmacs\XEmacs-21.5.31\site-lisp\zh_CN\lisp\

*2 在 site-lisp/ 目录下新建一个 default.el 文件(必须在这个位置,同时必须是这个文件名)。
文件内容如下:
;--------------------
(load "zh_CN/lisp/menubar-items")
;
;; 也可以简写为以下方式:
;(load "menubar-items")
;
;; 以上写法通用于 Linux/Windows;
;; Emacs/XEmacs 会优先在 site-lisp/ 目录及下面的子目录内查找需要加载的 .el,
;; 找不到才会到 lisp/ 目录下继续查找;
;;
; XEmacs 的 menubar-items.el 文件,相当于 Emacs 的 menu-bar.el
;--------------------


附:汉化补丁包的使用方法:

把补丁包内的目录整个复制到 XEmacs 的安装目录即可。


XEmacs FOR Linux:
原理同上,只是文件存放路径稍有不同:
* 1 新建目录(注:不同版本的XEmacs, 请根据实际情况调整目录位置)

代码: 全选

sudo	mkdir -vp /usr/share/XEmacs/21.5.31/site-lisp/zh_CN/lisp/
*1
把翻译过的 menubar-items.el 文件复制到下面的 site-lisp/zh_CN/lisp/ 目录下;

*2 在 /etc/xemacs/site-start.d/ 目录下,新建一个 90custom-locale.el 文件,文件内容如下:
;;-----------------
(load "zh_CN/lisp/menubar-items")
;;-------------------

即可。

更详细的原理,请参考我以前写的 GNU Emacs 汉化原理。
目前提供的 menubar-items.el 仅是部分汉化,仅用示显示汉化效果。需要继续完成汉化翻译。

* emacs-locale-zh-cn for Ubuntu/Debian (.deb) 
http://forum.ubuntu.org.cn/viewtopic.php?f=17&t=212467

* emacs-locale-zh-cn for Windows/Linux (.zip)
http://forum.ubuntu.org.cn/viewtopic.php?f=68&t=375876
附表:
Beta XEmacs Releases
XEmacs 测试版版本历史
http://www.xemacs.org/Releases/index.html

* 2012-08-02: [21.5.32 release notice] [changelogs]
* 2011-04-29: [21.5.31 release notice] [changelogs]
* 2011-04-27: [21.5.30 release notice] [changelogs]
* 2009-05-19: [21.5.29 release notice] [changelogs]
* 2007-05-21: [21.5.28 release notice] [changelogs]
* 2006-05-16: [21.5.27 release notice] [changelogs]
* 2006-03-31: [21.5.26 release notice] [changelogs]
* 2006-02-26: [21.5.25 release notice] [changelogs]
* 2005-12-19: [21.5.24 release notice] [changelogs]
* 2005-10-26: [21.5.23 release notice] [changelogs]
* 2005-09-14: [21.5.22 release notice] [changelogs]
* 2005-05-28: [21.5.21 release notice] [changelogs]
* 2005-03-12: [21.5.20 release notice] [changelogs]
* 2005-02-18: [21.5.19 release notice] [changelogs]
* 2004-10-22: [21.5.18 release notice] [changelogs]
* 2004-03-22: [21.5.17 release notice] [changelogs]
* 2003-09-26: [21.5.16 release notice] [changelogs]
* 2003-09-05: [21.5.15 release notice] [changelogs]
* 2003-06-02: [21.5.14 release notice] [changelogs]
* 2003-05-11: [21.5.13 release notice] [changelogs]
* 2003-04-25: [21.5.12 release notice] [changelogs]
* 2003-02-17: [21.5.11 release notice] [changelogs]
* 2003-01-10: [21.5.10 release notice] [changelogs]
* 2002-08-31: [21.5.9 release notice]
* 2002-07-27: [21.5.8 release notice]
* 2002-07-03: [21.5.7 release notice] [changelogs]
* 2002-04-05: [21.5.6 release notice] [changelogs]
* 2002-03-06: [21.5.5 release notice] [changelogs]
* 2002-01-09: [21.5.4 release notice] [changelogs]
* 2001-09-07: [21.5.3 release notice] [changelogs]
* 2001-07-28: [21.5.2 release notice] [changelogs]
* 2001-05-09: [21.5.1 release notice] [changelogs]

* 2001-04-14: [21.2.47 release notice]
* 2001-03-21: [21.2.46 release notice] [changelogs]
* 2001-02-23: [21.2.45 release notice] [changelogs]
* 2001-02-08: [21.2.44 release notice] [changelogs]
* 2001-01-28: [21.2.43 release notice] [changelogs]
* 2001-01-20: [21.2.42 release notice] [changelogs]
* 2001-01-17: [21.2.41 release notice] [changelogs]
* 2001-01-08: [21.2.40 release notice] [changelogs]
* 2000-12-31: [21.2.39 release notice] [changelogs]
* 2000-12-05: [21.2.38 release notice] [changelogs]
* 2000-11-15: [21.2.37 release notice] [changelogs]
* 2000-10-04: [21.2.36 release notice] [changelogs]
* 2000-07-19: [21.2.35 release notice] [changelogs]
* 2000-05-29: [21.2.34 release notice] [changelogs]
* 2000-05-02: [21.2.33 release notice] [changelogs]
* 2000-03-20: [21.2.32 release notice] [changelogs]
* 2000-02-23: [21.2.31 release notice] [changelogs]
* 2000-02-22: [21.2.30 release notice] [changelogs]
* 2000-02-16: [21.2.29 release notice] [changelogs]
* 2000-02-07: [21.2.28 release notice] [changelogs]
* 2000-01-18: [21.2.27 release notice] [changelogs]
Stable XEmacs Releases
XEmacs 稳定版版本历史
http://www.xemacs.org/Releases/index.html

# 2009-01-30: [21.4.22 release notice]
# 2007-11-10: [21.4.21 release notice]
# 2006-12-10: [21.4.20 release notice]
# 2006-01-30: [21.4.19 release notice]
# 2005-12-05: [21.4.18 release notice]
# 2005-02-06: [21.4.17 release notice]
# 2004-12-11: [21.4.16 release notice]
# 2004-02-03: [21.4.15 release notice]
# 2003-09-07: [21.4.14 release notice]
# 2003-05-26: [21.4.13 release notice]
# 2003-01-16: [21.4.12 release notice]
# 2003-01-03: [21.4.11 release notice]
# 2002-11-02: [21.4.10 release notice]
# 2002-08-24: [21.4.9 release notice]
# 2002-05-09: [21.4.8 release notice]
# 2002-05-04: [21.4.7 release notice]
# 2001-12-17: [21.4.6 release notice]
# 2001-10-23: [21.4.5 release notice]
# 2001-07-28: [21.4.4 release notice]
# 2001-05-17: [21.4.3 release notice]
# 2001-05-10: [21.4.2 release notice]
# 2001-04-19: [21.4.1 release notice]
# 2001-04-16: [21.4.0 release notice]
上次由 careone 在 2013-04-06 22:42,总共编辑 7 次。
魁拔不死,天下不宁。
魁拔既死,天下不平。
--------------
Careone <emacslocale^126.com>
https://sourceforge.net/projects/emacslocale/files/
头像
reverland
帖子: 1317
注册时间: 2011-11-26 15:57
系统: windows xp
联系:

Re: XEmacs 菜单汉化方法[2012/7/26更新]

#2

帖子 reverland » 2012-08-03 12:34

:em11
托在github上的jekyll博客
Always Look on the Bright Side of Life
头像
careone
帖子: 839
注册时间: 2007-12-17 21:41

Re: XEmacs 菜单汉化方法[2012/8/31更新]

#3

帖子 careone » 2012-08-31 18:49

2012-8-31更新
XEmacs 21.4.22/21.5.31 for Windows 汉化包

2012-08-30 Careone <careone@139.com>

* 参考网址: XEmacs 菜单汉化方法
viewtopic.php?f=68&t=382257
-------------------------------------------------

* 使用方法:

按XEmacs版本,把本补丁包里的整个目录直接复制合并到XEmacs
安装目录即可。

* 技术原理说明:

以XEmacs-21.5.31为例:
* 目前即翻译了以下文件:
C:\Program Files\XEmacs\XEmacs-21.5.31\lisp\menubar-items.el
并把翻译过的文件另存为
C:\Program Files\XEmacs\XEmacs-21.5.31\site-lisp\zh_CN\lisp\menubar-items.el

* 注意:
* C:\Program Files\XEmacs\XEmacs-21.5.31\site-lisp\
这个目录默认情况下是不存在,需要手动新建目录。
并在这个site-lisp目录或下面的子目录新建一个 default.el 文件
(文件名也可以是 site-start.el )。XEmacs会自动搜索并加载
default.el 或 site-start.el 的内容。因此只需要在这两个文件中,
使用load语句加载翻译过的 menubar-items.el 文件即可实现菜单的翻
译效果。

site-lisp/default.el 或者 site-lisp/site-start.el
文件内容如下面三行所示:

(load "menubar-items")
'(setnu-mode t)
;'(setup-chinese-gb-environment t)

* 上面第一行的作用是加载翻译过的 menubar-items.el 菜单文件,类似于 Emacs 下的
menu-bar.el 文件;
* 上面第二行的作用是在左侧显示行号,类似于 Emacs 下的 (global-linum-mode 1);
* 第三行的作用是设置为简体中文语言环境(但在XEmacs 21.4.22 for Windows中,似乎
没有这个功能,for Linux 倒是发现了这个功能);

其它注意事项:
* XEmacs 21.4.22 for Windows:
翻译过的 menubar-items.el 文件必须另存为
gb2312/gbk/gb18030中的某一种,如果选用utf-8或unicode,菜单会乱码;
(site-lisp\default.el 或者 site-lisp\site-start.el 如果文件内容有简体中文文字,也同样不能保存为utf-8或unicode)

* XEmacs 21.5.31 for Windows:
和上面的XEmacs 21.4.22 for Windows相反:
翻译过的 menubar-items.el 文件必须另存为utf-8或unicode
中的某一种,如果选用gb2312/gbk/gb18030,菜单又会乱码;
(site-lisp\default.el 或者 site-lisp\site-start.el 如果文件内容有简体中文文字,也同样不能保存为gb2312/gbk/gb18030)

XEmacs for Windows中,不同目录下的 .el 文件,load 语句对目录分隔符有不同的要求:

* 如果是 init.el 或 custom.el 文件中,load 语句应该这样写
(目录分隔符应为Windows风格)
(load ".\menubar-items")

* 如果是 site-lisp\default.el 或site-lisp\site-start.el 中,
目录分隔符应为Unix风格,如下所示:
(load "./menubar-items")

* XEmacs 21.4.22,在Ubuntu 10.04测试环境中,仍无法设置为显示中文菜单,也无法正常
显示中文文本, 原因可能是没有安装和配置能让XEmacs识别的中文字体,需要进一步调试。


* TODO
下阶段(可能是很长一段时间之后),会进行以下几方面的完善:
* 翻译 lisp/cus-edit.el
* 翻译 lisp/cus-face.el
* 翻译 lisp/cus-file.el
* 翻译 lisp/cus-start.el
* 翻译 lisp/cus-dep.el
* 翻译 lisp/custom.el
* 翻译 lisp/custom-load.el

* 编写linux环境下的自动化翻译脚本。目前已制作出for Emacs/Linux 的自动翻译脚本
(用 sed 实现,还需要更多的调试和细节处理,成熟后会以deb包形式发布);

* 还需要更多支持 XEmacs 的朋友的关心和协助...
魁拔不死,天下不宁。
魁拔既死,天下不平。
--------------
Careone <emacslocale^126.com>
https://sourceforge.net/projects/emacslocale/files/
回复