Reply
 
Thread Tools Display Modes
  #1  
Old 07-21-2012, 03:41 AM
careone careone is offline
Junior Member
 
Join Date: Jun 2012
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default how to translate Emacs menu to other languages
new thread title: how to translate Emacs menu to other languages
old thread title: show Emacs menu in your mother language
-----------------
with the following method, you can translate Emacs menu to any languages.
now zh_CN is OK. Both linux and Windows are ok.
----------------
if your Chinese is good, or you have some Chinese friends, see below for more: (in Chinese Simpified)
* Emacs中文菜单汉化包deb下载(emacs-locale-zh-cn.deb)

http://forum.ubuntu.org.cn/viewtopic.php?f=17&t=212467

directly download .deb from here:
2012.7.16 updated,
for Emacs 21.x - 24.1 for Ubuntu/Debian/LinuxMint
emacs-locale-zh-cn_24.1-1~careone8_all.deb [729.65 KiB]
http://forum.ubuntu.org.cn/download/file.php?id=160198 (.deb directly download)

for Emacs 23.4/ 24.1 for Windows/Linux
2012.7.17 updated,
* fit for Emacs 23.4/24.1 for windows;
* fit for Emacs 21.x--24.x for Linux
emacs-locale-zh-cn4win-linux.v9.zip [968.59 KiB]
http://forum.ubuntu.org.cn/download/file.php?id=160258 (.zip directly download)

Quote:
[2012/7/16 updated]
* maybe fit Emacs 21.x -- 24.x for Linux (.deb);

switch emacs menu with following options:
Code:
sudo emacs-locale-zh-cn --m1 | --m2 | --en
ChangeLog for emacs-locale-zh-cn

emacs-locale-zh-cn
version: 24.1-1~careone8
2012/7/16 updated by Careone <careone@139.com>

FUNCTION
* add emacs-locale-zh-cn command to switch to Chinese with option:
--m1 active Scheme 1 for translated menu;
--m2 active Scheme 2 for translated menu;
--en return English menu (disable translated files and settings);

command full path: /usr/local/bin/emacs-locale-zh-cn
(note: you can modify/update this command file to fit your mother language on your will)

Scheme 1:
Code:
sudo emacs-locale-zh-cn --m1
use english.el + chinese-menu.el + mule-menu.el

test pass: Emacs 22.x - 24.x;
--------------
* Scheme 2:
Code:
sudo emacs-locale-zh-cn --m2
use translated lisp/menu-bar.el

testted pass/ not pass:
-- Emacs 23.1/Ubuntu 10.04 : testted pass;
-- Emacs 24.1 : not testted yet;
-- Emacs 22.3 : not pass (supportted terrible);
-- other Emacs versions: not testted yet;
--------------
Quote:
known bugs:
* some submenu display in English yet;
* lisp/facemenu.el submenu displasy in English yet;
* lisp/bookmark.el not work;
* lisp/ediff-hook.el not work;
* Emacs 23.1/Ubuntu 10.04 , enable --m1 or --m2, game
tetris display some spinned blank lines (but Emacs for Windows works ok);

* Emacs for Windows: some translated menu show bad codings (but tips show well);
file/dir adjustment:
* translate file *.el (s) and place them to dir:
/usr/share/emacs/$VERSION/site-lisp/zh_CN/lisp/
just as where them from (compatible for multi versions and multi languages support well);

