Debian Codegraph @

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