Debian Codegraph @

translations/manual/pt_BR/template_lang.po

raw
1 # SOME DESCRIPTIVE TITLE.
2 # Copyright (C) Kovid Goyal
3 # This file is distributed under the same license as the calibre package.
4 #
5 # Translators:
6 # Artur de Carvalho Alves <[email protected]>, 2015
7 # Claudio Rogerio Carvalho Filho <[email protected]>, 2020
8 # Henrique Lucas França <[email protected]>, 2016
9 msgid ""
10 msgstr ""
11 "Project-Id-Version: calibre\n"
12 "Report-Msgid-Bugs-To: \n"
13 "POT-Creation-Date: 2024-11-21 15:47+0000\n"
14 "PO-Revision-Date: 2014-06-17 08:34+0000\n"
15 "Last-Translator: Claudio Rogerio Carvalho Filho <[email protected]>, 2020\n"
16 "Language-Team: Portuguese (Brazil) (http://app.transifex.com/calibre/calibre/language/pt_BR/)\n"
17 "MIME-Version: 1.0\n"
18 "Content-Type: text/plain; charset=UTF-8\n"
19 "Content-Transfer-Encoding: 8bit\n"
20 "Language: pt_BR\n"
21 "Plural-Forms: nplurals=3; plural=(n == 0 || n == 1) ? 0 : n != 0 && n % 1000000 == 0 ? 1 : 2;\n"
22
23 #: ../../__w/calibre/calibre/manual/template_lang.rst:4
24 msgid "The calibre template language"
25 msgstr "A linguagem padrão do calibre"
26
27 #: ../../__w/calibre/calibre/manual/template_lang.rst:6
28 msgid ""
29 "The calibre template language is a calibre-specific language used throughout"
30 " calibre for tasks such as specifying file paths, formatting values, and "
31 "computing the value for user-specified columns. Examples:"
32 msgstr ""
33
34 #: ../../__w/calibre/calibre/manual/template_lang.rst:8
35 msgid ""
36 "Specify the folder structure and file names when saving files from the "
37 "calibre library to the disk or e-book reader."
38 msgstr ""
39
40 #: ../../__w/calibre/calibre/manual/template_lang.rst:9
41 msgid "Define rules for adding icons and colors to the calibre book list."
42 msgstr ""
43
44 #: ../../__w/calibre/calibre/manual/template_lang.rst:10
45 msgid "Define `virtual columns` that contain data from other columns."
46 msgstr ""
47
48 #: ../../__w/calibre/calibre/manual/template_lang.rst:11
49 msgid "Advanced library searching."
50 msgstr ""
51
52 #: ../../__w/calibre/calibre/manual/template_lang.rst:12
53 msgid "Advanced metadata search and replace."
54 msgstr ""
55
56 #: ../../__w/calibre/calibre/manual/template_lang.rst:14
57 msgid ""
58 "The language is built around the notion of a `template`, which specifies "
59 "which book metadata to use, computations on that metadata, and how it is to "
60 "be formatted."
61 msgstr ""
62
63 #: ../../__w/calibre/calibre/manual/template_lang.rst:17
64 msgid "Basic templates"
65 msgstr "Temas básicos"
66
67 #: ../../__w/calibre/calibre/manual/template_lang.rst:19
68 msgid ""
69 "A basic template consists one or more ``template expressions``. A ``template"
70 " expression`` consists of text and names in curly brackets (``{}``) that is "
71 "replaced by the corresponding metadata from the book being processed. For "
72 "example, the default template in calibre used for saving books to device has"
73 " 4 ``template expressions``::"
74 msgstr ""
75
76 #: ../../__w/calibre/calibre/manual/template_lang.rst:23
77 msgid "For the book \"The Foundation\" by \"Isaac Asimov\" the will become::"
78 msgstr ""
79
80 #: ../../__w/calibre/calibre/manual/template_lang.rst:27
81 msgid ""
82 "The slashes are not ``template expressions`` because they are in between in "
83 "``{}``. Such text is left where it appears. For example, if the template "
84 "is::"
85 msgstr ""
86
87 #: ../../__w/calibre/calibre/manual/template_lang.rst:31
88 msgid "then for \"The Foundation\" the template produces::"
89 msgstr ""
90
91 #: ../../__w/calibre/calibre/manual/template_lang.rst:35
92 msgid ""
93 "A ``template expression`` can access all the metadata available in calibre, "
94 "including custom columns (columns you create yourself), by using a column's "
95 "``lookup name``. To find the lookup name for a `column` (sometimes called "
96 "`fields`), hover your mouse over the column header in calibre's book list. "
97 "Lookup names for custom columns always begin with ``#``. For series type "
98 "columns there is an additional field named ``#lookup name_index`` that is "
99 "the series index for that book in the series. For example, if you have a "
100 "custom series column named ``#myseries``, there will also be a column named "
101 "``#myseries_index``. The standard series column's index is named "
102 "``series_index``."
103 msgstr ""
104
105 #: ../../__w/calibre/calibre/manual/template_lang.rst:37
106 msgid "In addition to the standard column based fields, you also can use:"
107 msgstr ""
108
109 #: ../../__w/calibre/calibre/manual/template_lang.rst:39
110 msgid ""
111 "``{formats}`` - A list of formats available in the calibre library for a "
112 "book"
113 msgstr ""
114
115 #: ../../__w/calibre/calibre/manual/template_lang.rst:40
116 msgid "``{identifiers:select(isbn)}`` - The ISBN of the book"
117 msgstr ""
118
119 #: ../../__w/calibre/calibre/manual/template_lang.rst:42
120 msgid ""
121 "If the metadata for the field for a given book is not defined then the field"
122 " in the template is replaced by the empty string (``''``). For example, "
123 "consider the following template::"
124 msgstr ""
125
126 #: ../../__w/calibre/calibre/manual/template_lang.rst:46
127 msgid ""
128 "If Asimov's book \"Second Foundation\" is in the series \"Foundation\" then "
129 "the template produces::"
130 msgstr ""
131
132 #: ../../__w/calibre/calibre/manual/template_lang.rst:50
133 msgid ""
134 "If a series has not been entered for the book then the template produces::"
135 msgstr ""
136
137 #: ../../__w/calibre/calibre/manual/template_lang.rst:54
138 msgid ""
139 "The template processor automatically removes multiple slashes and leading or"
140 " trailing spaces."
141 msgstr ""
142
143 #: ../../__w/calibre/calibre/manual/template_lang.rst:57
144 msgid "Advanced formatting"
145 msgstr "Formatação avançada"
146
147 #: ../../__w/calibre/calibre/manual/template_lang.rst:59
148 msgid ""
149 "In addition to metadata substitution, templates can conditionally include "
150 "additional text and control how substituted data is formatted."
151 msgstr ""
152
153 #: ../../__w/calibre/calibre/manual/template_lang.rst:61
154 msgid "**Conditionally including text**"
155 msgstr ""
156
157 #: ../../__w/calibre/calibre/manual/template_lang.rst:63
158 msgid ""
159 "Sometimes you want text to appear in the output only if a field is not "
160 "empty. A common case is ``series`` and ``series_index`` where you want "
161 "either nothing or the two values separated by a hyphen. calibre handles this"
162 " case using a special ``template expression`` syntax."
163 msgstr ""
164
165 #: ../../__w/calibre/calibre/manual/template_lang.rst:65
166 msgid ""
167 "For example and using the above Foundation example, assume you want the "
168 "template to produce `Foundation - 3 - Second Foundation`. This template "
169 "produces that output:"
170 msgstr ""
171
172 #: ../../__w/calibre/calibre/manual/template_lang.rst:67
173 msgid "``{series} - {series_index} - {title}``"
174 msgstr ""
175
176 #: ../../__w/calibre/calibre/manual/template_lang.rst:69
177 msgid ""
178 "However, if a book has no series the template will produce `- - the title`, "
179 "which is probably not what you want. Generally, people want the result be "
180 "the title without the extraneous hyphens. You can accomplish this using the "
181 "following template syntax:"
182 msgstr ""
183
184 #: ../../__w/calibre/calibre/manual/template_lang.rst:71
185 msgid "``{field:|prefix_text|suffix_text}``"
186 msgstr ""
187
188 #: ../../__w/calibre/calibre/manual/template_lang.rst:73
189 msgid ""
190 "This ``template expression`` says that if ``field`` has the value `XXXX` "
191 "then the result will be `prefix_textXXXXXsuffix_text`. If ``field`` is empty"
192 " (has no value) then the result will be the empty string (nothing) because "
193 "the prefix and suffix are ignored. The prefix and suffix can contain blanks."
194 msgstr ""
195
196 #: ../../__w/calibre/calibre/manual/template_lang.rst:75
197 msgid ""
198 "**Do not use subtemplates (`{ ... }`) or functions (see below) in the prefix"
199 " or the suffix.**"
200 msgstr ""
201
202 #: ../../__w/calibre/calibre/manual/template_lang.rst:77
203 msgid ""
204 "Using this syntax, we can solve the above no-series problem with the "
205 "template::"
206 msgstr ""
207
208 #: ../../__w/calibre/calibre/manual/template_lang.rst:81
209 msgid ""
210 "The hyphens will be included only if the book has a series index, which it "
211 "has only if it has a series. Continuing the Foundation example again, the "
212 "template will produce `Foundation - 1 - Second Foundation`."
213 msgstr ""
214
215 #: ../../__w/calibre/calibre/manual/template_lang.rst:83
216 #: ../../__w/calibre/calibre/manual/template_lang.rst:289
217 #: ../../__w/calibre/calibre/manual/template_lang.rst:438
218 msgid "Notes:"
219 msgstr ""
220
221 #: ../../__w/calibre/calibre/manual/template_lang.rst:85
222 msgid ""
223 "You must include the colon after the ``lookup name`` if you are using a "
224 "prefix or a suffix."
225 msgstr ""
226
227 #: ../../__w/calibre/calibre/manual/template_lang.rst:86
228 msgid ""
229 "You must either use either no or both ``|`` characters. Using one, as in "
230 "``{field:| - }``, is not allowed."
231 msgstr ""
232
233 #: ../../__w/calibre/calibre/manual/template_lang.rst:87
234 msgid ""
235 "It is OK to provide no text for either the prefix or the suffix, such as in "
236 "``{series:|| - }``. The template ``{title:||}`` is the same as ``{title}``."
237 msgstr ""
238
239 #: ../../__w/calibre/calibre/manual/template_lang.rst:89
240 msgid "**Formatting**"
241 msgstr ""
242
243 #: ../../__w/calibre/calibre/manual/template_lang.rst:91
244 msgid ""
245 "Suppose you want the ``series_index`` to be formatted as three digits with "
246 "leading zeros. This does the trick:"
247 msgstr ""
248
249 #: ../../__w/calibre/calibre/manual/template_lang.rst:93
250 msgid "``{series_index:0>3s}`` - Three digits with leading zeros"
251 msgstr ""
252
253 #: ../../__w/calibre/calibre/manual/template_lang.rst:95
254 msgid "For trailing zeros, use:"
255 msgstr ""
256
257 #: ../../__w/calibre/calibre/manual/template_lang.rst:97
258 msgid "``{series_index:0<3s}`` - Three digits with trailing zeros"
259 msgstr ""
260
261 #: ../../__w/calibre/calibre/manual/template_lang.rst:99
262 msgid ""
263 "If you use series indices with fractional values, e.g., 1.1, you might want "
264 "the decimal points to line up. For example, you might want the indices 1 and"
265 " 2.5 to appear as 01.00 and 02.50 so that they will sort correctly on a "
266 "device that does lexical sorting. To do this, use:"
267 msgstr ""
268
269 #: ../../__w/calibre/calibre/manual/template_lang.rst:101
270 msgid ""
271 "``{series_index:0>5.2f}`` - Five characters consisting of two digits with "
272 "leading zeros, a decimal point, then 2 digits after the decimal point."
273 msgstr ""
274
275 #: ../../__w/calibre/calibre/manual/template_lang.rst:103
276 msgid "If you want only the first two letters of the data, use:"
277 msgstr ""
278
279 #: ../../__w/calibre/calibre/manual/template_lang.rst:105
280 msgid ""
281 "``{author_sort:.2}`` - Only the first two letters of the author sort name"
282 msgstr ""
283
284 #: ../../__w/calibre/calibre/manual/template_lang.rst:107
285 msgid ""
286 "Much of the calibre template language formatting comes from Python. For more"
287 " details on the syntax of these advanced formatting operations see the "
288 "`Python documentation "
289 "<https://docs.python.org/3/library/string.html#formatstrings>`_."
290 msgstr ""
291
292 #: ../../__w/calibre/calibre/manual/template_lang.rst:111
293 msgid "Using templates to define custom columns"
294 msgstr ""
295
296 #: ../../__w/calibre/calibre/manual/template_lang.rst:113
297 msgid ""
298 "Templates can be used to display information that isn't in calibre metadata,"
299 " or to display metadata differently from calibre's normal format. For "
300 "example, you might want to show the ``ISBN``, a field that calibre does not "
301 "display. You can accomplish this creating a custom column with the type "
302 "`Column built from other columns` (hereafter called `composite columns`) and"
303 " providing a template to generate the displayed text. The column will "
304 "display the result of evaluating the template. For example, to display the "
305 "ISBN, create the column and enter ``{identifiers:select(isbn)}`` in the "
306 "template box. To display a column containing the values of two series custom"
307 " columns, separated by a comma, use ``{#series1:||,}{#series2}``."
308 msgstr ""
309
310 #: ../../__w/calibre/calibre/manual/template_lang.rst:115
311 msgid "Composite columns can use any template option, including formatting."
312 msgstr "Colunas compostas podem usar qualquer opção de modelo, incluindo formatação."
313
314 #: ../../__w/calibre/calibre/manual/template_lang.rst:117
315 msgid ""
316 "Note: You cannot edit the data displayed in a composite column. Instead you "
317 "edit the source columns. If you edit a composite column, for example by "
318 "double-clicking it, calibre will open the template for editing, not the "
319 "underlying data."
320 msgstr ""
321
322 #: ../../__w/calibre/calibre/manual/template_lang.rst:121
323 msgid "Templates and plugboards"
324 msgstr "Modelos e conectores"
325
326 #: ../../__w/calibre/calibre/manual/template_lang.rst:123
327 msgid ""
328 "Plugboards are used for changing the metadata written into books during "
329 "send-to-device and save-to-disk operations. A plugboard permits you to "
330 "specify a template to provide the data to write into the book's metadata. "
331 "You can use plugboards to modify the following fields: authors, author_sort,"
332 " language, publisher, tags, title, title_sort. This feature helps people who"
333 " want to use different metadata in books on devices to solve sorting or "
334 "display issues."
335 msgstr ""
336
337 #: ../../__w/calibre/calibre/manual/template_lang.rst:125
338 msgid ""
339 "When you create a plugboard, you specify the format and device for which the"
340 " plugboard is to be used. A special device is provided, ``save_to_disk``, "
341 "that is used when saving formats (as opposed to sending them to a device). "
342 "Once you have chosen the format and device, you choose the metadata fields "
343 "to change, providing templates to supply the new values. These templates are"
344 " `connected` to their destination fields, hence the name `plugboards`. You "
345 "can of course use composite columns in these templates."
346 msgstr ""
347
348 #: ../../__w/calibre/calibre/manual/template_lang.rst:127
349 msgid ""
350 "Plugboards are quite flexible and can be written in Single Function Mode, "
351 "Template Program Mode, General Program Mode, or Python Template mode."
352 msgstr ""
353
354 #: ../../__w/calibre/calibre/manual/template_lang.rst:129
355 msgid ""
356 "When a plugboard might apply (Content server, save to disk, or send to "
357 "device), calibre searches the defined plugboards to choose the correct one "
358 "for the given format and device. For example, to find the appropriate "
359 "plugboard for an EPUB book being sent to an ANDROID device, calibre searches"
360 " the plugboards using the following search order:"
361 msgstr ""
362
363 #: ../../__w/calibre/calibre/manual/template_lang.rst:133
364 msgid ""
365 "a plugboard with an exact match on format and device, e.g., ``EPUB`` and "
366 "``ANDROID``"
367 msgstr ""
368
369 #: ../../__w/calibre/calibre/manual/template_lang.rst:134
370 msgid ""
371 "a plugboard with an exact match on format and the special ``any device`` "
372 "choice, e.g., ``EPUB`` and ``any device``"
373 msgstr ""
374
375 #: ../../__w/calibre/calibre/manual/template_lang.rst:135
376 msgid ""
377 "a plugboard with the special ``any format`` choice and an exact match on "
378 "device, e.g., ``any format`` and ``ANDROID``"
379 msgstr ""
380
381 #: ../../__w/calibre/calibre/manual/template_lang.rst:136
382 msgid "a plugboard with ``any format`` and ``any device``"
383 msgstr "um conector para ``qualquer formato`` e ``qualquer dispositivo``"
384
385 #: ../../__w/calibre/calibre/manual/template_lang.rst:138
386 msgid ""
387 "The tags and authors fields have special treatment, because both of these "
388 "fields can hold more than one item. A book can have many tags and many "
389 "authors. When you specify that one of these two fields is to be changed, the"
390 " template's result is examined to see if more than one item is there. For "
391 "tags, the result is cut apart wherever calibre finds a comma. For example, "
392 "if the template produces the value ``Thriller, Horror``, then the result "
393 "will be two tags, ``Thriller`` and ``Horror``. There is no way to put a "
394 "comma in the middle of a tag."
395 msgstr ""
396
397 #: ../../__w/calibre/calibre/manual/template_lang.rst:141
398 msgid ""
399 "The same thing happens for authors, but using a different character for the "
400 "cut, a `&` (ampersand) instead of a comma. For example, if the template "
401 "produces the value ``Blogs, Joe&Posts, Susan``, then the book will end up "
402 "with two authors, ``Blogs, Joe`` and ``Posts, Susan``. If the template "
403 "produces the value ``Blogs, Joe;Posts, Susan``, then the book will have one "
404 "author with a rather strange name."
405 msgstr ""
406
407 #: ../../__w/calibre/calibre/manual/template_lang.rst:143
408 msgid ""
409 "Plugboards affect the metadata written into the book when it is saved to "
410 "disk or written to the device. Plugboards do not affect the metadata used by"
411 " ``save to disk`` and ``send to device`` to create the file names. Instead, "
412 "file names are constructed using the templates entered on the appropriate "
413 "preferences window."
414 msgstr ""
415
416 #: ../../__w/calibre/calibre/manual/template_lang.rst:148
417 msgid "Using functions in templates - Single Function Mode"
418 msgstr ""
419
420 #: ../../__w/calibre/calibre/manual/template_lang.rst:150
421 msgid ""
422 "Suppose you want to display the value of a field in upper case when that "
423 "field is normally in title case. You can do this using `template functions`."
424 " For example, to display the title in upper case use the ``uppercase`` "
425 "function, as in ``{title:uppercase()}``. To display it in title case, use "
426 "``{title:titlecase()}``."
427 msgstr ""
428
429 #: ../../__w/calibre/calibre/manual/template_lang.rst:152
430 msgid ""
431 "Functions go into the format part of the template, after the ``:`` and "
432 "before the first ``|`` or the closing ``}`` if no prefix/suffix is used. If "
433 "you have both a format and a function reference, the function comes after a "
434 "second ``:``. Functions return the value of the column specified in the "
435 "template, suitably modified."
436 msgstr ""
437
438 #: ../../__w/calibre/calibre/manual/template_lang.rst:154
439 msgid "The syntax for using functions is one of::"
440 msgstr ""
441
442 #: ../../__w/calibre/calibre/manual/template_lang.rst:161
443 msgid ""
444 "Function names must always be followed by opening and closing parentheses. "
445 "Some functions require extra values (arguments), and these go inside the "
446 "parentheses. Arguments are separated by commas. Literal commas (commas as "
447 "text, not argument separators) must be preceded by a backslash (``\\``) . "
448 "The last (or only) argument cannot contain a textual closing parenthesis."
449 msgstr ""
450
451 #: ../../__w/calibre/calibre/manual/template_lang.rst:163
452 msgid ""
453 "Functions are evaluated before format specifications and the prefix/suffix. "
454 "See further down for an example of using both a format and a function."
455 msgstr ""
456
457 #: ../../__w/calibre/calibre/manual/template_lang.rst:165
458 msgid ""
459 "**Important**: If you have programming experience, please note that the "
460 "syntax in `Single Function Mode` is not what you expect. Strings are not "
461 "quoted and spaces are significant. All arguments are considered to be "
462 "constants; there are no expressions."
463 msgstr ""
464
465 #: ../../__w/calibre/calibre/manual/template_lang.rst:167
466 msgid ""
467 "**Do not use subtemplates (`{ ... }`) as function arguments.** Instead, use "
468 ":ref:`Template Program Mode <template_mode>` and :ref:`General Program Mode "
469 "<general_mode>`."
470 msgstr ""
471
472 #: ../../__w/calibre/calibre/manual/template_lang.rst:169
473 msgid "Notes on calling functions in Single Function Mode:"
474 msgstr ""
475
476 #: ../../__w/calibre/calibre/manual/template_lang.rst:171
477 msgid ""
478 "When functions are used in Single Function Mode, the first parameter, "
479 "``value``, is automatically replaced by the content of the field specified "
480 "in the template. For example, when the template ``{title:capitalize()}`` is "
481 "processed, the content of the ``title`` field is passed as the parameter "
482 "``value`` to the capitalize function."
483 msgstr ""
484
485 #: ../../__w/calibre/calibre/manual/template_lang.rst:172
486 msgid ""
487 "In the function documentation, the notation ``[something]*`` means that "
488 "``something`` can be repeated zero or more times. The notation "
489 "``[something]+`` means that the ``something`` is repeated one or more times "
490 "(must exist at least one time)."
491 msgstr ""
492
493 #: ../../__w/calibre/calibre/manual/template_lang.rst:173
494 msgid ""
495 "Some functions use regular expressions. In the template language regular "
496 "expression matching is case-insensitive."
497 msgstr ""
498
499 #: ../../__w/calibre/calibre/manual/template_lang.rst:175
500 msgid ""
501 "Functions are documented in :ref:`template_functions_reference`. The "
502 "documentation tells you what arguments the functions require and what the "
503 "functions do. For example, here is the documentation of the "
504 ":ref:`ff_ifempty` function."
505 msgstr ""
506
507 #: ../../__w/calibre/calibre/manual/template_lang.rst:179
508 msgid ""
509 "You see that the function requires two arguments, ``value`` and "
510 "``text_if_empty``. However, because we are using Single Function Mode, we "
511 "omit the ``value`` argument, passing only ``text_if_empty``. For example, "
512 "this template::"
513 msgstr ""
514
515 #: ../../__w/calibre/calibre/manual/template_lang.rst:183
516 msgid ""
517 "shows the tags for a book, if any. If it has no tags then it show `No tags "
518 "on this book`."
519 msgstr ""
520
521 #: ../../__w/calibre/calibre/manual/template_lang.rst:185
522 msgid ""
523 "The following functions are usable in Single Function Mode because their "
524 "first parameter is ``value``."
525 msgstr ""
526
527 #: ../../__w/calibre/calibre/manual/template_lang.rst:225
528 msgid "**Using functions and formatting in the same template**"
529 msgstr ""
530
531 #: ../../__w/calibre/calibre/manual/template_lang.rst:227
532 msgid ""
533 "Suppose you have an integer custom column ``#myint`` that you want displayed"
534 " with leading zeros, as in ``003``. One way to do this is to use a format of"
535 " ``0>3s``. However, by default if a number (integer or float) equals zero "
536 "then the value is displayed as the empty string so zero values will produce "
537 "the empty string, not ``000``. If you want to see ``000`` values then you "
538 "use both the format string and the ``ifempty`` function to change the empty "
539 "value back to a zero. The template would be::"
540 msgstr ""
541
542 #: ../../__w/calibre/calibre/manual/template_lang.rst:231
543 msgid ""
544 "Note that you can use the prefix and suffix as well. If you want the number "
545 "to appear as ``[003]`` or ``[000]``, then use the template::"
546 msgstr ""
547
548 #: ../../__w/calibre/calibre/manual/template_lang.rst:238
549 msgid "General Program Mode"
550 msgstr ""
551
552 #: ../../__w/calibre/calibre/manual/template_lang.rst:240
553 msgid ""
554 "`General Program Mode` (`GPM`) replaces `template expressions` with a "
555 "program written in the `template language`. The syntax of the language is "
556 "defined by the following grammar::"
557 msgstr ""
558
559 #: ../../__w/calibre/calibre/manual/template_lang.rst:291
560 msgid ""
561 "a ``top_expression`` always has a value. The value of an ``expression_list``"
562 " is the value of the last ``top_expression`` in the list. For example, the "
563 "value of the expression list ``1;2;'foobar';3`` is ``3``."
564 msgstr ""
565
566 #: ../../__w/calibre/calibre/manual/template_lang.rst:292
567 msgid "In a logical context, any non-empty value is ``True``"
568 msgstr ""
569
570 #: ../../__w/calibre/calibre/manual/template_lang.rst:293
571 msgid "In a logical context, the empty value is ``False``"
572 msgstr ""
573
574 #: ../../__w/calibre/calibre/manual/template_lang.rst:294
575 msgid ""
576 "Strings and numbers can be used interchangeably. For example, ``10`` and "
577 "``'10'`` are the same thing."
578 msgstr ""
579
580 #: ../../__w/calibre/calibre/manual/template_lang.rst:295
581 msgid ""
582 "Comments are lines starting with a '#' character. Comments beginning later "
583 "in a line are not supported."
584 msgstr ""
585
586 #: ../../__w/calibre/calibre/manual/template_lang.rst:297
587 msgid "**Operator precedence**"
588 msgstr "**Precedência de operador**"
589
590 #: ../../__w/calibre/calibre/manual/template_lang.rst:299
591 msgid ""
592 "The operator precedence (order of evaluation) from highest (evaluated first)"
593 " to lowest (evaluated last) is:"
594 msgstr ""
595
596 #: ../../__w/calibre/calibre/manual/template_lang.rst:301
597 msgid ""
598 "Function calls, constants, parenthesized expressions, statement expressions,"
599 " assignment expressions, field references."
600 msgstr ""
601
602 #: ../../__w/calibre/calibre/manual/template_lang.rst:302
603 msgid ""
604 "Unary plus (``+``) and minus (``-``). These operators evaluate right to "
605 "left."
606 msgstr ""
607
608 #: ../../__w/calibre/calibre/manual/template_lang.rst:304
609 msgid ""
610 "These and all the other arithmetic operators return integers if the "
611 "expression results in a fractional part equal to zero. For example, if an "
612 "expression returns ``3.0`` it is changed to ``3``."
613 msgstr ""
614
615 #: ../../__w/calibre/calibre/manual/template_lang.rst:305
616 msgid ""
617 "Multiply (``*``) and divide (``/``). These operators are associative and "
618 "evaluate left to right. Use parentheses if you want to change the order of "
619 "evaluation."
620 msgstr ""
621
622 #: ../../__w/calibre/calibre/manual/template_lang.rst:306
623 msgid ""
624 "Add (``+``) and subtract (``-``). These operators are associative and "
625 "evaluate left to right."
626 msgstr ""
627
628 #: ../../__w/calibre/calibre/manual/template_lang.rst:307
629 msgid ""
630 "Numeric and string comparisons. These operators return ``'1'`` if the "
631 "comparison succeeds, otherwise the empty string (``''``). Comparisons are "
632 "not associative: ``a < b < c`` is a syntax error."
633 msgstr ""
634
635 #: ../../__w/calibre/calibre/manual/template_lang.rst:308
636 msgid ""
637 "String concatenation (``&``). The ``&`` operator returns a string formed by "
638 "concatenating the left-hand and right-hand expressions. Example: ``'aaa' & "
639 "'bbb'`` returns ``'aaabbb'``. The operator is associative and evaluates left"
640 " to right."
641 msgstr ""
642
643 #: ../../__w/calibre/calibre/manual/template_lang.rst:309
644 msgid ""
645 "Unary logical not (``!``). This operator returns ``'1'`` if the expression "
646 "is False (evaluates to the empty string), otherwise ``''``."
647 msgstr ""
648
649 #: ../../__w/calibre/calibre/manual/template_lang.rst:310
650 msgid ""
651 "Logical and (``&&``). This operator returns '1' if both the left-hand and "
652 "right-hand expressions are True, or the empty string ``''`` if either is "
653 "False. It is associative, evaluates left to right, and does `short-"
654 "circuiting <https://chortle.ccsu.edu/java5/Notes/chap40/ch40_2.html>`_."
655 msgstr ""
656
657 #: ../../__w/calibre/calibre/manual/template_lang.rst:311
658 msgid ""
659 "Logical or (``||``). This operator returns ``'1'`` if either the left-hand "
660 "or right-hand expression is True, or ``''`` if both are False. It is "
661 "associative, evaluates left to right, and does `short-circuiting "
662 "<https://chortle.ccsu.edu/java5/Notes/chap40/ch40_2.html>`_. It is an "
663 "`inclusive or`, returning ``'1'`` if both the left- and right-hand "
664 "expressions are True."
665 msgstr ""
666
667 #: ../../__w/calibre/calibre/manual/template_lang.rst:313
668 msgid "**Field references**"
669 msgstr "**Referência de campos**"
670
671 #: ../../__w/calibre/calibre/manual/template_lang.rst:315
672 msgid ""
673 "A ``field_reference`` evaluates to the value of the metadata field named by "
674 "lookup name that follows the ``$`` or ``$$``. Using ``$`` is equivalent to "
675 "using the :ref:`ff_field` function. Using ``$$`` is equivalent to using the "
676 ":ref:`ff_raw_field` function. Examples::"
677 msgstr ""
678
679 #: ../../__w/calibre/calibre/manual/template_lang.rst:322
680 msgid "**If expressions**"
681 msgstr "**Expressões If**"
682
683 #: ../../__w/calibre/calibre/manual/template_lang.rst:324
684 msgid ""
685 "``If`` expressions first evaluate the ``condition``. If the ``condition`` is"
686 " True (a non-empty value) then the ``expression_list`` in the ``then`` "
687 "clause is evaluated. If it is False then if present the ``expression_list`` "
688 "in the ``elif`` or ``else`` clause is evaluated. The ``elif`` and ``else`` "
689 "parts are optional. The words ``if``, ``then``, ``elif``, ``else``, and "
690 "``fi`` are reserved; you cannot use them as identifier names. You can put "
691 "newlines and white space wherever they make sense. The ``condition`` is a "
692 "``top_expression`` not an ``expression_list``; semicolons are not allowed. "
693 "The ``expression_lists`` are semicolon-separated sequences of "
694 "``top_expressions``. An ``if`` expression returns the result of the last "
695 "``top_expression`` in the evaluated ``expression_list``, or the empty string"
696 " if no expression list was evaluated."
697 msgstr ""
698
699 #: ../../__w/calibre/calibre/manual/template_lang.rst:326
700 msgid "Examples::"
701 msgstr ""
702
703 #: ../../__w/calibre/calibre/manual/template_lang.rst:339
704 msgid "Nested ``if`` example::"
705 msgstr "Exemplo ``if`` aninhado::"
706
707 #: ../../__w/calibre/calibre/manual/template_lang.rst:352
708 msgid ""
709 "As said above, an ``if`` produces a value. This means that all the following"
710 " are equivalent::"
711 msgstr ""
712
713 #: ../../__w/calibre/calibre/manual/template_lang.rst:358
714 msgid ""
715 "For example, this program returns the value of the ``series`` column if the "
716 "book has a series, otherwise the value of the ``title`` column::"
717 msgstr ""
718
719 #: ../../__w/calibre/calibre/manual/template_lang.rst:362
720 msgid "**For expressions**"
721 msgstr "**Expressões For**"
722
723 #: ../../__w/calibre/calibre/manual/template_lang.rst:364
724 msgid ""
725 "The ``for`` expression iterates over a list of values, processing them one "
726 "at a time. The ``list_expression`` must evaluate either to a metadata field "
727 "``lookup name`` e.g., ``tags`` or ``#genre``, or to a list of values. The "
728 ":ref:`ff_range` generates a list of numbers. If the result is a valid "
729 "``lookup name`` then the field's value is fetched and the separator "
730 "specified for that field type is used. If the result isn't a valid lookup "
731 "name then it is assumed to be a list of values. The list is assumed to be "
732 "separated by commas unless the optional keyword ``separator`` is supplied, "
733 "in which case the list values must be separated by the result of evaluating "
734 "the ``separator_expr``. A separator cannot be used if the list is generated "
735 "by ``range()``. Each value in the list is assigned to the specified variable"
736 " then the ``expression_list`` is evaluated. You can use ``break`` to jump "
737 "out of the loop, and ``continue`` to jump to the beginning of the loop for "
738 "the next iteration."
739 msgstr ""
740
741 #: ../../__w/calibre/calibre/manual/template_lang.rst:366
742 msgid ""
743 "Example: This template removes the first hierarchical name for each value in"
744 " Genre (``#genre``), constructing a list with the new names::"
745 msgstr ""
746
747 #: ../../__w/calibre/calibre/manual/template_lang.rst:376
748 msgid ""
749 "If the original Genre is `History.Military, Science Fiction.Alternate "
750 "History, ReadMe` then the template returns `Military, Alternate History, "
751 "ReadMe`. You could use this template in calibre's :guilabel:`Edit metadata "
752 "in bulk -> Search & replace` with :guilabel:`Search for` set to ``template``"
753 " to strip off the first level of the hierarchy and assign the resulting "
754 "value to Genre."
755 msgstr ""
756
757 #: ../../__w/calibre/calibre/manual/template_lang.rst:379
758 msgid ""
759 "Note: the last line in the template, ``new_tags``, isn't strictly necessary "
760 "in this case because ``for`` returns the value of the last top_expression in"
761 " the expression list. The value of an assignment is the value of its "
762 "expression, so the value of the ``for`` statement is what was assigned to "
763 "``new_tags``."
764 msgstr ""
765
766 #: ../../__w/calibre/calibre/manual/template_lang.rst:381
767 msgid "**Function definition**"
768 msgstr ""
769
770 #: ../../__w/calibre/calibre/manual/template_lang.rst:383
771 msgid ""
772 "If you have repeated code in a template then you can put that code into a "
773 "local function. The ``def`` keyword starts the definition. It is followed by"
774 " the function name, the argument list, then the code in the function. The "
775 "function definition ends with the ``fed`` keyword."
776 msgstr ""
777
778 #: ../../__w/calibre/calibre/manual/template_lang.rst:385
779 msgid ""
780 "Arguments are positional. When a function is called the supplied arguments "
781 "are matched left to right against the defined parameters, with the value of "
782 "the argument assigned to the parameter. It is an error to provide more "
783 "arguments than defined parameters. Parameters can have default values, such "
784 "as ``a = 25``. If an argument is not supplied for that parameter then the "
785 "default value is used, otherwise the parameter is set to the empty string."
786 msgstr ""
787
788 #: ../../__w/calibre/calibre/manual/template_lang.rst:387
789 msgid "The ``return`` statement can be used in a local function."
790 msgstr ""
791
792 #: ../../__w/calibre/calibre/manual/template_lang.rst:389
793 msgid "A function must be defined before it can be used."
794 msgstr ""
795
796 #: ../../__w/calibre/calibre/manual/template_lang.rst:391
797 msgid ""
798 "Example: This template computes an approximate duration in years, months, "
799 "and days from a number of days. The function ``to_plural()`` formats the "
800 "computed values. Note that the example also uses the ``&`` operator::"
801 msgstr ""
802
803 #: ../../__w/calibre/calibre/manual/template_lang.rst:406
804 msgid "**Relational operators**"
805 msgstr "**Operadores relacionais**"
806
807 #: ../../__w/calibre/calibre/manual/template_lang.rst:408
808 msgid ""
809 "Relational operators return ``'1'`` if the comparison is true, otherwise the"
810 " empty string (``''``)."
811 msgstr ""
812
813 #: ../../__w/calibre/calibre/manual/template_lang.rst:410
814 msgid ""
815 "There are two forms of relational operators: string comparisons and numeric "
816 "comparisons."
817 msgstr ""
818
819 #: ../../__w/calibre/calibre/manual/template_lang.rst:412
820 msgid ""
821 "String comparisons do case-insensitive string comparison using lexical "
822 "order. The supported string comparison operators are ``==``, ``!=``, ``<``, "
823 "``<=``, ``>``, ``>=``, ``in``, ``inlist``, and ``inlist_field``. For the "
824 "``in`` operator, the result of the left hand expression is interpreted as a "
825 "regular expression pattern. The ``in`` operator is True if the value of "
826 "left-hand regular expression matches the value of the right hand expression."
827 msgstr ""
828
829 #: ../../__w/calibre/calibre/manual/template_lang.rst:415
830 msgid ""
831 "The ``inlist`` operator is true if the left hand regular expression matches "
832 "any one of the items in the right hand list where the items in the list are "
833 "separated by commas. The ``inlist_field`` operator is true if the left hand "
834 "regular expression matches any of the items in the field (column) named by "
835 "the right hand expression, using the separator defined for the field. NB: "
836 "the ``inlist_field`` operator requires the right hand expression to evaluate"
837 " to a field name, while the ``inlist`` operator requires the right hand "
838 "expression to evaluate to a string containing a comma-separated list. "
839 "Because of this difference, ``inlist_field`` is substantially faster than "
840 "``inlist`` because no string conversions or list constructions are done. The"
841 " regular expressions are case-insensitive."
842 msgstr ""
843
844 #: ../../__w/calibre/calibre/manual/template_lang.rst:417
845 msgid ""
846 "The numeric comparison operators are ``==#``, ``!=#``, ``<#``, ``<=#``, "
847 "``>#``, ``>=#``. The left and right expressions must evaluate to numeric "
848 "values with two exceptions: both the string value \"None\" (undefined field)"
849 " and the empty string evaluate to the value zero."
850 msgstr ""
851
852 #: ../../__w/calibre/calibre/manual/template_lang.rst:419
853 msgid "Examples:"
854 msgstr "Exemplos:"
855
856 #: ../../__w/calibre/calibre/manual/template_lang.rst:421
857 msgid ""
858 "``program: field('series') == 'foo'`` returns ``'1'`` if the book's series "
859 "is `foo`, otherwise ``''``."
860 msgstr ""
861
862 #: ../../__w/calibre/calibre/manual/template_lang.rst:422
863 msgid ""
864 "``program: 'f.o' in field('series')`` returns ``'1'`` if the book's series "
865 "matches the regular expression ``f.o`` (e.g., `foo`, `Off Onyx`, etc.), "
866 "otherwise ``''``."
867 msgstr ""
868
869 #: ../../__w/calibre/calibre/manual/template_lang.rst:423
870 msgid ""
871 "``program: 'science' inlist $#genre`` returns ``'1'`` if any of the values "
872 "retrieved from the book's genres match the regular expression ``science``, "
873 "e.g., `Science`, `History of Science`, `Science Fiction` etc., otherwise "
874 "``''``."
875 msgstr ""
876
877 #: ../../__w/calibre/calibre/manual/template_lang.rst:424
878 msgid ""
879 "``program: '^science$' inlist $#genre`` returns ``'1'`` if any of the book's"
880 " genres exactly match the regular expression ``^science$``, e.g., `Science`,"
881 " otherwise ``''``. The genres `History of Science` and `Science Fiction` "
882 "don't match."
883 msgstr ""
884
885 #: ../../__w/calibre/calibre/manual/template_lang.rst:425
886 msgid ""
887 "``program: 'asimov' inlist $authors`` returns ``'1'`` if any author matches "
888 "the regular expression ``asimov``, e.g., `Asimov, Isaac` or `Isaac Asimov`, "
889 "otherwise ``''``."
890 msgstr ""
891
892 #: ../../__w/calibre/calibre/manual/template_lang.rst:426
893 msgid ""
894 "``program: 'asimov' inlist_field 'authors'`` returns ``'1'`` if any author "
895 "matches the regular expression ``asimov``, e.g., `Asimov, Isaac` or `Isaac "
896 "Asimov`, otherwise ``''``."
897 msgstr ""
898
899 #: ../../__w/calibre/calibre/manual/template_lang.rst:427
900 msgid ""
901 "``program: 'asimov$' inlist_field 'authors'`` returns ``'1'`` if any author "
902 "matches the regular expression ``asimov$``, e.g., `Isaac Asimov`, otherwise "
903 "``''``. It doesn't match `Asimov, Isaac` because of the ``$`` anchor in the "
904 "regular expression."
905 msgstr ""
906
907 #: ../../__w/calibre/calibre/manual/template_lang.rst:428
908 msgid ""
909 "``program: if field('series') != 'foo' then 'bar' else 'mumble' fi`` returns"
910 " ``'bar'`` if the book's series is not `foo`. Otherwise it returns "
911 "``'mumble'``."
912 msgstr ""
913
914 #: ../../__w/calibre/calibre/manual/template_lang.rst:429
915 msgid ""
916 "``program: if field('series') == 'foo' || field('series') == '1632' then "
917 "'yes' else 'no' fi`` returns ``'yes'`` if series is either `foo` or `1632`, "
918 "otherwise ``'no'``."
919 msgstr ""
920
921 #: ../../__w/calibre/calibre/manual/template_lang.rst:430
922 msgid ""
923 "``program: if '^(foo|1632)$' in field('series') then 'yes' else 'no' fi`` "
924 "returns ``'yes'`` if series is either `foo` or `1632`, otherwise ``'no'``."
925 msgstr ""
926
927 #: ../../__w/calibre/calibre/manual/template_lang.rst:431
928 msgid ""
929 "``program: if 11 > 2 then 'yes' else 'no' fi`` returns ``'no'`` because the "
930 "``>`` operator does a lexical comparison."
931 msgstr ""
932
933 #: ../../__w/calibre/calibre/manual/template_lang.rst:432
934 msgid ""
935 "``program: if 11 ># 2 then 'yes' else 'no' fi`` returns ``'yes'`` because "
936 "the ``>#`` operator does a numeric comparison."
937 msgstr ""
938
939 #: ../../__w/calibre/calibre/manual/template_lang.rst:434
940 msgid "**Functions in General Program Mode**"
941 msgstr ""
942
943 #: ../../__w/calibre/calibre/manual/template_lang.rst:436
944 msgid ""
945 "See :ref:`template_functions_reference` for the list of functions built into"
946 " the template language."
947 msgstr ""
948
949 #: ../../__w/calibre/calibre/manual/template_lang.rst:440
950 msgid ""
951 "As opposed to :ref:`Single Function Mode <single_mode>`, in General Program "
952 "Mode you must specify the first parameter ``value``."
953 msgstr ""
954
955 #: ../../__w/calibre/calibre/manual/template_lang.rst:441
956 msgid "All parameters are expression_lists (see the grammar above)."
957 msgstr ""
958
959 #: ../../__w/calibre/calibre/manual/template_lang.rst:446
960 msgid "More complex programs in template expressions - Template Program Mode"
961 msgstr ""
962
963 #: ../../__w/calibre/calibre/manual/template_lang.rst:448
964 msgid ""
965 "`Template Program Mode` (`TPM`) is a blend of :ref:`General Program Mode "
966 "<general_mode>` and :ref:`Single Function Mode <single_mode>`. `TPM` differs"
967 " from Single Function Mode in that it permits writing template expressions "
968 "that refer to other metadata fields, use nested functions, modify variables,"
969 " and do arithmetic. It differs from `General Program Mode` in that the "
970 "template is contained between ``{`` and ``}`` characters and doesn't begin "
971 "with the word ``program:``. The program portion of the template is a General"
972 " Program Mode expression list."
973 msgstr ""
974
975 #: ../../__w/calibre/calibre/manual/template_lang.rst:451
976 msgid ""
977 "Example: assume you want a template to show the series for a book if it has "
978 "one, otherwise show the value of a custom field #genre. You cannot do this "
979 "in the :ref:`Single Function Mode <single_mode>` because you cannot make "
980 "reference to another metadata field within a template expression. In `TPM` "
981 "you can, as the following expression demonstrates::"
982 msgstr ""
983
984 #: ../../__w/calibre/calibre/manual/template_lang.rst:456
985 msgid "The example shows several things:"
986 msgstr "O exemplo mostra várias coisas:"
987
988 #: ../../__w/calibre/calibre/manual/template_lang.rst:458
989 msgid ""
990 "`TPM` is used if the expression begins with ``:'`` and ends with ``'}``. "
991 "Anything else is assumed to be in :ref:`Single Function Mode <single_mode>`."
992 msgstr ""
993
994 #: ../../__w/calibre/calibre/manual/template_lang.rst:460
995 msgid ""
996 "If the template contains a prefix and suffix, the expression ends with "
997 "``'|`` where the ``|`` is the delimiter for the prefix. Example::"
998 msgstr ""
999
1000 #: ../../__w/calibre/calibre/manual/template_lang.rst:464
1001 msgid ""
1002 "Functions must be given all their arguments. For example, the standard "
1003 "built-in functions must be given the initial parameter ``value``."
1004 msgstr ""
1005
1006 #: ../../__w/calibre/calibre/manual/template_lang.rst:465
1007 msgid ""
1008 "The variable ``$`` is usable as the ``value`` argument and stands for the "
1009 "value of the field named in the template, ``series_index`` in this case."
1010 msgstr ""
1011
1012 #: ../../__w/calibre/calibre/manual/template_lang.rst:466
1013 msgid "white space is ignored and can be used anywhere within the expression."
1014 msgstr ""
1015
1016 #: ../../__w/calibre/calibre/manual/template_lang.rst:467
1017 msgid ""
1018 "constant strings are enclosed in matching quotes, either ``'`` or ``\"``."
1019 msgstr ""
1020
1021 #: ../../__w/calibre/calibre/manual/template_lang.rst:469
1022 msgid ""
1023 "In `TPM`, using ``{`` and ``}`` characters in string literals can lead to "
1024 "errors or unexpected results because they confuse the template processor. It"
1025 " tries to treat them as template expression boundaries, not characters. In "
1026 "some but not all cases you can replace a ``{`` with ``[[`` and a ``}`` with "
1027 "`]]`. Generally, if your program contains ``{`` and ``}`` characters then "
1028 "you should use `General Program Mode`."
1029 msgstr ""
1030
1031 #: ../../__w/calibre/calibre/manual/template_lang.rst:474
1032 msgid "Python Template Mode"
1033 msgstr ""
1034
1035 #: ../../__w/calibre/calibre/manual/template_lang.rst:476
1036 msgid ""
1037 "Python Template Mode (PTM) lets you write templates using native Python and "
1038 "the `calibre API <https://manual.calibre-ebook.com/develop.html#api-"
1039 "documentation-for-various-parts-of-calibre>`_. The database API will be of "
1040 "most use; further discussion is beyond the scope of this manual. PTM "
1041 "templates are faster and can do more complicated operations but you must "
1042 "know how to write code in Python using the calibre API."
1043 msgstr ""
1044
1045 #: ../../__w/calibre/calibre/manual/template_lang.rst:478
1046 msgid "A PTM template begins with:"
1047 msgstr ""
1048
1049 #: ../../__w/calibre/calibre/manual/template_lang.rst:496
1050 msgid ""
1051 "You can add the above text to your template using the context menu, usually "
1052 "accessed with a right click. The comments are not significant and can be "
1053 "removed. You must use python indenting."
1054 msgstr ""
1055
1056 #: ../../__w/calibre/calibre/manual/template_lang.rst:498
1057 msgid ""
1058 "The context object supports ``str(context)`` that returns a string of the "
1059 "context's contents, and ``context.attributes`` that returns a list of the "
1060 "attribute names in the context."
1061 msgstr ""
1062
1063 #: ../../__w/calibre/calibre/manual/template_lang.rst:500
1064 msgid ""
1065 "The ``context.funcs`` attribute allows calling Built-in and User template "
1066 "functions, and Stored GPM/Python templates, so that you can execute them "
1067 "directly in your code. The functions are retrieved using their names. If the"
1068 " name conflicts with a Python keyword, add an underscore to the end of the "
1069 "name. Examples:"
1070 msgstr ""
1071
1072 #: ../../__w/calibre/calibre/manual/template_lang.rst:507
1073 msgid ""
1074 "Here is an example of a PTM template that produces a list of all the authors"
1075 " for a series. The list is stored in a `Column built from other columns, "
1076 "behaves like tags`. It shows in :guilabel:`Book details` and has the "
1077 ":guilabel:`on separate lines` checked (in :guilabel:`Preferences->Look & "
1078 "feel->Book details`). That option requires the list to be comma-separated. "
1079 "To satisfy that requirement the template converts commas in author names to "
1080 "semicolons then builds a comma-separated list of authors. The authors are "
1081 "then sorted, which is why the template uses author_sort."
1082 msgstr ""
1083
1084 #: ../../__w/calibre/calibre/manual/template_lang.rst:528
1085 msgid "The output in :guilabel:`Book details` looks like this:"
1086 msgstr ""
1087
1088 #: ../../__w/calibre/calibre/manual/template_lang.rst:530
1089 msgid "E-book conversion dialog"
1090 msgstr "Caixa de conversão de E-book"
1091
1092 #: ../../__w/calibre/calibre/manual/template_lang.rst:536
1093 msgid "Stored templates"
1094 msgstr "Modelos salvos"
1095
1096 #: ../../__w/calibre/calibre/manual/template_lang.rst:538
1097 msgid ""
1098 "Both :ref:`General Program Mode <general_mode>` and :ref:`Python Template "
1099 "Mode <python_mode>` support saving templates and calling those templates "
1100 "from another template, much like calling stored functions. You save "
1101 "templates using :guilabel:`Preferences->Advanced->Template functions`. More "
1102 "information is provided in that dialog. You call a template the same way you"
1103 " call a function, passing positional arguments if desired. An argument can "
1104 "be any expression. Examples of calling a template, assuming the stored "
1105 "template is named ``foo``:"
1106 msgstr ""
1107
1108 #: ../../__w/calibre/calibre/manual/template_lang.rst:540
1109 msgid "``foo()`` -- call the template passing no arguments."
1110 msgstr ""
1111
1112 #: ../../__w/calibre/calibre/manual/template_lang.rst:541
1113 msgid ""
1114 "``foo(a, b)`` call the template passing the values of the two variables "
1115 "``a`` and ``b``."
1116 msgstr ""
1117
1118 #: ../../__w/calibre/calibre/manual/template_lang.rst:542
1119 msgid ""
1120 "``foo(if field('series') then field('series_index') else 0 fi)`` -- if the "
1121 "book has a ``series`` then pass the ``series_index``, otherwise pass the "
1122 "value ``0``."
1123 msgstr ""
1124
1125 #: ../../__w/calibre/calibre/manual/template_lang.rst:544
1126 msgid ""
1127 "In GPM you retrieve the arguments passed in the call to the stored template "
1128 "using the ``arguments`` function. It both declares and initializes local "
1129 "variables, effectively parameters. The variables are positional; they get "
1130 "the value of the parameter given in the call in the same position. If the "
1131 "corresponding parameter is not provided in the call then ``arguments`` "
1132 "assigns that variable the provided default value. If there is no default "
1133 "value then the variable is set to the empty string. For example, the "
1134 "following ``arguments`` function declares 2 variables, ``key``, "
1135 "``alternate``::"
1136 msgstr ""
1137
1138 #: ../../__w/calibre/calibre/manual/template_lang.rst:548
1139 msgid "Examples, again assuming the stored template is named ``foo``:"
1140 msgstr ""
1141
1142 #: ../../__w/calibre/calibre/manual/template_lang.rst:550
1143 msgid ""
1144 "``foo('#myseries')`` -- argument ``key`` is assigned the value "
1145 "``'myseries'`` and the argument ``alternate`` is assigned the default value "
1146 "``'series'``."
1147 msgstr ""
1148
1149 #: ../../__w/calibre/calibre/manual/template_lang.rst:551
1150 msgid ""
1151 "``foo('series', '#genre')`` the variable ``key`` is assigned the value "
1152 "``'series'`` and the variable ``alternate`` is assigned the value "
1153 "``'#genre'``."
1154 msgstr ""
1155
1156 #: ../../__w/calibre/calibre/manual/template_lang.rst:552
1157 msgid ""
1158 "``foo()`` -- the variable ``key`` is assigned the empty string and the "
1159 "variable ``alternate`` is assigned the value ``'series'``."
1160 msgstr ""
1161
1162 #: ../../__w/calibre/calibre/manual/template_lang.rst:554
1163 msgid ""
1164 "In PTM the arguments are passed in the ``arguments`` parameter, which is a "
1165 "list of strings. There isn't any way to specify default values. You must "
1166 "check the length of the ``arguments`` list to be sure that the number of "
1167 "arguments is what you expect."
1168 msgstr ""
1169
1170 #: ../../__w/calibre/calibre/manual/template_lang.rst:556
1171 msgid ""
1172 "An easy way to test stored templates is using the ``Template tester`` "
1173 "dialog. For ease of access give it a keyboard shortcut in "
1174 ":guilabel:`Preferences->Advanced->Keyboard shortcuts->Template tester`. "
1175 "Giving the ``Stored templates`` dialog a shortcut will help switching more "
1176 "rapidly between the tester and editing the stored template's source code."
1177 msgstr ""
1178
1179 #: ../../__w/calibre/calibre/manual/template_lang.rst:559
1180 msgid "Providing additional information to templates"
1181 msgstr ""
1182
1183 #: ../../__w/calibre/calibre/manual/template_lang.rst:561
1184 msgid ""
1185 "A developer can choose to pass additional information to the template "
1186 "processor, such as application-specific book metadata or information about "
1187 "what the processor is being asked to do. A template can access this "
1188 "information and use it during the evaluation."
1189 msgstr ""
1190
1191 #: ../../__w/calibre/calibre/manual/template_lang.rst:563
1192 msgid "**Developer: how to pass additional information**"
1193 msgstr ""
1194
1195 #: ../../__w/calibre/calibre/manual/template_lang.rst:565
1196 msgid ""
1197 "The additional information is a Python dictionary containing pairs "
1198 "``variable_name: variable_value`` where the values must be strings. The "
1199 "template can access the dictionary, creating template local variables named "
1200 "``variable_name`` containing the value ``variable_value``. The user cannot "
1201 "change the name so it is best to use names that won't collide with other "
1202 "template local variables, for example by prefixing the name with an "
1203 "underscore."
1204 msgstr ""
1205
1206 #: ../../__w/calibre/calibre/manual/template_lang.rst:567
1207 msgid ""
1208 "This dictionary is passed to the template processor (the ``formatter``) "
1209 "using the named parameter ``global_vars=your_dict``. The full method "
1210 "signature is::"
1211 msgstr ""
1212
1213 #: ../../__w/calibre/calibre/manual/template_lang.rst:575
1214 msgid "**Template writer: how to access the additional information**"
1215 msgstr ""
1216
1217 #: ../../__w/calibre/calibre/manual/template_lang.rst:577
1218 msgid ""
1219 "You access the additional information (the ``globals`` dictionary) in a "
1220 "template using the template function::"
1221 msgstr ""
1222
1223 #: ../../__w/calibre/calibre/manual/template_lang.rst:581
1224 msgid ""
1225 "where ``id`` is any legal variable name. This function checks whether the "
1226 "additional information provided by the developer contains the name. If it "
1227 "does then the function assigns the provided value to a template local "
1228 "variable with that name. If the name is not in the additional information "
1229 "and if an ``expression`` is provided, the ``expression`` is evaluated and "
1230 "the result is assigned to the local variable. If neither a value nor an "
1231 "expression is provided, the function assigns the empty string (``''``) to "
1232 "the local variable."
1233 msgstr ""
1234
1235 #: ../../__w/calibre/calibre/manual/template_lang.rst:583
1236 msgid ""
1237 "A template can set a value in the ``globals`` dictionary using the template "
1238 "function::"
1239 msgstr ""
1240
1241 #: ../../__w/calibre/calibre/manual/template_lang.rst:587
1242 msgid ""
1243 "This function sets the ``globals`` dictionary key:value pair ``id:value`` "
1244 "where ``value`` is the value of the template local variable ``id``. If that "
1245 "local variable doesn't exist then ``value`` is set to the result of "
1246 "evaluating ``expression``."
1247 msgstr ""
1248
1249 #: ../../__w/calibre/calibre/manual/template_lang.rst:590
1250 msgid "Notes on the difference between modes"
1251 msgstr ""
1252
1253 #: ../../__w/calibre/calibre/manual/template_lang.rst:592
1254 msgid ""
1255 "The three program modes, :ref:`Single Function Mode <single_mode>` (SFM), "
1256 ":ref:`Template Program Mode <template_mode>` (`TPM`), and :ref:`General "
1257 "Program Mode <general_mode>` (`GPM`), work differently. SFM is intended to "
1258 "be 'simple' so it hides a lot of programming language bits."
1259 msgstr ""
1260
1261 #: ../../__w/calibre/calibre/manual/template_lang.rst:594
1262 msgid "Differences:"
1263 msgstr "Diferenças:"
1264
1265 #: ../../__w/calibre/calibre/manual/template_lang.rst:596
1266 msgid ""
1267 "In SFM the value of the column is always passed as an 'invisible' first "
1268 "argument to a function included in the template."
1269 msgstr ""
1270
1271 #: ../../__w/calibre/calibre/manual/template_lang.rst:597
1272 msgid ""
1273 "SFM doesn't support the difference between variables and strings; all values"
1274 " are strings."
1275 msgstr ""
1276
1277 #: ../../__w/calibre/calibre/manual/template_lang.rst:598
1278 msgid ""
1279 "The following SFM template returns either the series name or the string \"no"
1280 " series\"::"
1281 msgstr ""
1282
1283 #: ../../__w/calibre/calibre/manual/template_lang.rst:602
1284 msgid "The equivalent template in `TPM` is ::"
1285 msgstr ""
1286
1287 #: ../../__w/calibre/calibre/manual/template_lang.rst:606
1288 msgid "The equivalent template in `GPM` is::"
1289 msgstr ""
1290
1291 #: ../../__w/calibre/calibre/manual/template_lang.rst:610
1292 msgid ""
1293 "The first argument to ``ifempty`` is the value of the field ``series``. The "
1294 "second argument is the string ``no series``. In SFM the first argument, the "
1295 "value of the field, is automatically passed (the invisible argument)."
1296 msgstr ""
1297
1298 #: ../../__w/calibre/calibre/manual/template_lang.rst:611
1299 msgid ""
1300 "Several template functions, for example ``booksize()`` and "
1301 "``current_library_name()``, take no arguments. Because of the 'invisible "
1302 "argument' you cannot use these functions in SFM."
1303 msgstr ""
1304
1305 #: ../../__w/calibre/calibre/manual/template_lang.rst:612
1306 msgid ""
1307 "Nested functions, where a function calls another function to compute an "
1308 "argument, cannot be used in SFM. For example this template, intended to "
1309 "return the first 5 characters of the series value uppercased, won't work in "
1310 "SFM::"
1311 msgstr ""
1312
1313 #: ../../__w/calibre/calibre/manual/template_lang.rst:616
1314 msgid ""
1315 "`TPM` and `GPM` support nested functions. The above template in `TPM` would "
1316 "be::"
1317 msgstr ""
1318
1319 #: ../../__w/calibre/calibre/manual/template_lang.rst:620
1320 msgid "In `GPM` it would be::"
1321 msgstr ""
1322
1323 #: ../../__w/calibre/calibre/manual/template_lang.rst:624
1324 msgid ""
1325 "As noted in the above :ref:`Template Program Mode <template_mode>` section, "
1326 "using ``{`` and ``}`` characters in `TPM` string literals can lead to errors"
1327 " or unexpected results because they confuse the template processor. It tries"
1328 " to treat them as template boundaries, not characters. In some but not all "
1329 "cases you can replace a ``{`` with ``[[`` and a ``}`` with `]]`. Generally, "
1330 "if your program contains ``{`` and ``}`` characters then you should use "
1331 "`General Program Mode`."
1332 msgstr ""
1333
1334 #: ../../__w/calibre/calibre/manual/template_lang.rst:628
1335 msgid "User-defined Python template functions"
1336 msgstr ""
1337
1338 #: ../../__w/calibre/calibre/manual/template_lang.rst:630
1339 msgid ""
1340 "You can add your own Python functions to the template processor. Such "
1341 "functions can be used in any of the three template programming modes. The "
1342 "functions are added by going to :guilabel:`Preferences -> Advanced -> "
1343 "Template functions`. Instructions are shown in that dialog. Note that you "
1344 "can use `Python Templates` for a similar purpose. As calling user-defined "
1345 "functions is faster than calling a Python template, user-defined functions "
1346 "might be more efficient depending on the complexity of what the function or "
1347 "template does."
1348 msgstr ""
1349
1350 #: ../../__w/calibre/calibre/manual/template_lang.rst:633
1351 msgid "Special notes for save/send templates"
1352 msgstr "Notas especiais para modelos de exportar/enviar"
1353
1354 #: ../../__w/calibre/calibre/manual/template_lang.rst:635
1355 msgid ""
1356 "Special processing is applied when a template is used in a `save to disk` or"
1357 " `send to device` template. The values of the fields are cleaned, replacing "
1358 "characters that are special to file systems with underscores, including "
1359 "slashes. This means that field text cannot be used to create folders. "
1360 "However, slashes are not changed in prefix or suffix strings, so slashes in "
1361 "these strings will cause folders to be created. Because of this, you can "
1362 "create variable-depth folder structure."
1363 msgstr ""
1364
1365 #: ../../__w/calibre/calibre/manual/template_lang.rst:637
1366 msgid ""
1367 "For example, assume we want the folder structure `series/series_index - "
1368 "title`, with the caveat that if series does not exist, then the title should"
1369 " be in the top folder. The template to do this is::"
1370 msgstr ""
1371
1372 #: ../../__w/calibre/calibre/manual/template_lang.rst:641
1373 msgid "The slash and the hyphen appear only if series is not empty."
1374 msgstr "A barra inclinada e o hífen aparecem apenas se a série não estiver vazia."
1375
1376 #: ../../__w/calibre/calibre/manual/template_lang.rst:643
1377 msgid ""
1378 "The lookup function lets us do even fancier processing. For example, assume "
1379 "that if a book has a series, then we want the folder structure "
1380 "`series/series index - title.fmt`. If the book does not have a series then "
1381 "we want the folder structure `genre/author_sort/title.fmt`. If the book has "
1382 "no genre then we want to use 'Unknown'. We want two completely different "
1383 "paths, depending on the value of series."
1384 msgstr ""
1385
1386 #: ../../__w/calibre/calibre/manual/template_lang.rst:645
1387 msgid "To accomplish this, we:"
1388 msgstr "Para obter isto, fazemos:"
1389
1390 #: ../../__w/calibre/calibre/manual/template_lang.rst:647
1391 msgid ""
1392 "Create a composite field (give it lookup name #aa) containing "
1393 "``{series}/{series_index} - {title}``. If the series is not empty, then this"
1394 " template will produce `series/series_index - title`."
1395 msgstr ""
1396
1397 #: ../../__w/calibre/calibre/manual/template_lang.rst:648
1398 msgid ""
1399 "Create a composite field (give it lookup name #bb) containing "
1400 "``{#genre:ifempty(Unknown)}/{author_sort}/{title}``. This template produces "
1401 "`genre/author_sort/title`, where an empty genre is replaced with `Unknown`."
1402 msgstr ""
1403
1404 #: ../../__w/calibre/calibre/manual/template_lang.rst:649
1405 msgid ""
1406 "Set the save template to ``{series:lookup(.,#aa,#bb)}``. This template "
1407 "chooses composite field ``#aa`` if series is not empty and composite field "
1408 "``#bb`` if series is empty. We therefore have two completely different save "
1409 "paths, depending on whether or not `series` is empty."
1410 msgstr ""
1411
1412 #: ../../__w/calibre/calibre/manual/template_lang.rst:652
1413 msgid "Tips"
1414 msgstr "Sugestões"
1415
1416 #: ../../__w/calibre/calibre/manual/template_lang.rst:654
1417 msgid ""
1418 "Use the Template Tester to test templates. Add the tester to the context "
1419 "menu for books in the library and/or give it a keyboard shortcut."
1420 msgstr ""
1421
1422 #: ../../__w/calibre/calibre/manual/template_lang.rst:655
1423 msgid ""
1424 "Templates can use other templates by referencing composite columns built "
1425 "with the desired template. Alternatively, you can use Stored Templates."
1426 msgstr ""
1427
1428 #: ../../__w/calibre/calibre/manual/template_lang.rst:656
1429 msgid ""
1430 "In a plugboard, you can set a field to empty (or whatever is equivalent to "
1431 "empty) by using the special template ``{}``. This template will always "
1432 "evaluate to an empty string."
1433 msgstr ""
1434
1435 #: ../../__w/calibre/calibre/manual/template_lang.rst:657
1436 msgid ""
1437 "The technique described above to show numbers even if they have a zero value"
1438 " works with the standard field series_index."
1439 msgstr ""
1440
1441 #: ../../__w/calibre/calibre/manual/template_lang.rst:662
1442 msgid "Template function reference"
1443 msgstr "Referência das funções de modelo"