summaryrefslogtreecommitdiff
path: root/docs/_locale/zh_CN/LC_MESSAGES/stpl.po
blob: 611eaafc6b6520b10b12466045fcbaca04850166 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
# SOME DESCRIPTIVE TITLE.
# Copyright (C) 2009-2017, Marcel Hellkamp
# This file is distributed under the same license as the Bottle package.
# 
# Translators:
msgid ""
msgstr ""
"Project-Id-Version: bottle\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-12-19 14:15+0100\n"
"PO-Revision-Date: 2015-12-13 21:05+0000\n"
"Last-Translator: defnull <marc@gsites.de>\n"
"Language-Team: Chinese (China) (http://www.transifex.com/bottle/bottle/language/zh_CN/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: zh_CN\n"
"Plural-Forms: nplurals=1; plural=0;\n"

#: ../../stpl.rst:3
msgid "SimpleTemplate Engine"
msgstr "SimpleTemplate 模板引擎"

#: ../../stpl.rst:7
msgid ""
"Bottle comes with a fast, powerful and easy to learn built-in template "
"engine called *SimpleTemplate* or *stpl* for short. It is the default engine"
" used by the :func:`view` and :func:`template` helpers but can be used as a "
"stand-alone general purpose template engine too. This document explains the "
"template syntax and shows examples for common use cases."
msgstr "Bottle自带了一个快速,强大,易用的模板引擎,名为 *SimpleTemplate* 或简称为 *stpl* 。它是 :func:`view` 和 :func:`template` 两个函数默认调用的模板引擎。接下来会介绍该引擎的模板语法和一些常见用例。"

#: ../../stpl.rst:10
msgid "Basic API Usage:"
msgstr "基础API :"

#: ../../stpl.rst:11
msgid ":class:`SimpleTemplate` implements the :class:`BaseTemplate` API::"
msgstr ":class:`SimpleTemplate` 类实现了 :class:`BaseTemplate` 接口"

#: ../../stpl.rst:18
msgid ""
"In this document we use the :func:`template` helper in examples for the sake"
" of simplicity::"
msgstr "简单起见,我们在例子中使用 :func:`template` 函数"

#: ../../stpl.rst:24
msgid ""
"You can also pass a dictionary into the template using keyword arguments::"
msgstr ""

#: ../../stpl.rst:31
msgid ""
"Just keep in mind that compiling and rendering templates are two different "
"actions, even if the :func:`template` helper hides this fact. Templates are "
"usually compiled only once and cached internally, but rendered many times "
"with different keyword arguments."
msgstr "注意,编译模板和渲染模板是两件事情,尽管 :func:`template` 函数隐藏了这一事实。通常,模板只会被编译一次,然后会被缓存起来,但是会根据不同的参数,被多次渲染。"

#: ../../stpl.rst:34
msgid ":class:`SimpleTemplate` Syntax"
msgstr ":class:`SimpleTemplate` 的语法"

#: ../../stpl.rst:36
msgid ""
"Python is a very powerful language but its whitespace-aware syntax makes it "
"difficult to use as a template language. SimpleTemplate removes some of "
"these restrictions and allows you to write clean, readable and maintainable "
"templates while preserving full access to the features, libraries and speed "
"of the Python language."
msgstr "虽然Python是一门强大的语言,但它对空白敏感的语法令其很难作为一个模板语言。SimpleTemplate移除了一些限制,允许你写出干净的,有可读性的,可维护的模板,且保留了Python的强大功能。"

#: ../../stpl.rst:40
msgid ""
"The :class:`SimpleTemplate` syntax compiles directly to python bytecode and "
"is executed on each :meth:`SimpleTemplate.render` call. Do not render "
"untrusted templates! They may contain and execute harmful python code."
msgstr " :class:`SimpleTemplate` 模板会被编译为Python字节码,且在每次通过 :meth:`SimpleTemplate.render` 渲染的时候执行。请不要渲染不可靠的模板!它们也许包含恶意代码。"

#: ../../stpl.rst:43
msgid "Inline Expressions"
msgstr "内嵌表达式"

#: ../../stpl.rst:45
msgid ""
"You already learned the use of the ``{{...}}`` syntax from the \"Hello "
"World!\" example above, but there is more: any python expression is allowed "
"within the curly brackets as long as it evaluates to a string or something "
"that has a string representation::"
msgstr ""

#: ../../stpl.rst:54
msgid ""
"The contained python expression is executed at render-time and has access to"
" all keyword arguments passed to the :meth:`SimpleTemplate.render` method. "
"HTML special characters are escaped automatically to prevent `XSS "
"<http://en.wikipedia.org/wiki/Cross-Site_Scripting>`_ attacks. You can start"
" the expression with an exclamation mark to disable escaping for that "
"expression::"
msgstr "{{}}中的Python语句会在渲染的时候被执行,可访问传递给 :meth:`SimpleTemplate.render` 方法的所有参数。默认情况下,自动转义HTML标签以防止 `XSS <http://en.wikipedia.org/wiki/Cross-Site_Scripting>`_ 攻击。可在语句前加上\"!\"来关闭自动转义。"

