| 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 |
# Usama Khalil, 2025 |
| 7 |
msgid "" |
| 8 |
msgstr "" |
| 9 |
"Project-Id-Version: calibre\n" |
| 10 |
"Report-Msgid-Bugs-To: \n" |
| 11 |
"POT-Creation-Date: 2026-02-17 16:44+0000\n" |
| 12 |
"PO-Revision-Date: 2014-06-17 08:35+0000\n" |
| 13 |
"Last-Translator: Usama Khalil, 2025\n" |
| 14 |
"Language-Team: Arabic (http://app.transifex.com/calibre/calibre/language/ar/)\n" |
| 15 |
"MIME-Version: 1.0\n" |
| 16 |
"Content-Type: text/plain; charset=UTF-8\n" |
| 17 |
"Content-Transfer-Encoding: 8bit\n" |
| 18 |
"Language: ar\n" |
| 19 |
"Plural-Forms: nplurals=6; plural=n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 && n%100<=10 ? 3 : n%100>=11 && n%100<=99 ? 4 : 5;\n" |
| 20 |
|
| 21 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:4 |
| 22 |
msgid "Writing your own plugins to extend calibre's functionality" |
| 23 |
msgstr "كتابة إضافاتك الخاصة لتوسيع وظائف calibre" |
| 24 |
|
| 25 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:6 |
| 26 |
msgid "" |
| 27 |
"calibre has a very modular design. Almost all functionality in calibre comes" |
| 28 |
" in the form of plugins. Plugins are used for conversion, for downloading " |
| 29 |
"news (though these are called recipes), for various components of the user " |
| 30 |
"interface, to connect to different devices, to process files when adding " |
| 31 |
"them to calibre and so on. You can get a complete list of all the built-in " |
| 32 |
"plugins in calibre by going to :guilabel:`Preferences->Advanced->Plugins`." |
| 33 |
msgstr "يتميز calibre بتصميم معياري للغاية. تقريبًا جميع الوظائف في calibre تأتي على شكل إضافات. تُستخدم الإضافات للتحويل، ولتنزيل الأخبار (على الرغم من أنها تسمى وصفات)، لمكونات مختلفة من واجهة المستخدم، للاتصال بأجهزة مختلفة، لمعالجة الملفات عند إضافتها إلى calibre وهكذا. يمكنك الحصول على قائمة كاملة بجميع الإضافات المدمجة في calibre بالانتقال إلى :guilabel:`التفضيلات->خيارات متقدمة->الإضافات`." |
| 34 |
|
| 35 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:8 |
| 36 |
msgid "" |
| 37 |
"Here, we will teach you how to create your own plugins to add new features " |
| 38 |
"to calibre." |
| 39 |
msgstr "هنا، سنعلمك كيفية إنشاء إضافاتك الخاصة لإضافة ميزات جديدة إلى calibre." |
| 40 |
|
| 41 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:13 |
| 42 |
msgid "Contents" |
| 43 |
msgstr "المحتويات" |
| 44 |
|
| 45 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:15 |
| 46 |
msgid "This only applies to calibre releases >= 0.8.60" |
| 47 |
msgstr "هذا ينطبق فقط على إصدارات calibre >= 0.8.60" |
| 48 |
|
| 49 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:18 |
| 50 |
msgid "Anatomy of a calibre plugin" |
| 51 |
msgstr "تشريح إضافة calibre" |
| 52 |
|
| 53 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:20 |
| 54 |
msgid "" |
| 55 |
"A calibre plugin is very simple, it's just a ZIP file that contains some " |
| 56 |
"Python code and any other resources like image files needed by the plugin. " |
| 57 |
"Without further ado, let's see a basic example." |
| 58 |
msgstr "إضافة calibre بسيطة جدًا، إنها مجرد ملف ZIP يحتوي على بعض أكواد بايثون وأي موارد أخرى مثل ملفات الصور التي تحتاجها الإضافة. دون مزيد من اللغط، دعنا نرى مثالًا أساسيًا." |
| 59 |
|
| 60 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:24 |
| 61 |
msgid "" |
| 62 |
"Suppose you have an installation of calibre that you are using to self " |
| 63 |
"publish various e-documents in EPUB and MOBI formats. You would like all " |
| 64 |
"files generated by calibre to have their publisher set as \"Hello world\", " |
| 65 |
"here's how to do it. Create a file named :file:`__init__.py` (this is a " |
| 66 |
"special name and must always be used for the main file of your plugin) and " |
| 67 |
"enter the following Python code into it:" |
| 68 |
msgstr "لنفترض أن لديك تثبيتًا لـ calibre تستخدمه لنشر مستندات إلكترونية مختلفة بتنسيقات EPUB و MOBI. ترغب في أن تكون جميع الملفات التي ينشئها calibre لها ناشر محدد باسم \"Hello world\"، إليك كيفية القيام بذلك. أنشئ ملفًا باسم :file:`__init__.py` (هذا اسم خاص ويجب استخدامه دائمًا للملف الرئيسي لإضافتك) وأدخل كود بايثون التالي فيه:" |
| 69 |
|
| 70 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:32 |
| 71 |
msgid "" |
| 72 |
"That's all. To add this code to calibre as a plugin, simply run the " |
| 73 |
"following in the folder in which you created :file:`__init__.py`::" |
| 74 |
msgstr "هذا كل شيء. لإضافة هذا الكود إلى calibre كإضافة، ما عليك سوى تشغيل ما يلي في المجلد الذي أنشأت فيه :file:`__init__.py`::" |
| 75 |
|
| 76 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:38 |
| 77 |
msgid "" |
| 78 |
"On macOS, the command line tools are inside the calibre bundle, for example," |
| 79 |
" if you installed calibre in :file:`/Applications` the command line tools " |
| 80 |
"are in :file:`/Applications/calibre.app/Contents/MacOS/`." |
| 81 |
msgstr "على نظام macOS، توجد أدوات سطر الأوامر داخل حزمة calibre، على سبيل المثال، إذا قمت بتثبيت calibre في :file:`/Applications` فإن أدوات سطر الأوامر موجودة في :file:`/Applications/calibre.app/Contents/MacOS/`." |
| 82 |
|
| 83 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:42 |
| 84 |
msgid "" |
| 85 |
"You can download the Hello World plugin from " |
| 86 |
":download_file:`helloworld_plugin.zip`." |
| 87 |
msgstr "يمكنك تنزيل إضافة Hello World من :download_file:`helloworld_plugin.zip`." |
| 88 |
|
| 89 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:45 |
| 90 |
msgid "" |
| 91 |
"Every time you use calibre to convert a book, the plugin's :meth:`run` " |
| 92 |
"method will be called and the converted book will have its publisher set to " |
| 93 |
"\"Hello World\". This is a trivial plugin, let's move on to a more complex " |
| 94 |
"example that actually adds a component to the user interface." |
| 95 |
msgstr "" |
| 96 |
|
| 97 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:50 |
| 98 |
msgid "A User Interface plugin" |
| 99 |
msgstr "إضافة واجهة مستخدم" |
| 100 |
|
| 101 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:52 |
| 102 |
msgid "" |
| 103 |
"This plugin will be spread over a few files (to keep the code clean). It " |
| 104 |
"will show you how to get resources (images or data files) from the plugin " |
| 105 |
"ZIP file, allow users to configure your plugin, how to create elements in " |
| 106 |
"the calibre user interface and how to access and query the books database in" |
| 107 |
" calibre." |
| 108 |
msgstr "سيتم توزيع هذه الإضافة على عدد قليل من الملفات (للحفاظ على الكود نظيفًا). ستوضح لك كيفية الحصول على الموارد (الصور أو ملفات البيانات) من ملف ZIP الخاص بالإضافة، وكيفية السماح للمستخدمين بتكوين إضافتك، وكيفية إنشاء عناصر في واجهة مستخدم calibre، وكيفية الوصول إلى قاعدة بيانات الكتب والاستعلام عنها في calibre." |
| 109 |
|
| 110 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:57 |
| 111 |
msgid "" |
| 112 |
"You can download this plugin from :download_file:`interface_demo_plugin.zip`" |
| 113 |
msgstr "يمكنك تنزيل هذه الإضافة من :download_file:`interface_demo_plugin.zip`" |
| 114 |
|
| 115 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:61 |
| 116 |
msgid "" |
| 117 |
"The first thing to note is that this ZIP file has a lot more files in it, " |
| 118 |
"explained below, pay particular attention to ``plugin-import-name-" |
| 119 |
"interface_demo.txt``." |
| 120 |
msgstr "أول شيء يجب ملاحظته هو أن ملف ZIP هذا يحتوي على العديد من الملفات الإضافية، الموضحة أدناه، انتبه بشكل خاص إلى ``plugin-import-name-interface_demo.txt``." |
| 121 |
|
| 122 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:64 |
| 123 |
msgid "**plugin-import-name-interface_demo.txt**" |
| 124 |
msgstr "**plugin-import-name-interface_demo.txt**" |
| 125 |
|
| 126 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:65 |
| 127 |
msgid "" |
| 128 |
"An empty text file used to enable the multi-file plugin magic. This file " |
| 129 |
"must be present in all plugins that use more than one .py file. It should be" |
| 130 |
" empty and its filename must be of the form: ``plugin-import-" |
| 131 |
"name-**some_name**.txt``. The presence of this file allows you to import " |
| 132 |
"code from the .py files present inside the ZIP file, using a statement " |
| 133 |
"like::" |
| 134 |
msgstr "ملف نصي فارغ يستخدم لتمكين سحر الإضافات متعددة الملفات. يجب أن يكون هذا الملف موجودًا في جميع الإضافات التي تستخدم أكثر من ملف .py واحد. يجب أن يكون فارغًا ويجب أن يكون اسم ملفه على الشكل: ``plugin-import-name-**some_name**.txt``. يسمح وجود هذا الملف لك باستيراد الكود من ملفات .py الموجودة داخل ملف ZIP، باستخدام عبارة مثل::" |
| 135 |
|
| 136 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:71 |
| 137 |
msgid "" |
| 138 |
"The prefix ``calibre_plugins`` must always be present. ``some_name`` comes " |
| 139 |
"from the filename of the empty text file. ``some_module`` refers to " |
| 140 |
":file:`some_module.py` file inside the ZIP file. Note that this importing is" |
| 141 |
" just as powerful as regular Python imports. You can create packages and " |
| 142 |
"subpackages of .py modules inside the ZIP file, just like you would normally" |
| 143 |
" (by defining __init__.py in each sub-folder), and everything should \"just " |
| 144 |
"work\"." |
| 145 |
msgstr "" |
| 146 |
|
| 147 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:76 |
| 148 |
msgid "" |
| 149 |
"The name you use for ``some_name`` enters a global namespace shared by all " |
| 150 |
"plugins, **so make it as unique as possible**. But remember that it must be " |
| 151 |
"a valid Python identifier (only alphabets, numbers and the underscore)." |
| 152 |
msgstr "الاسم الذي تستخدمه لـ ``some_name`` يدخل مساحة اسم عالمية مشتركة بين جميع الإضافات، **لذا اجعله فريدًا قدر الإمكان**. ولكن تذكر أنه يجب أن يكون معرف بايثون صالحًا (أحرف أبجدية وأرقام وشرطة سفلية فقط)." |
| 153 |
|
| 154 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:79 |
| 155 |
msgid "**__init__.py**" |
| 156 |
msgstr "**__init__.py**" |
| 157 |
|
| 158 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:80 |
| 159 |
msgid "As before, the file that defines the plugin class" |
| 160 |
msgstr "كما كان من قبل، الملف الذي يحدد فئة الإضافة" |
| 161 |
|
| 162 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:82 |
| 163 |
msgid "**main.py**" |
| 164 |
msgstr "**main.py**" |
| 165 |
|
| 166 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:83 |
| 167 |
msgid "This file contains the actual code that does something useful" |
| 168 |
msgstr "يحتوي هذا الملف على الكود الفعلي الذي يقوم بشيء مفيد" |
| 169 |
|
| 170 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:85 |
| 171 |
msgid "**ui.py**" |
| 172 |
msgstr "**ui.py**" |
| 173 |
|
| 174 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:86 |
| 175 |
msgid "This file defines the interface part of the plugin" |
| 176 |
msgstr "يحدد هذا الملف جزء الواجهة من الإضافة" |
| 177 |
|
| 178 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:88 |
| 179 |
msgid "**images/icon.png**" |
| 180 |
msgstr "**images/icon.png**" |
| 181 |
|
| 182 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:89 |
| 183 |
msgid "The icon for this plugin" |
| 184 |
msgstr "أيقونة هذه الإضافة" |
| 185 |
|
| 186 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:91 |
| 187 |
msgid "**about.txt**" |
| 188 |
msgstr "**about.txt**" |
| 189 |
|
| 190 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:92 |
| 191 |
msgid "A text file with information about the plugin" |
| 192 |
msgstr "ملف نصي يحتوي على معلومات حول الإضافة" |
| 193 |
|
| 194 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:94 |
| 195 |
msgid "**translations**" |
| 196 |
msgstr "**translations**" |
| 197 |
|
| 198 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:95 |
| 199 |
msgid "" |
| 200 |
"A folder containing .mo files with the translations of the user interface of" |
| 201 |
" your plugin into different languages. See below for details." |
| 202 |
msgstr "مجلد يحتوي على ملفات .mo مع ترجمات واجهة المستخدم الخاصة بـ إضافتك إلى لغات مختلفة. انظر أدناه للحصول على التفاصيل." |
| 203 |
|
| 204 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:99 |
| 205 |
msgid "Now let's look at the code." |
| 206 |
msgstr "الآن دعنا نلقي نظرة على الكود." |
| 207 |
|
| 208 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:102 |
| 209 |
msgid "__init__.py" |
| 210 |
msgstr "__init__.py" |
| 211 |
|
| 212 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:104 |
| 213 |
msgid "First, the obligatory ``__init__.py`` to define the plugin metadata:" |
| 214 |
msgstr "أولاً، ملف ``__init__.py`` الإلزامي لتحديد بيانات الإضافة الوصفية:" |
| 215 |
|
| 216 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:109 |
| 217 |
msgid "" |
| 218 |
"The only noteworthy feature is the field :attr:`actual_plugin`. Since " |
| 219 |
"calibre has both command line and GUI interfaces, GUI plugins like this one " |
| 220 |
"should not load any GUI libraries in __init__.py. The actual_plugin field " |
| 221 |
"does this for you, by telling calibre that the actual plugin is to be found " |
| 222 |
"in another file inside your ZIP archive, which will only be loaded in a GUI " |
| 223 |
"context." |
| 224 |
msgstr "الميزة الوحيدة الجديرة بالملاحظة هي الحقل :attr:`actual_plugin`. بما أن calibre يحتوي على واجهات سطر الأوامر وواجهات رسومية، فإن إضافات الواجهة الرسومية مثل هذه لا يجب أن تقوم بتحميل أي مكتبات واجهة رسومية في __init__.py. يقوم حقل actual_plugin بذلك نيابة عنك، عن طريق إخبار calibre بأن الإضافة الفعلية موجودة في ملف آخر داخل أرشيف ZIP الخاص بك، والذي سيتم تحميله فقط في سياق الواجهة الرسومية." |
| 225 |
|
| 226 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:114 |
| 227 |
msgid "" |
| 228 |
"Remember that for this to work, you must have a plugin-import-name-" |
| 229 |
"some_name.txt file in your plugin ZIP file, as discussed above." |
| 230 |
msgstr "تذكر أنه لكي يعمل هذا، يجب أن يكون لديك ملف plugin-import-name-some_name.txt في ملف ZIP الخاص بالإضافة، كما نوقش أعلاه." |
| 231 |
|
| 232 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:117 |
| 233 |
msgid "" |
| 234 |
"Also there are a couple of methods for enabling user configuration of the " |
| 235 |
"plugin. These are discussed below." |
| 236 |
msgstr "يوجد أيضًا بعض الطرق لتمكين المستخدم من تكوين الإضافة. سيتم مناقشة هذه الطرق أدناه." |
| 237 |
|
| 238 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:120 |
| 239 |
msgid "ui.py" |
| 240 |
msgstr "ui.py" |
| 241 |
|
| 242 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:122 |
| 243 |
msgid "" |
| 244 |
"Now let's look at ui.py which defines the actual GUI plugin. The source code" |
| 245 |
" is heavily commented and should be self explanatory:" |
| 246 |
msgstr "الآن دعنا نلقي نظرة على ui.py الذي يحدد إضافة واجهة المستخدم الرسومية الفعلية. الكود المصدري مشروح بشكل مكثف ويجب أن يكون واضحًا بذاته:" |
| 247 |
|
| 248 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:128 |
| 249 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:220 |
| 250 |
msgid "main.py" |
| 251 |
msgstr "main.py" |
| 252 |
|
| 253 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:130 |
| 254 |
msgid "The actual logic to implement the Interface Plugin Demo dialog." |
| 255 |
msgstr "المنطق الفعلي لتطبيق مربع حوار عرض إضافة الواجهة." |
| 256 |
|
| 257 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:136 |
| 258 |
msgid "Getting resources from the plugin ZIP file" |
| 259 |
msgstr "الحصول على الموارد من ملف ZIP الخاص بالإضافة" |
| 260 |
|
| 261 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:138 |
| 262 |
msgid "" |
| 263 |
"calibre's plugin loading system defines a couple of built-in functions that " |
| 264 |
"allow you to conveniently get files from the plugin ZIP file." |
| 265 |
msgstr "يحدد نظام تحميل الإضافات في calibre بعض الدوال المدمجة التي تسمح لك بالحصول على الملفات بسهولة من ملف ZIP الخاص بالإضافة." |
| 266 |
|
| 267 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:140 |
| 268 |
msgid "**get_resources(name_or_list_of_names)**" |
| 269 |
msgstr "**get_resources(name_or_list_of_names)**" |
| 270 |
|
| 271 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:141 |
| 272 |
msgid "" |
| 273 |
"This function should be called with a list of paths to files inside the ZIP " |
| 274 |
"file. For example to access the file :file:`icon.png` in the folder images " |
| 275 |
"in the ZIP file, you would use: ``images/icon.png``. Always use a forward " |
| 276 |
"slash as the path separator, even on Windows. When you pass in a single " |
| 277 |
"name, the function will return the raw bytes of that file or None if the " |
| 278 |
"name was not found in the ZIP file. If you pass in more than one name then " |
| 279 |
"it returns a dictionary mapping the names to bytes. If a name is not found," |
| 280 |
" it will not be present in the returned dictionary." |
| 281 |
msgstr "يجب استدعاء هذه الدالة بقائمة من المسارات إلى الملفات داخل ملف ZIP. على سبيل المثال، للوصول إلى الملف :file:`icon.png` في مجلد الصور في ملف ZIP، ستستخدم: ``images/icon.png``. استخدم دائمًا شرطة مائلة للأمام كفاصل للمسار، حتى على نظام Windows. عندما تمرر اسمًا واحدًا، ستعيد الدالة البايتات الخام لذلك الملف أو None إذا لم يتم العثور على الاسم في ملف ZIP. إذا مررت أكثر من اسم، فستعيد قاموسًا يربط الأسماء بالبايتات. إذا لم يتم العثور على اسم، فلن يكون موجودًا في القاموس المعروض." |
| 282 |
|
| 283 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:150 |
| 284 |
msgid "**get_icons(name_or_list_of_names, plugin_name='')**" |
| 285 |
msgstr "**get_icons(name_or_list_of_names, plugin_name='')**" |
| 286 |
|
| 287 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:151 |
| 288 |
msgid "" |
| 289 |
"A wrapper for get_resources() that creates QIcon objects from the raw bytes " |
| 290 |
"returned by get_resources. If a name is not found in the ZIP file the " |
| 291 |
"corresponding QIcon will be null. In order to support icon theme-ing, pass " |
| 292 |
"in the human friendly name of your plugin as ``plugin_name``. If the user is" |
| 293 |
" using an icon theme with icons for your plugin, they will be loaded " |
| 294 |
"preferentially." |
| 295 |
msgstr "غلاف لدالة get_resources() ينشئ كائنات QIcon من البايتات الخام التي تعيدها get_resources. إذا لم يتم العثور على اسم في ملف ZIP، فإن QIcon المقابل سيكون فارغًا. لدعم سمات الأيقونات، قم بتمرير الاسم الودي لإضافتك كـ ``plugin_name``. إذا كان المستخدم يستخدم سمة أيقونات تحتوي على أيقونات لإضافتك، فسيتم تحميلها تفضيلًا." |
| 296 |
|
| 297 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:160 |
| 298 |
msgid "Enabling user configuration of your plugin" |
| 299 |
msgstr "تمكين تكوين المستخدم لإضافتك" |
| 300 |
|
| 301 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:162 |
| 302 |
msgid "" |
| 303 |
"To allow users to configure your plugin, you must define three methods in " |
| 304 |
"your base plugin class, **is_customizable**, **config_widget** and " |
| 305 |
"**save_settings** as shown below:" |
| 306 |
msgstr "للسماح للمستخدمين بتكوين إضافتك، يجب عليك تعريف ثلاث طرق في فئة الإضافة الأساسية الخاصة بك، **is_customizable**، **config_widget** و**save_settings** كما هو موضح أدناه:" |
| 307 |
|
| 308 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:173 |
| 309 |
msgid "" |
| 310 |
"calibre has many different ways to store configuration data (a legacy of its" |
| 311 |
" long history). The recommended way is to use the **JSONConfig** class, " |
| 312 |
"which stores your configuration information in a .json file." |
| 313 |
msgstr "يحتوي calibre على العديد من الطرق المختلفة لتخزين بيانات التكوين (إرث من تاريخه الطويل). الطريقة الموصى بها هي استخدام فئة **JSONConfig**، التي تخزن معلومات التكوين الخاصة بك في ملف .json." |
| 314 |
|
| 315 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:175 |
| 316 |
msgid "" |
| 317 |
"The code to manage configuration data in the demo plugin is in config.py:" |
| 318 |
msgstr "الكود لإدارة بيانات التكوين في الإضافة التجريبية موجود في config.py:" |
| 319 |
|
| 320 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:180 |
| 321 |
msgid "" |
| 322 |
"The ``prefs`` object is now available throughout the plugin code by a " |
| 323 |
"simple::" |
| 324 |
msgstr "كائن ``prefs`` متاح الآن في جميع أنحاء كود الإضافة بواسطة بسيط::" |
| 325 |
|
| 326 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:185 |
| 327 |
msgid "You can see the ``prefs`` object being used in main.py:" |
| 328 |
msgstr "يمكنك رؤية كائن ``prefs`` المستخدم في main.py:" |
| 329 |
|
| 330 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:192 |
| 331 |
msgid "Edit book plugins" |
| 332 |
msgstr "تحرير إضافات الكتب" |
| 333 |
|
| 334 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:194 |
| 335 |
msgid "" |
| 336 |
"Now let's change gears for a bit and look at creating a plugin to add tools " |
| 337 |
"to the calibre book editor. The plugin is available here: " |
| 338 |
":download_file:`editor_demo_plugin.zip`." |
| 339 |
msgstr "الآن دعنا نغير المسار قليلاً وننظر إلى إنشاء إضافة لإضافة أدوات إلى محرر الكتب في calibre. الإضافة متاحة هنا: :download_file:`editor_demo_plugin.zip`." |
| 340 |
|
| 341 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:198 |
| 342 |
msgid "" |
| 343 |
"The first step, as for all plugins is to create the import name empty txt " |
| 344 |
"file, as described :ref:`above <import_name_txt>`. We shall name the file " |
| 345 |
"``plugin-import-name-editor_plugin_demo.txt``." |
| 346 |
msgstr "الخطوة الأولى، كما هو الحال مع جميع الإضافات، هي إنشاء ملف txt فارغ لاسم الاستيراد، كما هو موضح :ref:`أعلاه <import_name_txt>`. سنقوم بتسمية الملف ``plugin-import-name-editor_plugin_demo.txt``." |
| 347 |
|
| 348 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:202 |
| 349 |
msgid "" |
| 350 |
"Now we create the mandatory ``__init__.py`` file that contains metadata " |
| 351 |
"about the plugin -- its name, author, version, etc." |
| 352 |
msgstr "الآن نقوم بإنشاء ملف ``__init__.py`` الإلزامي الذي يحتوي على بيانات وصفية حول الإضافة -- اسمها، مؤلفها، إصدارها، إلخ." |
| 353 |
|
| 354 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:208 |
| 355 |
msgid "" |
| 356 |
"A single editor plugin can provide multiple tools each tool corresponds to a" |
| 357 |
" single button in the toolbar and entry in the :guilabel:`Plugins` menu in " |
| 358 |
"the editor. These can have sub-menus in case the tool has multiple related " |
| 359 |
"actions." |
| 360 |
msgstr "يمكن لإضافة محرر واحدة توفير أدوات متعددة، كل أداة تتوافق مع زر واحد في شريط الأدوات ومدخل في قائمة :guilabel:`الإضافات` في المحرر. يمكن أن تحتوي هذه على قوائم فرعية في حال كان للأداة إجراءات متعددة ذات صلة." |
| 361 |
|
| 362 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:212 |
| 363 |
msgid "" |
| 364 |
"The tools must all be defined in the file ``main.py`` in your plugin. Every " |
| 365 |
"tool is a class that inherits from the " |
| 366 |
":class:`calibre.gui2.tweak_book.plugin.Tool` class. Let's look at " |
| 367 |
"``main.py`` from the demo plugin, the source code is heavily commented and " |
| 368 |
"should be self-explanatory. Read the API documents of the " |
| 369 |
":class:`calibre.gui2.tweak_book.plugin.Tool` class for more details." |
| 370 |
msgstr "يجب تعريف جميع الأدوات في ملف ``main.py`` في إضافتك. كل أداة هي فئة ترث من الفئة :class:`calibre.gui2.tweak_book.plugin.Tool`. دعنا نلقي نظرة على ``main.py`` من الإضافة التجريبية، الكود المصدري مشروح بشكل مكثف ويجب أن يكون واضحًا بذاته. اقرأ وثائق API الخاصة بـ :class:`calibre.gui2.tweak_book.plugin.Tool` لمزيد من التفاصيل." |
| 371 |
|
| 372 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:222 |
| 373 |
msgid "" |
| 374 |
"Here we will see the definition of a single tool that will multiply all font" |
| 375 |
" sizes in the book by a number provided by the user. This tool demonstrates " |
| 376 |
"various important concepts that you will need in developing your own " |
| 377 |
"plugins, so you should read the (heavily commented) source code carefully." |
| 378 |
msgstr "هنا سنرى تعريف أداة واحدة ستقوم بضرب جميع أحجام الخطوط في الكتاب برقم يوفره المستخدم. توضح هذه الأداة مفاهيم مهمة مختلفة ستحتاجها في تطوير إضافاتك الخاصة، لذا يجب عليك قراءة الكود المصدري (المشروح بكثافة) بعناية." |
| 379 |
|
| 380 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:230 |
| 381 |
msgid "" |
| 382 |
"Let's break down ``main.py``. We see that it defines a single tool, named " |
| 383 |
"*Magnify fonts*. This tool will ask the user for a number and multiply all " |
| 384 |
"font sizes in the book by that number." |
| 385 |
msgstr "دعنا نحلل ``main.py``. نرى أنه يحدد أداة واحدة، تسمى *تكبير الخطوط*. ستطلب هذه الأداة من المستخدم رقمًا وتضرب جميع أحجام الخطوط في الكتاب بهذا الرقم." |
| 386 |
|
| 387 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:234 |
| 388 |
msgid "" |
| 389 |
"The first important thing is the tool name which you must set to some " |
| 390 |
"relatively unique string as it will be used as the key for this tool." |
| 391 |
msgstr "أول شيء مهم هو اسم الأداة الذي يجب عليك تعيينه إلى سلسلة فريدة نسبيًا حيث سيتم استخدامه كمفتاح لهذه الأداة." |
| 392 |
|
| 393 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:237 |
| 394 |
msgid "" |
| 395 |
"The next important entry point is the " |
| 396 |
":meth:`calibre.gui2.tweak_book.plugin.Tool.create_action`. This method " |
| 397 |
"creates the QAction objects that appear in the plugins toolbar and plugin " |
| 398 |
"menu. It also, optionally, assigns a keyboard shortcut that the user can " |
| 399 |
"customize. The triggered signal from the QAction is connected to the " |
| 400 |
"ask_user() method that asks the user for the font size multiplier, and then " |
| 401 |
"runs the magnification code." |
| 402 |
msgstr "نقطة الدخول المهمة التالية هي :meth:`calibre.gui2.tweak_book.plugin.Tool.create_action`. تنشئ هذه الطريقة كائنات QAction التي تظهر في شريط أدوات الإضافات وقائمة الإضافات. كما أنها، اختياريًا، تعين اختصار لوحة مفاتيح يمكن للمستخدم تخصيصه. يتم توصيل إشارة التشغيل من QAction بطريقة ask_user() التي تطلب من المستخدم مضاعف حجم الخط، ثم تقوم بتشغيل كود التكبير." |
| 403 |
|
| 404 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:245 |
| 405 |
msgid "" |
| 406 |
"The magnification code is well commented and fairly simple. The main things " |
| 407 |
"to note are that you get a reference to the editor window as ``self.gui`` " |
| 408 |
"and the editor *Boss* as ``self.boss``. The *Boss* is the object that " |
| 409 |
"controls the editor user interface. It has many useful methods, that are " |
| 410 |
"documented in the :class:`calibre.gui2.tweak_book.boss.Boss` class." |
| 411 |
msgstr "كود التكبير مشروح جيدًا وبسيط إلى حد ما. الأشياء الرئيسية التي يجب ملاحظتها هي أنك تحصل على مرجع إلى نافذة المحرر كـ ``self.gui`` و *مدير* المحرر كـ ``self.boss``. *المدير* هو الكائن الذي يتحكم في واجهة المستخدم للمحرر. يحتوي على العديد من الطرق المفيدة، الموثقة في فئة :class:`calibre.gui2.tweak_book.boss.Boss`." |
| 412 |
|
| 413 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:251 |
| 414 |
msgid "" |
| 415 |
"Finally, there is ``self.current_container`` which is a reference to the " |
| 416 |
"book being edited as a " |
| 417 |
":class:`calibre.ebooks.oeb.polish.container.Container` object. This " |
| 418 |
"represents the book as a collection of its constituent HTML/CSS/image files " |
| 419 |
"and has convenience methods for doing many useful things. The container " |
| 420 |
"object and various useful utility functions that can be reused in your " |
| 421 |
"plugin code are documented in :ref:`polish_api`." |
| 422 |
msgstr "أخيرًا، هناك ``self.current_container`` وهو مرجع إلى الكتاب الذي يتم تحريره ككائن :class:`calibre.ebooks.oeb.polish.container.Container`. يمثل هذا الكتاب كمجموعة من ملفات HTML/CSS/الصور المكونة له ويحتوي على طرق ملائمة للقيام بالعديد من الأشياء المفيدة. كائن الحاوية والعديد من وظائف الأداة المساعدة المفيدة التي يمكن إعادة استخدامها في كود الإضافة الخاص بك موثقة في :ref:`polish_api`." |
| 423 |
|
| 424 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:259 |
| 425 |
msgid "Adding translations to your plugin" |
| 426 |
msgstr "إضافة ترجمات إلى إضافتك" |
| 427 |
|
| 428 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:261 |
| 429 |
msgid "" |
| 430 |
"You can have all the user interface strings in your plugin translated and " |
| 431 |
"displayed in whatever language is set for the main calibre user interface." |
| 432 |
msgstr "يمكنك ترجمة جميع سلاسل واجهة المستخدم في إضافتك وعرضها بأي لغة تم تعيينها لواجهة المستخدم الرئيسية لـ calibre." |
| 433 |
|
| 434 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:264 |
| 435 |
msgid "" |
| 436 |
"The first step is to go through your plugin's source code and mark all user " |
| 437 |
"visible strings as translatable, by surrounding them in _(). For example::" |
| 438 |
msgstr "الخطوة الأولى هي مراجعة الكود المصدري لإضافتك ووضع علامة على جميع السلاسل المرئية للمستخدم كقابلة للترجمة، عن طريق إحاطتها بـ _(). على سبيل المثال::" |
| 439 |
|
| 440 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:269 |
| 441 |
msgid "" |
| 442 |
"Then use some program to generate .po files from your plugin source code. " |
| 443 |
"There should be one .po file for every language you want to translate into. " |
| 444 |
"For example: de.po for German, fr.po for French and so on. You can use the " |
| 445 |
"`Poedit <https://poedit.net/>`_ program for this." |
| 446 |
msgstr "ثم استخدم برنامجًا لإنشاء ملفات .po من الكود المصدري لإضافتك. يجب أن يكون هناك ملف .po واحد لكل لغة تريد الترجمة إليها. على سبيل المثال: de.po للألمانية، fr.po للفرنسية وهكذا. يمكنك استخدام برنامج `Poedit <https://poedit.net/>`_ لهذا الغرض." |
| 447 |
|
| 448 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:274 |
| 449 |
msgid "" |
| 450 |
"Send these .po files to your translators. Once you get them back, compile " |
| 451 |
"them into .mo files. You can again use Poedit for that, or just do::" |
| 452 |
msgstr "أرسل ملفات .po هذه إلى مترجميك. بمجرد استعادتها، قم بتجميعها إلى ملفات .mo. يمكنك مرة أخرى استخدام Poedit لذلك، أو ببساطة قم بـ::" |
| 453 |
|
| 454 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:279 |
| 455 |
msgid "Put the .mo files into the ``translations`` folder in your plugin." |
| 456 |
msgstr "ضع ملفات .mo في مجلد ``translations`` في إضافتك." |
| 457 |
|
| 458 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:281 |
| 459 |
msgid "" |
| 460 |
"The last step is to simply call the function `load_translations()` at the " |
| 461 |
"top of your plugin's .py files. For performance reasons you should only call" |
| 462 |
" this function in those .py files that actually have translatable strings. " |
| 463 |
"So in a typical User Interface plugin you would call it at the top of " |
| 464 |
"``ui.py`` but not ``__init__.py``." |
| 465 |
msgstr "الخطوة الأخيرة هي ببساطة استدعاء الدالة `load_translations()` في أعلى ملفات .py لإضافتك. لأسباب تتعلق بالأداء، يجب عليك استدعاء هذه الدالة فقط في ملفات .py التي تحتوي بالفعل على سلاسل قابلة للترجمة. لذلك في إضافة واجهة مستخدم نموذجية، ستستدعيها في أعلى ``ui.py`` ولكن ليس ``__init__.py``." |
| 466 |
|
| 467 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:287 |
| 468 |
msgid "" |
| 469 |
"You can test the translations of your plugins by changing the user interface" |
| 470 |
" language in calibre under :guilabel:`Preferences->Interface->Look & feel` " |
| 471 |
"or by running calibre with the ``CALIBRE_OVERRIDE_LANG`` environment " |
| 472 |
"variable set. For example::" |
| 473 |
msgstr "يمكنك اختبار ترجمات إضافاتك عن طريق تغيير لغة واجهة المستخدم في calibre ضمن :guilabel:`التفضيلات->الواجهة->المظهر والإحساس` أو عن طريق تشغيل calibre مع تعيين متغير البيئة ``CALIBRE_OVERRIDE_LANG``. على سبيل المثال::" |
| 474 |
|
| 475 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:293 |
| 476 |
msgid "" |
| 477 |
"Replace ``de`` with the language code of the language you want to test." |
| 478 |
msgstr "استبدل ``de`` برمز اللغة التي تريد اختبارها." |
| 479 |
|
| 480 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:295 |
| 481 |
msgid "" |
| 482 |
"For translations with plurals, use the ``ngettext()`` function instead of " |
| 483 |
"``_()``. For example::" |
| 484 |
msgstr "بالنسبة للترجمات التي تحتوي على صيغ الجمع، استخدم الدالة ``ngettext()`` بدلاً من ``_()``. على سبيل المثال::" |
| 485 |
|
| 486 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:301 |
| 487 |
msgid "The plugin API" |
| 488 |
msgstr "واجهة برمجة تطبيقات الإضافات" |
| 489 |
|
| 490 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:303 |
| 491 |
msgid "" |
| 492 |
"As you may have noticed above, a plugin in calibre is a class. There are " |
| 493 |
"different classes for the different types of plugins in calibre. Details on " |
| 494 |
"each class, including the base class of all plugins can be found in " |
| 495 |
":ref:`plugins`." |
| 496 |
msgstr "كما لاحظت أعلاه، الإضافة في calibre هي فئة. توجد فئات مختلفة لأنواع الإضافات المختلفة في calibre. يمكن العثور على التفاصيل حول كل فئة، بما في ذلك الفئة الأساسية لجميع الإضافات، في :ref:`plugins`." |
| 497 |
|
| 498 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:306 |
| 499 |
msgid "" |
| 500 |
"Your plugin is almost certainly going to use code from calibre. To learn how" |
| 501 |
" to find various bits of functionality in the calibre code base, read the " |
| 502 |
"section on the calibre :ref:`code_layout`." |
| 503 |
msgstr "من المؤكد أن إضافتك ستستخدم كود من calibre. لمعرفة كيفية العثور على أجزاء مختلفة من الوظائف في قاعدة كود calibre، اقرأ القسم الخاص بـ :ref:`code_layout` في calibre." |
| 504 |
|
| 505 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:311 |
| 506 |
msgid "Debugging plugins" |
| 507 |
msgstr "تصحيح أخطاء الإضافات" |
| 508 |
|
| 509 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:313 |
| 510 |
msgid "" |
| 511 |
"The first, most important step is to run calibre in debug mode. You can do " |
| 512 |
"this from the command line with::" |
| 513 |
msgstr "الخطوة الأولى والأكثر أهمية هي تشغيل calibre في وضع التصحيح. يمكنك القيام بذلك من سطر الأوامر باستخدام::" |
| 514 |
|
| 515 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:317 |
| 516 |
msgid "" |
| 517 |
"Or from within calibre by right-clicking the :guilabel:`Preferences` button " |
| 518 |
"or using the :kbd:`Ctrl+Shift+R` keyboard shortcut." |
| 519 |
msgstr "أو من داخل calibre بالنقر بزر الفأرة الأيمن على زر :guilabel:`التفضيلات` أو باستخدام اختصار لوحة المفاتيح :kbd:`Ctrl+Shift+R`." |
| 520 |
|
| 521 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:319 |
| 522 |
msgid "" |
| 523 |
"When running from the command line, debug output will be printed to the " |
| 524 |
"console, when running from within calibre the output will go to a txt file." |
| 525 |
msgstr "عند التشغيل من سطر الأوامر، سيتم طباعة إخراج التصحيح إلى وحدة التحكم، عند التشغيل من داخل calibre، سيذهب الإخراج إلى ملف txt." |
| 526 |
|
| 527 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:321 |
| 528 |
msgid "" |
| 529 |
"You can insert print statements anywhere in your plugin code, they will be " |
| 530 |
"output in debug mode. Remember, this is Python, you really shouldn't need " |
| 531 |
"anything more than print statements to debug ;) I developed all of calibre " |
| 532 |
"using just this debugging technique." |
| 533 |
msgstr "يمكنك إدراج عبارات الطباعة في أي مكان في كود إضافتك، وسيتم إخراجها في وضع التصحيح. تذكر، هذه بايثون، لا يجب أن تحتاج أكثر من عبارات الطباعة للتصحيح ;) لقد طورت calibre بالكامل باستخدام تقنية التصحيح هذه فقط." |
| 534 |
|
| 535 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:323 |
| 536 |
msgid "" |
| 537 |
"You can quickly test changes to your plugin by using the following command " |
| 538 |
"line::" |
| 539 |
msgstr "يمكنك اختبار التغييرات على إضافتك بسرعة باستخدام سطر الأوامر التالي::" |
| 540 |
|
| 541 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:328 |
| 542 |
msgid "" |
| 543 |
"This will shutdown a running calibre, wait for the shutdown to complete, " |
| 544 |
"then update your plugin in calibre and relaunch calibre." |
| 545 |
msgstr "سيؤدي هذا إلى إيقاف تشغيل calibre قيد التشغيل، والانتظار حتى يكتمل الإغلاق، ثم تحديث إضافتك في calibre وإعادة تشغيل calibre." |
| 546 |
|
| 547 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:331 |
| 548 |
msgid "More plugin examples" |
| 549 |
msgstr "المزيد من أمثلة الإضافات" |
| 550 |
|
| 551 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:333 |
| 552 |
msgid "" |
| 553 |
"You can find a list of many sophisticated calibre plugins `here " |
| 554 |
"<https://www.mobileread.com/forums/showthread.php?t=118764>`_." |
| 555 |
msgstr "يمكنك العثور على قائمة بالعديد من إضافات calibre المتطورة `هنا <https://www.mobileread.com/forums/showthread.php?t=118764>`_." |
| 556 |
|
| 557 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:336 |
| 558 |
msgid "Sharing your plugins with others" |
| 559 |
msgstr "مشاركة إضافاتك مع الآخرين" |
| 560 |
|
| 561 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:338 |
| 562 |
msgid "" |
| 563 |
"If you would like to share the plugins you have created with other users of " |
| 564 |
"calibre, post your plugin in a new thread in the `calibre plugins forum " |
| 565 |
"<https://www.mobileread.com/forums/forumdisplay.php?f=237>`_." |
| 566 |
msgstr "إذا كنت ترغب في مشاركة الإضافات التي أنشأتها مع مستخدمي calibre الآخرين، فانشر إضافتك في موضوع جديد في `منتدى إضافات calibre <https://www.mobileread.com/forums/forumdisplay.php?f=237>`_." |