Size: 2605
Comment: pycategories_zh.py
|
← Revision 4 as of 2009-12-25 07:18:52 ⇥
Size: 2610
Comment: converted to 1.6 markup
|
Deletions are marked like this. | Additions are marked like this. |
Line 4: | Line 4: |
-- Zoom.Quiet [[[DateTime(2004-09-08T22:27:21Z)]]] [[TableOfContents]] |
-- Zoom.Quiet [<<DateTime(2004-09-08T22:29:23Z)>>] <<TableOfContents>> |
Line 17: | Line 17: |
=== 快速实现 == | == 快速实现 == |
Line 68: | Line 68: |
* 推荐 EmEditor [http://i18n.linux.net.cn/method.php 原因]!! | * 推荐 EmEditor [[http://i18n.linux.net.cn/method.php|原因]]!! |
Line 71: | Line 71: |
* [http://www.emeditor.com/ EmEditor主站点] * [http://www.emurasoft.com/cs/emeditor3/index.htm EmEditor中文正式版本] |
* [[http://www.emeditor.com/|EmEditor主站点]] * [[http://www.emurasoft.com/cs/emeditor3/index.htm|EmEditor中文正式版本]] |
简单定制已有插件,显示中文分类信息
-- Zoom.Quiet [2004-09-08 22:29:23]
Contents
pycategories.py
中文化分类显示
技术路线
直接中文的目录名?!?!
- 哈哈哈!美的你!
- 尝试过,但是想一想不同的系统实际建立时都是转换为自个儿的编码的目录,都要支持?!??!
- 不可能!
- 目录,中文说明对照
- 嗯嗯是最简单的实现方式
init.py 将目录视为模块,可以自动加载相应 label 之类的变量!嗬嗬嗬,高级技巧!
快速实现
- 创建!pycategories_zh.py 安装在 py['plugin_dirs'] 指定的目录中
1 zhlabel={
2 "":"是也乎"
3 ,"Quiet":"静空间"
4 ,"zworld":"众香界"
5 ,"Zoom":"智慧海"
6 ,"FLOSS":"FLOSS!自由精神"
7 ,"Python":"灵蟒!"
8 ,"Woodpacker":"啄木鸟社区"
9 ,"CZUG":"中国Zope用户组"
10 ,"wego":"wego!项目"
11 }
12 def chkoutlabel(key):
13 exp=""
14 try:
15 return zhlabel[key]
16 #exp=zhlabel[key]
17 except:
18 return key
19 #exp="是也乎"
20 #return(exp)
- 不放心!因为放入pycategories.py 后调试非常困难!.......只能通过观察 Apache 的 error-log 文件来定位错误………………
- 自个儿测试:
运行一下子在 PyBlosxom 的目录中……………… KO!
- 哈哈哈!加挂!
1 #pycategories.py 中:
2 from pycategories_zh import chkoutlabel as mylabel
3 ...
4 def genitem(self, item):
5 ...
6 #return (tab + "<a href=\"%s/%s%s\">%s/</a>%s" % (self._baseurl, item, self._flavour, itemlist[-1], num))
7 return (tab + "<a href=\"%s/%s%s\">%s/</a>%s" % (self._baseurl, item, self._flavour, mylabel(itemlist[-1]), num))
- 嘿嘿嘿!搞定!
注意!
- 所有含中文的脚本,全部要进行标准的UTF-8 编码的编写!
- 以前通过Ultraedit 编辑limux 下面的程序吃过亏!
中蟒 Glace 提醒,才知道有鬼字符 的情况!
- 将脚本另存为 utf-8 ;换行方式“仅LF(Unix)” 的最好…………