Debian Codegraph @

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