Skip to content

Commit

Permalink
继续翻译了book的第一章
Browse files Browse the repository at this point in the history
尚未完全翻译完成,所以只更新了OT项目文件。
  • Loading branch information
Harry Han committed Mar 7, 2015
1 parent 9707649 commit 63e043e
Show file tree
Hide file tree
Showing 5 changed files with 7,159 additions and 19 deletions.
8 changes: 4 additions & 4 deletions SymfonyDocs-OmegaTProject/omegat/last_entry.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#Sat Mar 07 22:33:38 JST 2015
LAST_ENTRY_FILE=from_flat_php_to_symfony2.rst
LAST_ENTRY_SRC=more powerful tools such as `Varnish`_.
LAST_ENTRY_NUMBER=1077
#Sat Mar 07 23:23:28 JST 2015
LAST_ENTRY_FILE=http_fundamentals.rst
LAST_ENTRY_SRC=Requests, Responses and Web Development\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
LAST_ENTRY_NUMBER=1225
217 changes: 215 additions & 2 deletions SymfonyDocs-OmegaTProject/omegat/project_save.tmx
Original file line number Diff line number Diff line change
Expand Up @@ -1184,6 +1184,14 @@
<seg>:ref:`Access Request Information &lt;component-http-foundation-request&gt;`.</seg>
</tuv>
</tu>
<tu>
<tuv lang="EN-US">
<seg>&lt;!-- ...</seg>
</tuv>
<tuv lang="ZH-CN" changeid="Harry" changedate="20150307T135505Z" creationid="Harry" creationdate="20150307T135505Z">
<seg>&lt;!-- ...</seg>
</tuv>
</tu>
<tu>
<tuv lang="EN-US">
<seg>&lt;!-- app/Resources/views/Blog/list.html.php --&gt;</seg>
Expand Down Expand Up @@ -1704,6 +1712,15 @@ HTTP request and constructs and returns an HTTP response (as a Symfony
<seg>前端控制器</seg>
</tuv>
</tu>
<tu>
<tuv lang="EN-US">
<seg>A full list can be found
on Wikipedia's `List of HTTP status codes`_ article.</seg>
</tuv>
<tuv lang="ZH-CN" changeid="Harry" changedate="20150307T141036Z" creationid="Harry" creationdate="20150307T141036Z">
<seg>完整的列表可以在维基百科的 `List of HTTP status codes`_ (英文)页面查看。</seg>
</tuv>
</tu>
<tu>
<tuv lang="EN-US">
<seg>A good selection of Symfony community tools can be found on `KnpBundles.com`_.</seg>
Expand All @@ -1721,6 +1738,15 @@ HTTP request and constructs and returns an HTTP response (as a Symfony
<seg>查看正在运作的核心功能的方法就是看看 `Controller class`_ 。</seg>
</tuv>
</tu>
<tu>
<tuv lang="EN-US">
<seg>A list of common media types can be found on Wikipedia's
`List of common media types`_ article.</seg>
</tuv>
<tuv lang="ZH-CN" changeid="Harry" changedate="20150307T142046Z" creationid="Harry" creationdate="20150307T142046Z">
<seg>常见的媒体类型可以在维基百科的 `List of common media types`_ (英文)页面查看。</seg>
</tuv>
</tu>
<tu>
<tuv lang="EN-US">
<seg>A routing configuration map provides this information in a readable format:</seg>
Expand Down Expand Up @@ -2103,6 +2129,23 @@ let you take back control of your code.</seg>
<seg>恭喜你!</seg>
</tuv>
</tu>
<tu>
<tuv lang="EN-US">
<seg>Consider the response
from the xkcd web server:</seg>
</tuv>
<tuv lang="ZH-CN" changeid="Harry" changedate="20150307T135248Z" creationid="Harry" creationdate="20150307T135248Z">
<seg>如,xkcd 服务端返回的响应:</seg>
</tuv>
</tu>
<tu>
<tuv lang="EN-US">
<seg>Content-Type: text/html</seg>
</tuv>
<tuv lang="ZH-CN" changeid="Harry" changedate="20150307T135454Z" creationid="Harry" creationdate="20150307T135454Z">
<seg>Content-Type: text/html</seg>
</tuv>
</tu>
<tu>
<tuv lang="EN-US">
<seg>Controller
Expand Down Expand Up @@ -2184,6 +2227,24 @@ maps a URL to that controller (#2).</seg>
<seg>DELETE /blog/15 HTTP/1.1</seg>
</tuv>
</tu>
<tu>
<tuv lang="EN-US">
<seg>Date: Sat, 02 Apr 2011 21:05:05 GMT</seg>
</tuv>
<tuv lang="ZH-CN" changeid="Harry" changedate="20150307T135447Z" creationid="Harry" creationdate="20150307T135447Z">
<seg>Date: Sat, 02 Apr 2011 21:05:05 GMT</seg>
</tuv>
</tu>
<tu>
<tuv lang="EN-US">
<seg>Different
status codes exist that indicate success, an error, or that the client needs
to do something (e.g. redirect to another page).</seg>
</tuv>
<tuv lang="ZH-CN" changeid="Harry" changedate="20150307T140947Z" creationid="Harry" creationdate="20150307T140947Z">
<seg>不同的状态码代表成功、错误或者告诉客户端需要做一些其他的事(如重定向到另外一个页面)。</seg>
</tuv>
</tu>
<tu>
<tuv lang="EN-US">
<seg>Don't be confused</seg>
Expand Down Expand Up @@ -2334,6 +2395,15 @@ the page to crash.</seg>
<seg>例如,缺失或无效的 ``id`` 参数会导致页面崩溃。</seg>
</tuv>
</tu>
<tu>
<tuv lang="EN-US">
<seg>For example, certain
headers can be used to create a powerful caching system.</seg>
</tuv>
<tuv lang="ZH-CN" changeid="Harry" changedate="20150307T142320Z" creationid="Harry" creationdate="20150307T142320Z">
<seg>比如有几个响应头可以构造强大的缓存系统。</seg>
</tuv>
</tu>
<tu>
<tuv lang="EN-US">
<seg>For example, imagine you're processing a form submit::</seg>
Expand All @@ -2342,6 +2412,24 @@ the page to crash.</seg>
<seg>设想你正在处理一个提交上来的表格::</seg>
</tuv>
</tu>
<tu>
<tuv lang="EN-US">
<seg>For example, in the case of a GET request, the server
prepares the resource and returns it in an HTTP response.</seg>
</tuv>
<tuv lang="ZH-CN" changeid="Harry" changedate="20150307T135124Z" creationid="Harry" creationdate="20150307T135124Z">
<seg>例如,对于一个 GET 请求,服务端将准备资源,并在 HTTP 响应中返回给客户端。</seg>
</tuv>
</tu>
<tu>
<tuv lang="EN-US">
<seg>For example, one important HTTP response header is
``Content-Type``.</seg>
</tuv>
<tuv lang="ZH-CN" changeid="Harry" changedate="20150307T141359Z" creationid="Harry" creationdate="20150307T141359Z">
<seg>比如,一种重要的响应头是 ``Content-Type`` 。</seg>
</tuv>
</tu>
<tu>
<tuv lang="EN-US">
<seg>For example, the "routing" system is fickle, and wouldn't
Expand Down Expand Up @@ -2451,6 +2539,14 @@ requests internally based on the full URI.</seg>
<seg>GET / HTTP/1.1</seg>
</tuv>
</tu>
<tu>
<tuv lang="EN-US">
<seg>HTML for the xkcd comic --&gt;</seg>
</tuv>
<tuv lang="ZH-CN" changeid="Harry" changedate="20150307T140450Z" creationid="Harry" creationdate="20150307T140450Z">
<seg> xkcd 漫画的 HTML 代码--&gt;</seg>
</tuv>
</tu>
<tu>
<tuv lang="EN-US">
<seg>HTTP (Hypertext Transfer Protocol to the geeks) is a text language that allows
Expand Down Expand Up @@ -2478,6 +2574,14 @@ two machines to communicate with each other.</seg>
<seg>HTTP 定义了这种简单的文本语言的。</seg>
</tuv>
</tu>
<tu>
<tuv lang="EN-US">
<seg>HTTP/1.1 200 OK</seg>
</tuv>
<tuv lang="ZH-CN" changeid="Harry" changedate="20150307T135443Z" creationid="Harry" creationdate="20150307T135443Z">
<seg>HTTP/1.1 200 OK</seg>
</tuv>
</tu>
<tu>
<tuv lang="EN-US">
<seg>Here are a few
Expand Down Expand Up @@ -2968,6 +3072,15 @@ object and are easily accessible.</seg>
<seg>就像 ``响应`` 对象一样,请求头被存储在 ``HeaderBag(请求头包)`` 对象中,访问起来很容易。</seg>
</tuv>
</tu>
<tu>
<tuv lang="EN-US">
<seg>Like the request, an HTTP response contains additional pieces of information
known as HTTP headers.</seg>
</tuv>
<tuv lang="ZH-CN" changeid="Harry" changedate="20150307T141259Z" creationid="Harry" creationdate="20150307T141221Z">
<seg>像请求一样,一个 HTTP 响应也在头部(我们把它叫做响应头)包含了一些附加的信息。</seg>
</tuv>
</tu>
<tu>
<tuv lang="EN-US">
<seg>Making the argument optional, however, is perfectly ok.</seg>
Expand Down Expand Up @@ -3001,8 +3114,16 @@ object and are easily accessible.</seg>
<seg>Many other headers exist and can be found
on Wikipedia's `List of HTTP header fields`_ article.</seg>
</tuv>
<tuv lang="ZH-CN" changeid="Harry" changedate="20150303T150425Z" creationid="Harry" creationdate="20150303T150425Z">
<seg>还有许多其它的请求头可以承载的信息,你可以在维基百科的 `List of HTTP header fields`_ article.</seg>
<tuv lang="ZH-CN" changeid="Harry" changedate="20150307T134558Z" creationid="Harry" creationdate="20150303T150425Z">
<seg>还有许多其它的请求头可以承载的信息,你可以在维基百科的 `List of HTTP header fields`_ (英文)页面查看。</seg>
</tuv>
</tu>
<tu>
<tuv lang="EN-US">
<seg>Many other headers exist, some of which are very powerful.</seg>
</tuv>
<tuv lang="ZH-CN" changeid="Harry" changedate="20150307T142239Z" creationid="Harry" creationdate="20150307T142239Z">
<seg>还有很多其他功能强大的响应头。</seg>
</tuv>
</tu>
<tu>
Expand Down Expand Up @@ -3131,6 +3252,16 @@ Symfony will automatically return a 500 HTTP response code.</seg>
<seg>当然,你可以自由的从你的控制器中抛出任何 ``Exception(异常)`` 类——Symfony 将会自动的生成 HTTP 500(内部服务器错误)响应。</seg>
</tuv>
</tu>
<tu>
<tuv lang="EN-US">
<seg>Once a server has received the request, it knows exactly which resource the
client needs (via the URI) and what the client wants to do with that resource
(via the method).</seg>
</tuv>
<tuv lang="ZH-CN" changeid="Harry" changedate="20150307T135032Z" creationid="Harry" creationdate="20150307T135032Z">
<seg>当服务端收到请求,它要明确地知道客户端需要哪个资源(通过 URI )以及希望对该资源进行什么操作(通过 HTTP 方法)。</seg>
</tuv>
</tu>
<tu>
<tuv lang="EN-US">
<seg>Redirecting
Expand Down Expand Up @@ -3261,6 +3392,14 @@ preferred programming language, this chapter is a **must-read** for everyone.</s
<seg>通过看这个 Symfony 控制器来了解这一切是多么的简单吧!</seg>
</tuv>
</tu>
<tu>
<tuv lang="EN-US">
<seg>Server: lighttpd/1.4.19</seg>
</tuv>
<tuv lang="ZH-CN" changeid="Harry" changedate="20150307T135451Z" creationid="Harry" creationdate="20150307T135451Z">
<seg>Server: lighttpd/1.4.19</seg>
</tuv>
</tu>
<tu>
<tuv lang="EN-US">
<seg>Simple, right?</seg>
Expand Down Expand Up @@ -3311,6 +3450,16 @@ a cleaned URI (always returning ``/show`` and never ``/index.php/show``).</seg>
<seg>具体来说, ``getPathInfo()`` 方法返回一个被清理过的的 URI(比如它会返回 ``/show`` ,而不会是 ``/index.php/show``)。</seg>
</tuv>
</tu>
<tu>
<tuv lang="EN-US">
<seg>Step 2: The Server Returns a Response
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~</seg>
</tuv>
<tuv lang="ZH-CN" changeid="Harry" changedate="20150307T134733Z" creationid="Harry" creationdate="20150307T134733Z">
<seg>第二步:服务端返回响应
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~</seg>
</tuv>
</tu>
<tu>
<tuv lang="EN-US">
<seg>Step1: The Client Sends a Request
Expand Down Expand Up @@ -3576,6 +3725,15 @@ the resource:</seg>
<seg> HTTP 方法是请求的 *动词* ,用来定义你对资源的操作:</seg>
</tuv>
</tu>
<tu>
<tuv lang="EN-US">
<seg>The HTTP response contains the requested resource (the HTML content in this
case), as well as other information about the response.</seg>
</tuv>
<tuv lang="ZH-CN" changeid="Harry" changedate="20150307T140714Z" creationid="Harry" creationdate="20150307T140611Z">
<seg>HTTP 响应不但包含了客户端请求的资源(这里是 HTML 内容),也包含了与响应相关的信息。</seg>
</tuv>
</tu>
<tu>
<tuv lang="EN-US">
<seg>The Request Object
Expand Down Expand Up @@ -3766,6 +3924,17 @@ a simple application.</seg>
<seg>我们的程序走到现在花了 *很长* 的时间,相信你已经体会到即使这么简单的程序也包含了大量的代码。</seg>
</tuv>
</tu>
<tu>
<tuv lang="EN-US">
<seg>The body of the same resource could be returned in multiple
different formats like HTML, XML, or JSON and the ``Content-Type`` header uses
Internet Media Types like ``text/html`` to tell the client which format is
being returned.</seg>
</tuv>
<tuv lang="ZH-CN" changeid="Harry" changedate="20150307T141934Z" creationid="Harry" creationdate="20150307T141934Z">
<seg>即使是相同的资源内容,因为可以用不同的格式返回,如 HTML 、 XML 或 JSON 。 ``Content-Type`` 使用类似 ``text/html`` 这样的互联网媒体类型(Internet Media Type)来告知客户端响应是什么格式的。</seg>
</tuv>
</tu>
<tu>
<tuv lang="EN-US">
<seg>The client sends that request to a server,
Expand Down Expand Up @@ -3842,6 +4011,16 @@ application* needs to render the content of a page.</seg>
<seg>使用 ``model.php`` 来命名刚才的新文件是因为程序逻辑和数据访问</seg>
</tuv>
</tu>
<tu>
<tuv lang="EN-US">
<seg>The first line is
especially important and contains the HTTP response status code (200 in this
case).</seg>
</tuv>
<tuv lang="ZH-CN" changeid="Harry" changedate="20150307T140720Z" creationid="Harry" creationdate="20150307T140657Z">
<seg>第一行最重要,它是 HTTP 状态码(这里是 200 )。</seg>
</tuv>
</tu>
<tu>
<tuv lang="EN-US">
<seg>The first line of an HTTP request is the
Expand Down Expand Up @@ -4001,6 +4180,15 @@ which *all* requests are processed.</seg>
<seg>现在,使用 :term:`front controller`: 来解救我们的程序吧,它是一个单独的 PHP 文件,我们可以通过它来处理 *所有* 的请求。</seg>
</tuv>
</tu>
<tu>
<tuv lang="EN-US">
<seg>The status code communicates the overall outcome of the request back
to the client.</seg>
</tuv>
<tuv lang="ZH-CN" changeid="Harry" changedate="20150307T140816Z" creationid="Harry" creationdate="20150307T140734Z">
<seg>状态码报告了请求被处理的结果,</seg>
</tuv>
</tu>
<tu>
<tuv lang="EN-US">
<seg>The target
Expand Down Expand Up @@ -4384,6 +4572,15 @@ both a :class:`Symfony\\Component\\HttpFoundation\\Request` and a
class.</seg>
</tuv>
</tu>
<tu>
<tuv lang="EN-US">
<seg>Translated into HTTP, the response sent back to the browser will look something
like this:</seg>
</tuv>
<tuv lang="ZH-CN" changeid="Harry" changedate="20150307T135438Z" creationid="Harry" creationdate="20150307T135438Z">
<seg>翻译成 HTTP 的语言,返回给客户端的响应看起来是这样的:</seg>
</tuv>
</tu>
<tu>
<tuv lang="EN-US">
<seg>True to the Symfony philosophy, this chapter begins by explaining the fundamental
Expand Down Expand Up @@ -4442,6 +4639,22 @@ PHP functions (``ob_start()``, ``ob_get_clean()``) in the template.</seg>
<seg>想学习关于从请求中获取信息的更多?</seg>
</tuv>
</tu>
<tu>
<tuv lang="EN-US">
<seg>Was the request successful?</seg>
</tuv>
<tuv lang="ZH-CN" changeid="Harry" changedate="20150307T140830Z" creationid="Harry" creationdate="20150307T140830Z">
<seg>请求成功了?</seg>
</tuv>
</tu>
<tu>
<tuv lang="EN-US">
<seg>Was there an error?</seg>
</tuv>
<tuv lang="ZH-CN" changeid="Harry" changedate="20150307T140837Z" creationid="Harry" creationdate="20150307T140837Z">
<seg>有错误吗?</seg>
</tuv>
</tu>
<tu>
<tuv lang="EN-US">
<seg>What if each controller file suddenly needed to include
Expand Down

0 comments on commit 63e043e

Please sign in to comment.