html tool

2012年7月24日星期二

Dive into python 的我的翻译IXV


       [原文]P117
Finally, imagine a Dialectizer framework with a plug−in architecture. You could put each Dialectizer class in a separate file, leaving only the translate function in dialect.py.
[pope译]最后{finally},想象嵌入{plug-in}结构{architecture}的Dialectizer 框架。你可以放置每一个Dialectizer class在独立文件中,仅留下这个翻译函数在dialect.py中。


[net 译 来源: http://woodpecker.org.cn/diveintopython/html_processing/all_together.html ]
最后,设想一下,使用了一种插件架构的 Dialectizer 框架。您可以将每个 Dialectizer 类放在分别放在独立的文件中,在 dialect.py 中只留下 translate 函数。

【popexizhi:
1. with a plug-in architecture
[pope译] 嵌入结构
[net 译]插件架构
[popexizhi] 首先这个是plug-in architecture 应该是一个很成熟翻译的业界术语,这里翻译为插架构是沿用业界翻译的,没什么可说的,倒是go了一下,介绍一下这个plug-in architecture 的
参见:  http://en.wikipedia.org/wiki/Plug-in_(computing) 
http://www.uml.org.cn/j2ee/20114121.asp
 http://bbs.osapub.com/thread-3898-1-1.html

从wiki的介绍来看,语言框架中还是普遍支持的,总感觉linux的系统和这个有点儿像,但是看来没什么证据:)

2.net译的小问题,这里的you 又翻译为您了,之前是翻译为我们 ,嘻嘻,不知这个是不是可以归结为协同翻译的合作问题:) 




Assuming a consistent naming scheme, the translate function could dynamic import the appropiate class from the appropriate file, given nothing but the dialect name. (You haven't seen dynamic importing yet, but I promise to cover it in a later chapter.)
[pope译] 假定{assuming}一个一致{consistent}的命名空间([?]assuming a consistent naming scheme,如何翻译?感觉自己说的有问题),这个翻译函数可以动态从appropriate文件中导入approplate 类,除了这个方言{dialect}名字什么也没增加(你现在也没看到动态导入,我打算在最后一章展示这个)

[net 译 来源: http://woodpecker.org.cn/diveintopython/html_processing/all_together.html ]
假定一种统一的命名模式,这个 translate 函数能够动态地从合适的文件中导入合适的类,除了方言名字外什么都不用给出。(虽然您还没有看过动态导入,但我保证在后面的一章中会涉及到它。) 

【popexizhi:
1. assuming a consistent naming scheme
[pope译]假定{assuming}一个一致{consistent}的命名空间
[net 译]假定一种统一的命名模式
[popexizhi] 其实自己的原文翻译中如果把scheme直译为方案,这样的翻译还是说的过去的。这里的scheme自己有与namespace 搞混了。
2. appropriate
合适的,
好吧!我上当了,嘻嘻,Lingoes sorry错怪你了,第一个appropriate原文是拼写的不对,找不到是当然的,我翻译时copy的是第二个对的appropriate。
3.(You haven't seen dynamic importing yet, but I promise to cover it in a later chapter.)
[pope译] (你现在也没看到动态导入,我打算在最后一章展示这个)
[net 译] (虽然您还没有看过动态导入,但我保证在后面的一章中会涉及到它。) 
[popexizhi] 不知为什么,这个句子我还是感觉翻译 promise to cover it 在这里为计划,而不是承诺说来合适。:)




To add a new dialect, you would simply add an appropriately−named file in the plug−ins directory (like foodialect.py which contains the FooDialectizer class). Calling the translate function with the dialect name 'foo' would find the module foodialect.py, import the class FooDialectizer, and away you go.
[pope译]增加一种新的方言{dialect},你可以简单的加入一个适当{appropriately}的插入目录{ins directory} 在插入中命名文件(像foodialect.py 包含 FooDialectizer类一样)。调用翻译函数使用方言{dialect}命名‘foo’查找 foodialect.py模块,导入  FooDialectizer类,([?]and away you go 如何翻译?)

[net 译 来源: http://woodpecker.org.cn/diveintopython/html_processing/all_together.html ]
 如果要加入一种新的方言,您只要在插件目录下加入一个以合适的名字命名的文件 (像 foodialect.py,它包含了 FooDialectizer 类) 。使用方言名 'foo' 来调用这个translate 函数,将会查找 foodialect.py 模块,导入 FooDialectizer 类,这样就行了。

【popexizhi:
1.you would simply add an appropriately-named file in the plug-ins directory
[pope译]你可以简单的加入一个适当{appropriately}的插入目录{ins directory} 在插入中命名文件
[net 译]您只要在插件目录下加入一个以合适的名字命名的文件
[popexizhi]
i.这里的simply的翻译我同意net 中直接省略的方式,自己的翻译太累赘了;
ii.appropriately-named file 适当名称的文件 ,这个现在我感觉这样翻译更好。net的直译也不错,都比自己眼里翻译的对;
iii.plug-ins
前几日看到是plug-in 插入式构架,不过这里看来不是的,是the plug-ins ,有定冠词the,有s,但是net译也只是说成为插件,好吧我也不太明白了。上下文看了一下,本段开始提出的a plug−in architecture ,这里的the plug-ins directory  应该是那里呼应的:).

2..and away you go.
net 译为 这样就行了,好吧,我也不知道,就先这里了吧。分析上下文,这里的find ,import 都是python 的这种plug-in下自动完成的,feel,这里作者是不是再说一边去吧,这里的find和import都不用你啊!:)

[pope改进译] 新加方言,你只用加入适当命名的文件到这个插件的目录中去(就像foodialect.py包含FooDialectizer类似的),(python系统)使用翻译函数方言foo将(自动)找到模块foodialect.py,导入FooDialectizer类,你一边去吧,用不到你做什么别的了。    

没有评论:

发表评论