mirror of
https://github.com/DesignPatternsPHP/DesignPatternsPHP.git
synced 2025-07-28 10:40:17 +02:00
Chinese translation part three
finish Builder translattion finish Pool translattion correct words translation correct words translation correct words translation finish locale/zh_CN/LC_MESSAGES/Structural/README.po translation finish DependencyInjection translation
This commit is contained in:
@@ -13,53 +13,58 @@ msgstr ""
|
||||
|
||||
#: ../../Creational/Builder/README.rst:2
|
||||
msgid "`Builder`__"
|
||||
msgstr ""
|
||||
msgstr "生成器模式"
|
||||
|
||||
#: ../../Creational/Builder/README.rst:5
|
||||
msgid "Purpose"
|
||||
msgstr ""
|
||||
msgstr "目的"
|
||||
|
||||
#: ../../Creational/Builder/README.rst:7
|
||||
msgid "Builder is an interface that build parts of a complex object."
|
||||
msgstr ""
|
||||
msgstr "生成器的目的是将复杂对象的创建过程(流程)进行抽象,生成器表现为接口的形式。"
|
||||
|
||||
#: ../../Creational/Builder/README.rst:9
|
||||
msgid ""
|
||||
"Sometimes, if the builder has a better knowledge of what it builds, this "
|
||||
"interface could be an abstract class with default methods (aka adapter)."
|
||||
msgstr ""
|
||||
"在特定的情况下,比如如果生成器对将要创建的对象有足够多的了解,那么代表生成器的接口(interface)可以是"
|
||||
"一个抽象类(也就是说可以有一定的具体实现,就像众所周知的适配器模式)。"
|
||||
|
||||
#: ../../Creational/Builder/README.rst:12
|
||||
msgid ""
|
||||
"If you have a complex inheritance tree for objects, it is logical to have a "
|
||||
"complex inheritance tree for builders too."
|
||||
msgstr ""
|
||||
"如果对象有复杂的继承树,理论上创建对象的生成器也同样具有复杂的继承树。"
|
||||
|
||||
#: ../../Creational/Builder/README.rst:15
|
||||
msgid ""
|
||||
"Note: Builders have often a fluent interface, see the mock builder of "
|
||||
"PHPUnit for example."
|
||||
msgstr ""
|
||||
"提示:生成器通常具有流畅的接口,推荐阅读关于 PHPUnit 的mock生成器获取更好的理解。"
|
||||
|
||||
#: ../../Creational/Builder/README.rst:19
|
||||
msgid "Examples"
|
||||
msgstr ""
|
||||
msgstr "例子"
|
||||
|
||||
#: ../../Creational/Builder/README.rst:21
|
||||
msgid "PHPUnit: Mock Builder"
|
||||
msgstr ""
|
||||
"PHPUnit: Mock 生成器"
|
||||
|
||||
#: ../../Creational/Builder/README.rst:24
|
||||
msgid "UML Diagram"
|
||||
msgstr ""
|
||||
msgstr "UML 图"
|
||||
|
||||
#: ../../Creational/Builder/README.rst:31
|
||||
msgid "Code"
|
||||
msgstr ""
|
||||
msgstr "代码"
|
||||
|
||||
#: ../../Creational/Builder/README.rst:33
|
||||
msgid "You can also find these code on `GitHub`_"
|
||||
msgstr ""
|
||||
msgstr "你可以在 `GitHub`_ 上找到这些代码"
|
||||
|
||||
#: ../../Creational/Builder/README.rst:35
|
||||
msgid "Director.php"
|
||||
@@ -103,7 +108,7 @@ msgstr ""
|
||||
|
||||
#: ../../Creational/Builder/README.rst:96
|
||||
msgid "Test"
|
||||
msgstr ""
|
||||
msgstr "测试"
|
||||
|
||||
#: ../../Creational/Builder/README.rst:98
|
||||
msgid "Tests/DirectorTest.php"
|
||||
|
@@ -13,7 +13,7 @@ msgstr ""
|
||||
|
||||
#: ../../Creational/Pool/README.rst:2
|
||||
msgid "`Pool`__"
|
||||
msgstr ""
|
||||
msgstr "对象池"
|
||||
|
||||
#: ../../Creational/Pool/README.rst:4
|
||||
msgid ""
|
||||
@@ -24,6 +24,10 @@ msgid ""
|
||||
"object. When the client has finished, it returns the object, which is a "
|
||||
"specific type of factory object, to the pool rather than destroying it."
|
||||
msgstr ""
|
||||
"**对象池设计模式** 是创建型设计模式,它会对新创建的对象应用一系列的初始化操作,让对象保持立即可使用的状态"
|
||||
" - 一个存放对象的 \"池子\" - 而不是对对象进行一次性的的使用(创建并使用,完成之后立即销毁)。对象池的使用者会对对象池发起请求,以期望"
|
||||
"获取一个对象,并使用获取到的对象进行一系列操作,当使用者对对象的使用完成之后,使用者会将由对象池的对象创建工厂创建的对象返回给对象池,而不是"
|
||||
"用完之后销毁获取到的对象。"
|
||||
|
||||
#: ../../Creational/Pool/README.rst:11
|
||||
msgid ""
|
||||
@@ -34,6 +38,9 @@ msgid ""
|
||||
"creation of the new objects (especially over network) may take variable "
|
||||
"time."
|
||||
msgstr ""
|
||||
"对象池在某些情况下会带来重要的性能提升,比如耗费资源的对象初始化操作,实例化类的代价很高,但每次实例化的数量较少的情况下。"
|
||||
"对象池中将被创建的对象会在真正被使用时被提前创建,避免在使用时让使用者浪费对象创建所需的大量时间(比如在对象某些操作需要访问网络资源的情况下)"
|
||||
"从池子中取得对象的时间是可预测的,但新建一个实例所需的时间是不确定。"
|
||||
|
||||
#: ../../Creational/Pool/README.rst:18
|
||||
msgid ""
|
||||
@@ -43,18 +50,21 @@ msgid ""
|
||||
"simple object pooling (that hold no external resources, but only occupy "
|
||||
"memory) may not be efficient and could decrease performance."
|
||||
msgstr ""
|
||||
"总之,对象池会为你节省宝贵的程序执行时间,比如像数据库连接,socket连接,大量耗费资源的代表数字资源的对象,像字体或者位图。"
|
||||
"不过,在特定情况下,简单的对象创建池(没有请求外部的资源,仅仅将自身保存在内存中)或许并不会提升效率和性能,这时候,就需要使用者"
|
||||
"酌情考虑了。"
|
||||
|
||||
#: ../../Creational/Pool/README.rst:25
|
||||
msgid "UML Diagram"
|
||||
msgstr ""
|
||||
msgstr "UML 图"
|
||||
|
||||
#: ../../Creational/Pool/README.rst:32
|
||||
msgid "Code"
|
||||
msgstr ""
|
||||
msgstr "代码"
|
||||
|
||||
#: ../../Creational/Pool/README.rst:34
|
||||
msgid "You can also find these code on `GitHub`_"
|
||||
msgstr ""
|
||||
msgstr "你可以在 `GitHub`_ 上找到这些代码"
|
||||
|
||||
#: ../../Creational/Pool/README.rst:36
|
||||
msgid "Pool.php"
|
||||
@@ -70,7 +80,7 @@ msgstr ""
|
||||
|
||||
#: ../../Creational/Pool/README.rst:55
|
||||
msgid "Test"
|
||||
msgstr ""
|
||||
msgstr "测试"
|
||||
|
||||
#: ../../Creational/Pool/README.rst:57
|
||||
msgid "Tests/PoolTest.php"
|
||||
|
@@ -13,21 +13,21 @@ msgstr ""
|
||||
|
||||
#: ../../Structural/DependencyInjection/README.rst:2
|
||||
msgid "`Dependency Injection`__"
|
||||
msgstr ""
|
||||
msgstr "`依赖注入`__"
|
||||
|
||||
#: ../../Structural/DependencyInjection/README.rst:5
|
||||
msgid "Purpose"
|
||||
msgstr ""
|
||||
msgstr "目的"
|
||||
|
||||
#: ../../Structural/DependencyInjection/README.rst:7
|
||||
msgid ""
|
||||
"To implement a loosely coupled architecture in order to get better testable,"
|
||||
" maintainable and extendable code."
|
||||
msgstr ""
|
||||
msgstr "实现了松耦合的软件架构,可得到更好的测试,管理和扩展的代码"
|
||||
|
||||
#: ../../Structural/DependencyInjection/README.rst:11
|
||||
msgid "Usage"
|
||||
msgstr ""
|
||||
msgstr "用例"
|
||||
|
||||
#: ../../Structural/DependencyInjection/README.rst:13
|
||||
msgid ""
|
||||
@@ -36,6 +36,8 @@ msgid ""
|
||||
" ``Connection``, which is not very good for testing and extending "
|
||||
"``Connection``."
|
||||
msgstr ""
|
||||
"通过配置需要注入的依赖,``Connection`` 能从 ``$config`` 中获取到所有它需要的依赖。如果没有"
|
||||
"依赖注入,``Connection`` 会直接创建它需要的依赖,这样不利于测试和扩展``Connection``。"
|
||||
|
||||
#: ../../Structural/DependencyInjection/README.rst:18
|
||||
msgid ""
|
||||
@@ -46,10 +48,14 @@ msgid ""
|
||||
" Read more about Inversion of control `here "
|
||||
"<http://en.wikipedia.org/wiki/Inversion_of_control>`__."
|
||||
msgstr ""
|
||||
"注意我们一直在遵循控制反转的设计原则,``Connection`` 通过要求 ``$config`` 实现 ``Parameters`` 的接口。这样就达到了组建间"
|
||||
"的解耦。我们不需要关心信息的来源,只需要关心 ``$config`` 中一定有方法来获取我们需要的信息。"
|
||||
"阅读更多的关于控制反转的资料请点"
|
||||
" `这里<http://en.wikipedia.org/wiki/Inversion_of_control>`__."
|
||||
|
||||
#: ../../Structural/DependencyInjection/README.rst:26
|
||||
msgid "Examples"
|
||||
msgstr ""
|
||||
msgstr "例子"
|
||||
|
||||
#: ../../Structural/DependencyInjection/README.rst:28
|
||||
msgid ""
|
||||
@@ -58,6 +64,8 @@ msgid ""
|
||||
"create a mock object of the configuration and inject that into the "
|
||||
"``Connection`` object"
|
||||
msgstr ""
|
||||
"Doctrine2 ORM 使用了依赖注入,它通过配置注入了 ``Connection`` 对象。为了达到方便测试的目的,"
|
||||
"可以很容易的通过配置创建一个mock的``Connection`` 对象。"
|
||||
|
||||
#: ../../Structural/DependencyInjection/README.rst:32
|
||||
msgid ""
|
||||
@@ -65,18 +73,20 @@ msgid ""
|
||||
"objects via a configuration array and inject them where needed (i.e. in "
|
||||
"Controllers)"
|
||||
msgstr ""
|
||||
"Symfony 和 Zend Framework 2 也有了专门的依赖注入容器,用来通过配置数据创建需要的对象"
|
||||
"(比如在控制器中使用依赖注入容器获取所需的对象)"
|
||||
|
||||
#: ../../Structural/DependencyInjection/README.rst:37
|
||||
msgid "UML Diagram"
|
||||
msgstr ""
|
||||
msgstr "UML 图"
|
||||
|
||||
#: ../../Structural/DependencyInjection/README.rst:44
|
||||
msgid "Code"
|
||||
msgstr ""
|
||||
msgstr "代码"
|
||||
|
||||
#: ../../Structural/DependencyInjection/README.rst:46
|
||||
msgid "You can also find these code on `GitHub`_"
|
||||
msgstr ""
|
||||
msgstr "你可以在 `GitHub`_ 上找到这些代码"
|
||||
|
||||
#: ../../Structural/DependencyInjection/README.rst:48
|
||||
msgid "AbstractConfig.php"
|
||||
@@ -96,7 +106,7 @@ msgstr ""
|
||||
|
||||
#: ../../Structural/DependencyInjection/README.rst:73
|
||||
msgid "Test"
|
||||
msgstr ""
|
||||
msgstr "测试"
|
||||
|
||||
#: ../../Structural/DependencyInjection/README.rst:75
|
||||
msgid "Tests/DependencyInjectionTest.php"
|
||||
|
@@ -13,7 +13,7 @@ msgstr ""
|
||||
|
||||
#: ../../Structural/README.rst:2
|
||||
msgid "`Structural`__"
|
||||
msgstr ""
|
||||
msgstr "`结构型设计模式`__"
|
||||
|
||||
#: ../../Structural/README.rst:4
|
||||
msgid ""
|
||||
@@ -21,3 +21,5 @@ msgid ""
|
||||
" ease the design by identifying a simple way to realize relationships "
|
||||
"between entities."
|
||||
msgstr ""
|
||||
"在软件工程中,结构型设计模式集是用来抽象真实程序中的对象实体之间的关系,并使"
|
||||
"这种关系可被描述,概括和具体化。"
|
Reference in New Issue
Block a user