#: ../../stpl.rst:62
msgid "Embedded python code"
msgstr "嵌入Pyhton代码"

#: ../../stpl.rst:66
msgid ""
"The template engine allows you to embed lines or blocks of python code "
"within your template. Code lines start with ``%`` and code blocks are "
"surrounded by ``<%`` and ``%>`` tokens::"
msgstr ""

#: ../../stpl.rst:76
msgid ""
"Embedded python code follows regular python syntax, but with two additional "
"syntax rules:"
msgstr ""

#: ../../stpl.rst:78
msgid ""
"**Indentation is ignored.** You can put as much whitespace in front of "
"statements as you want. This allows you to align your code with the "
"surrounding markup and can greatly improve readability."
msgstr ""

#: ../../stpl.rst:79
msgid ""
"Blocks that are normally indented now have to be closed explicitly with an "
"``end`` keyword."
msgstr ""

#: ../../stpl.rst:89
msgid ""
"Both the ``%`` and the ``<%`` tokens are only recognized if they are the "
"first non-whitespace characters in a line. You don't have to escape them if "
"they appear mid-text in your template markup. Only if a line of text starts "
"with one of these tokens, you have to escape it with a backslash. In the "
"rare case where the backslash + token combination appears in your markup at "
"the beginning of a line, you can always help yourself with a string literal "
"in an inline expression::"
msgstr ""

#: ../../stpl.rst:96
msgid ""
"If you find yourself to escape a lot, consider using :ref:`custom tokens "
"<stpl-custom-tokens>`."
msgstr ""

#: ../../stpl.rst:99
msgid "Whitespace Control"
msgstr ""

#: ../../stpl.rst:101
msgid ""
"Code blocks and code lines always span the whole line. Whitespace in front "
"of after a code segment is stripped away. You won't see empty lines or "
"dangling whitespace in your template because of embedded code::"
msgstr ""

#: ../../stpl.rst:109
msgid "This snippet renders to clean and compact html::"
msgstr ""

#: ../../stpl.rst:115
msgid ""
"But embedding code still requires you to start a new line, which may not "
"what you want to see in your rendered template. To skip the newline in front"
" of a code segment, end the text line with a double-backslash::"
msgstr ""

#: ../../stpl.rst:123
msgid "This time the rendered template looks like this::"
msgstr ""

#: ../../stpl.rst:127
msgid ""
"This only works directly in front of code segments. In all other places you "
"can control the whitespace yourself and don't need any special syntax."
msgstr ""

#: ../../stpl.rst:130
msgid "Template Functions"
msgstr ""

#: ../../stpl.rst:132
msgid ""
"Each template is preloaded with a bunch of functions that help with the most"
" common use cases. These functions are always available. You don't have to "
"import or provide them yourself. For everything not covered here there are "
"probably good python libraries available. Remember that you can ``import`` "
"anything you want within your templates. They are python programs after all."
msgstr ""

#: ../../stpl.rst:136
msgid ""
"Prior to this release, :func:`include` and :func:`rebase` were syntax "
"keywords, not functions."
msgstr ""

#: ../../stpl.rst:141
msgid ""
"Render a sub-template with the specified variables and insert the resulting "
"text into the current template. The function returns a dictionary containing"
" the local variables passed to or defined within the sub-template::"
msgstr ""

#: ../../stpl.rst:149
msgid ""
"Mark the current template to be later included into a different template. "
"After the current template is rendered, its resulting text is stored in a "
"variable named ``base`` and passed to the base-template, which is then "
"rendered. This can be used to `wrap` a template with surrounding text, or "
"simulate the inheritance feature found in other template engines::"
msgstr ""

#: ../../stpl.rst:154
msgid "This can be combined with the following ``base.tpl``::"
msgstr ""

#: ../../stpl.rst:166
msgid ""
"Accessing undefined variables in a template raises :exc:`NameError` and "
"stops rendering immediately. This is standard python behavior and nothing "
"new, but vanilla python lacks an easy way to check the availability of a "
"variable. This quickly gets annoying if you want to support flexible inputs "
"or use the same template in different situations. These functions may help:"
msgstr ""

#: ../../stpl.rst:174
msgid ""
"Return True if the variable is defined in the current template namespace, "
"False otherwise."
msgstr "如果变量已定义则返回True,反之返回False。"

#: ../../stpl.rst:179
msgid "Return the variable, or a default value."
msgstr "返回该变量,或一个默认值"

#: ../../stpl.rst:183
msgid ""
"If the variable is not defined, create it with the given default value. "
"Return the variable."
msgstr "如果该变量未定义,则定义它,赋一个默认值,返回该变量"

#: ../../stpl.rst:186
msgid ""
"Here is an example that uses all three functions to implement optional "
"template variables in different ways::"
msgstr "下面是使用了这三个函数的例子,实现了模板中的可选参数。"

#: ../../stpl.rst:200
msgid ":class:`SimpleTemplate` API"
msgstr ":class:`SimpleTemplate` API"

#: ../../../bottle.pydocstring of bottle.SimpleTemplate.render:1
msgid "Render the template using keyword arguments as local variables."
msgstr ""