TODO
* more lisp/*/*.el files need be translated;
Quote:
Code:
$ emacs-locale-zh-cn -h
Usage: /usr/local/bin/emacs-locale-zh-cn [OPTION]
toggle Emacs locale to Chinese Simipified (zh_CN) with 2 different methods:
use "chinese-menu.el" or "menu-bar.el"

-a, --auto equals [ --chinese-menu ], recommended (root please) *
--m1, --chinese-menu toggle locale to zh_CN with chinese-menu.el
and some others (root please)
--m2, --menu-bar toggle locale to zh_CN with menu-bar.el
and some others (root please)
--en, --english restore locale to en_US (root please)
-l, --list list supportted Emacs versions and extra options
-v, --version print the version information and exit
-h, --help print this message and exit
TECH ANALYSIS
;;; PART 1: for Linux/freebsd/pcbsd

;;; STEP 1: mkdir as root
;;; below is shown for language zh_CN,*
;;; you can REPLACE THE DIR NAME zh_CN with new dir named as your language/locale!!!
;;; dirs for Linux
Code:
mkdir /usr/share/emacs/$VERSION/site-lisp/zh_CN/
mkdir /usr/share/emacs/$VERSION/site-lisp/zh_CN/lisp/language/
mkdir /usr/share/emacs/$VERSION/site-lisp/zh_CN/lisp/international/
mkdir /usr/share/emacs/$VERSION/site-lisp/zh_CN/net/
mkdir /usr/share/emacs/$VERSION/site-lisp/zh_CN/play/
;;; FOR PCBSD PBI, THE dir should be like this:
for PCBSD i386
Quote:
mkdir /usr/pbi/emacs-i386/share/emacs/site-lisp/
mkdir /usr/pbi/emacs-i386/share/emacs/24.0.90/site-lisp/zh_CN/lisp/language/
mkdir /usr/pbi/emacs-i386/share/emacs/24.0.90/site-lisp/zh_CN/lisp/international/
mkdir /usr/pbi/emacs-i386/share/emacs/24.0.90/site-lisp/zh_CN/net/
mkdir /usr/pbi/emacs-i386/share/emacs/24.0.90/site-lisp/zh_CN/play/
or for PCBSD amd64
Quote:
mkdir /usr/pbi/emacs-amd64/share/emacs/site-lisp/
mkdir /usr/pbi/emacs-amd64/share/emacs/24.0.90/site-lisp/zh_CN/lisp/language/
mkdir /usr/pbi/emacs-amd64/share/emacs/24.0.90/site-lisp/zh_CN/lisp/international/
mkdir /usr/pbi/emacs-amd64/share/emacs/24.0.90/site-lisp/zh_CN/net/
mkdir /usr/pbi/emacs-amd64/share/emacs/24.0.90/site-lisp/zh_CN/play/
;;; STEP 2: translate files below, and then put them to*
;; /usr/share/emacs/$VERSION/site-lisp/zh_CN/lisp/ follow dirs where them come from:
Quote:
lisp/menu-bar.el
lisp/facemenu.el
lisp/bookmark.el ;this file translated not works, with unknown reason
lisp/international/mule-cmds.el
lisp/language/chinese.el
lisp/ediff-hook.el
lisp/pcvs-defs.el
lisp/play/animate.el
lisp/net/eudc.el
;;; step 3: creat file as root. The file name must be two numbers first, and end as .el*
touch /etc/emacs/site-start.d/90custom-locale.el
;; then edit it and save as below
Code:
;;--------------------
(load "zh_CN/lisp/menu-bar")
(load "zh_CN/lisp/facemenu")
;(load "zh_CN/lisp/bookmark")
(load "zh_CN/lisp/international/mule-cmds")
(load "zh_CN/lisp/language/chinese")
(load "zh_CN/lisp/ediff-hook")
(load "zh_CN/lisp/pcvs-defs")
(load "zh_CN/lisp/play/animate")
(load "zh_CN/lisp/net/eudc")
;;--------------------
TIPS:*
* *you also can write as below for short:
*;;--------------------
(load "menu-bar")
(load "facemenu") *
;...
;;--------------------
also ok. Because Emacs lookup .el files first in site-lisp/*/*.el, if not found, then
lisp/*/*.el (means in 'load' string, site-lisp/ has higher Priority then lisp/

;;; DONE.
;;; Now launch your Emacs. What do you see about it?

======================================

;;; PART 2: for Windows
;;; similar to for Linux/freebsd/pcbsd, but with different dir path:
;;;
;;; STEP 1:*
Code:
mkdir d:\emacs-$VERSION\site-lisp\zh_CN\
mkdir d:\emacs-$VERSION\site-lisp\zh_CN\lisp\language\
mkdir d:\emacs-$VERSION\site-lisp\zh_CN\lisp\international\
mkdir d:\emacs-$VERSION\site-lisp\zh_CN\net\
mkdir d:\emacs-$VERSION\site-lisp\zh_CN\play\
;;; STEP 2: same as for Linux/freebsd/pcbsd
;; translate files below, and then put them to*
;; /usr/share/emacs/$VERSION/site-lisp/zh_CN/lisp/ follow dirs where them come from:
Quote:
lisp/menu-bar.el
lisp/facemenu.el
lisp/bookmark.el ;this file translated not works, with unknown reason
lisp/international/mule-cmds.el
lisp/language/chinese.el
lisp/ediff-hook.el
lisp/pcvs-defs.el
lisp/play/animate.el
lisp/net/eudc.el
;;; step 3: similar to for Linux/freebsd/pcbsd, but with different dir path and fixed file name:
creat file as root. The file name must be "default.el" and must be under site-lisp\
;;; for works
d:\emacs-$VERSION\site-lisp\default.el
;; then edit it and save as below
Code:
;;--------------------
(load "zh_CN/lisp/menu-bar")
(load "zh_CN/lisp/facemenu")
;(load "zh_CN/lisp/bookmark")
(load "zh_CN/lisp/international/mule-cmds")
(load "zh_CN/lisp/language/chinese")
(load "zh_CN/lisp/ediff-hook")
(load "zh_CN/lisp/pcvs-defs")
(load "zh_CN/lisp/play/animate")
(load "zh_CN/lisp/net/eudc")
;;--------------------
;;; NOTE:*
;;*
;; no need to modify Windows registor and modify .reg file;
;; no need to modify .emacs

============================

;;; TIPS:
1* in emacs-locale-zh-cn for Linux, we have another method to attain the goal,
STEP 1 OF SCHEME 1:
use three files, which include in the emacs-locale-zh-cn.deb package:
Quote:
/usr/share/emacs/site-lisp/english-menu.el ;not need to translate
/usr/share/emacs/site-lisp/chinese-menu.el ;need translated and save as franch-menu.el, german-menu.el ...
/usr/share/emacs/site-lisp/mule-menu.el ;not need to translat
STEP 2 OF SCHEME 1:
creat and edit the file, similar as above in STEP 3:
/etc/emacs/site-start.d/90custom-locale.el*
note: line order must be as follow, the "mule-menu" line must be last
Code:
	;------------------------
	(require 'english-menu)
	(require 'chinese-menu)
	(require 'mule-menu)
	;------------------------
;;; WARNNING: THIS SCHEME NOT FIT FOR WINDOWS! (MAY CAUSE BAD CODINGS!)

ENJOY IT!

file/dir tree

Last edited by careone; 07-26-2012 at 04:25 AM. Reason: change thread title for more reviews
Reply With Quote
  #2  
Old 07-21-2012, 03:42 AM
careone careone is offline
Junior Member
 
Join Date: Jun 2012
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default
files/dirs tree
Quote:
.
│ list.txt

├─bat.develop
│ tree-emacs-list.bat

├─linux
│ ├─etc
│ │ └─emacs
│ │ └─site-start.d
│ │ │ 86emacs-zh-cn.el
│ │ │
│ │ └─disabled.zh-cn.d
│ │ 86emacs-zh-cn.el
│ │ 87default-zh-cn.el
│ │
│ └─usr
│ ├─local
│ │ ├─bin
│ │ │ emacs-locale-zh-cn
│ │ │
│ │ └─share
│ │ └─careone
│ │ └─emacs-locale-zh-cn
│ │ │ ChangeLog.emacs-locale-zh-cn.txt
│ │ │ ChangeLog.menu-bar.el
│ │ │ emacs-download-from.txt
│ │ │ emacs-hotkeys.txt
│ │ │ readme.emacs-locale-zh-cn.gb2312.2012-05-21.txt
│ │ │ ubuntu-emacs-versions.txt
│ │ │
│ │ ├─bin
│ │ │ emacs-en2zh-cn_24.1.sed
│ │ │
│ │ ├─etc
│ │ │ sokoban.levels
│ │ │
│ │ ├─lisp
│ │ │ └─play
│ │ │ sokoban.el
│ │ │
│ │ ├─site-lisp
│ │ │ default.el
│ │ │
│ │ └─windows
│ │ │ init-win32.el
│ │ │ init-windows.el
│ │ │ w32-vars.el
│ │ │
│ │ ├─bat
│ │ │ tree-emacs-list.bat
│ │ │
│ │ └─reg
│ │ emacs-patch-zn-cn-23.4.reg
│ │ emacs-patch-zn-cn-24.1.reg
│ │ emacs-zn-cn-unreg.reg
│ │ mk.emacs-file-23.4.bat
│ │ mk.emacs-file-24.1.bat
│ │
│ └─share
│ └─emacs
│ ├─21.4
│ │ └─site-lisp
│ │ menu-bar.orig.el
│ │
│ ├─22.0.50
│ │ └─site-lisp
│ │ menu-bar.orig.el
│ │
│ ├─22.3
│ │ └─site-lisp
│ │ menu-bar.orig.el
│ │
│ ├─23.1
│ │ └─site-lisp
│ │ └─zh_CN
│ │ └─lisp
│ │ │ ediff-hook.el
│ │ │ facemenu.el
│ │ │ menu-bar.el
│ │ │ menu-bar.orig.el
│ │ │
│ │ ├─international
│ │ │ mule-cmds.el
│ │ │
│ │ ├─language
│ │ │ chinese.el
│ │ │
│ │ └─play
│ │ animate.el
│ │
│ ├─23.2
│ │ └─site-lisp
│ │ menu-bar.orig.el
│ │
│ ├─23.3
│ │ └─site-lisp
│ │ menu-bar.orig.el
│ │
│ ├─23.4
│ │ └─site-lisp
│ │ └─zh_CN
│ │ └─lisp
│ │ │ ediff-hook.el
│ │ │ facemenu.el
│ │ │ menu-bar.el
│ │ │ menu-bar.orig.el
│ │ │
│ │ ├─international
│ │ │ mule-cmds.el
│ │ │
│ │ ├─language
│ │ │ chinese.el
│ │ │
│ │ └─play
│ │ animate.el
│ │
│ ├─24.1
│ │ └─site-lisp
│ │ └─zh_CN
│ │ └─lisp
│ │ │ ediff-hook.el
│ │ │ facemenu.el
│ │ │ menu-bar.el
│ │ │ menu-bar.orig.el
│ │ │
│ │ ├─international
│ │ │ mule-cmds.el
│ │ │
│ │ ├─language
│ │ │ chinese.el
│ │ │
│ │ └─play
│ │ animate.el
│ │
│ └─site-lisp
│ │ chinese-menu.2006.el
│ │ chinese-menu.el
│ │ english-menu.el
│ │ linum.el
│ │ mule-menu.el
│ │
│ ├─other
│ │ line-num.el
│ │ linum+.el
│ │ linum-old.el
│ │ linum.el
│ │ wb-line-number.el
│ │
│ └─zh_CN
│ ├─.emacs.d
│ │ init.el
│ │
│ └─loadlist
│ loaddefs.el

└─windows
│ emacs-locale-zh-cn.txt

├─emacs-23.4
│ │ emacs-patch-zn-cn-23.4.reg
│ │ emacs-zn-cn-unreg.reg
│ │ emacs4windows-23.4-list.txt
│ │ mk.emacs-file-23.4.bat
│ │
│ └─site-lisp
│ │ default.el
│ │
│ └─zh_CN
│ └─lisp
│ │ ediff-hook.el
│ │ facemenu.el
│ │ menu-bar.el
│ │ menu-bar.orig.el
│ │
│ ├─international
│ │ mule-cmds.el
│ │
│ ├─language
│ │ chinese.el
│ │
│ └─play
│ animate.el

├─emacs-24.1
│ │ emacs-patch-zn-cn-24.1.reg
│ │ emacs-zn-cn-unreg.reg
│ │ emacs4windows-24.1-list.txt
│ │ mk.emacs-file-24.1.bat
│ │
│ └─site-lisp
│ │ default.el
│ │
│ └─zh_CN
│ └─lisp
│ │ ediff-hook.el
│ │ facemenu.el
│ │ menu-bar.el
│ │ menu-bar.orig.el
│ │
│ ├─international
│ │ mule-cmds.el
│ │
│ ├─language
│ │ chinese.el
│ │
│ └─play
│ animate.el
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 09:43 AM.


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

Copyright 2005-2010, The PC-BSD Project. PC-BSD and the PC-BSD logo are registered trademarks of iXsystems.
All other content is freely available for sharing under the terms of the Creative Commons Attribution License.