Debian Codegraph @

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