# SOME DESCRIPTIVE TITLE.
# Copyright (C) Kovid Goyal
# This file is distributed under the same license as the calibre package.
# 
# Translators:
msgid ""
msgstr ""
"Project-Id-Version: calibre\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-01-27 09:16+0530\n"
"PO-Revision-Date: 2017-01-27 03:48+0000\n"
"Last-Translator: Kovid Goyal <kovid@kovidgoyal.net>\n"
"Language-Team: Mongolian (http://www.transifex.com/calibre/calibre/language/mn/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: mn\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"

#: ../../home/kovid/work/calibre/manual/develop.rst:4
msgid "Setting up a calibre development environment"
msgstr ""

#: ../../home/kovid/work/calibre/manual/develop.rst:6
msgid ""
"calibre is completely open source, licensed under the `GNU GPL v3 "
"<https://www.gnu.org/licenses/gpl.html>`_. This means that you are free to "
"download and modify the program to your heart's content. In this section, "
"you will learn how to get a calibre development environment set up on the "
"operating system of your choice. calibre is written primarily in `Python "
"<https://www.python.org>`_ with some C/C++ code for speed and system "
"interfacing. Note that calibre is not compatible with Python 3 and requires "
"at least Python 2.7.9."
msgstr ""

#: ../../home/kovid/work/calibre/manual/develop.rst:0
msgid "Contents"
msgstr ""

#: ../../home/kovid/work/calibre/manual/develop.rst:17
msgid "Design philosophy"
msgstr ""

#: ../../home/kovid/work/calibre/manual/develop.rst:19
msgid ""
"calibre has its roots in the Unix world, which means that its design is "
"highly modular. The modules interact with each other via well defined "
"interfaces. This makes adding new features and fixing bugs in calibre very "
"easy, resulting in a frenetic pace of development. Because of its roots, "
"calibre has a comprehensive command line interface for all its functions, "
"documented in :doc:`generated/en/cli-index`."
msgstr ""

#: ../../home/kovid/work/calibre/manual/develop.rst:24
msgid ""
"The modular design of calibre is expressed via ``Plugins``. There is a "
":ref:`tutorial <customize>` on writing calibre plugins. For example, adding "
"support for a new device to calibre typically involves writing less than a "
"100 lines of code in the form of a device driver plugin. You can browse the "
"`built-in drivers "
"<https://github.com/kovidgoyal/calibre/tree/master/src/calibre/devices>`_. "
"Similarly, adding support for new conversion formats involves writing "
"input/output format plugins. Another example of the modular design is the "
":ref:`recipe system <news>` for fetching news. For more examples of plugins "
"designed to add features to calibre, see the `plugin index "
"<https://www.mobileread.com/forums/showthread.php?p=1362767#post1362767>`_."
msgstr ""

#: ../../home/kovid/work/calibre/manual/develop.rst:34
msgid "Code layout"
msgstr ""

#: ../../home/kovid/work/calibre/manual/develop.rst:36
msgid ""
"All the calibre python code is in the ``calibre`` package. This package "
"contains the following main sub-packages"
msgstr ""

#: ../../home/kovid/work/calibre/manual/develop.rst:38
msgid ""
"devices - All the device drivers. Just look through some of the built-in "
"drivers to get an idea for how they work."
msgstr ""

#: ../../home/kovid/work/calibre/manual/develop.rst:40
msgid ""
"For details, see: ``devices.interface`` which defines the interface "
"supported by device drivers and ``devices.usbms`` which defines a generic "
"driver that connects to a USBMS device. All USBMS based drivers in calibre "
"inherit from it."
msgstr ""

#: ../../home/kovid/work/calibre/manual/develop.rst:43
msgid ""
"ebooks  - All the ebook conversion/metadata code. A good starting point is "
"``calibre.ebooks.conversion.cli`` which is the module powering the :command"
":`ebook-convert` command. The conversion process is controlled via "
"``conversion.plumber``. The format independent code is all in ``ebooks.oeb``"
" and the format dependent code is in ``ebooks.format_name``."
msgstr ""

#: ../../home/kovid/work/calibre/manual/develop.rst:47
msgid ""
"Metadata reading, writing, and downloading is all in ``ebooks.metadata``"
msgstr ""

#: ../../home/kovid/work/calibre/manual/develop.rst:48
msgid ""
"Conversion happens in a pipeline, for the structure of the pipeline, see "
":ref:`conversion-introduction`. The pipeline consists of an input plugin, "
"various transforms and an output plugin. The code that constructs and drives"
" the pipeline is in :file:`plumber.py`. The pipeline works on a "
"representation of an ebook that is like an unzipped epub, with manifest, "
"spine, toc, guide, html content, etc. The class that manages this "
"representation is OEBBook in ``ebooks.oeb.base``. The various "
"transformations that are applied to the book during conversions live in "
":file:`oeb/transforms/*.py`. And the input and output plugins live in "
":file:`conversion/plugins/*.py`."
msgstr ""

#: ../../home/kovid/work/calibre/manual/develop.rst:58
msgid ""
"Ebook editing happens using a different container object. It is documented "
"in :ref:`polish_api`."
msgstr ""

#: ../../home/kovid/work/calibre/manual/develop.rst:61
msgid ""
"db - The database back-end. See :ref:`db_api` for the interface to the "
"calibre library."
msgstr ""

#: ../../home/kovid/work/calibre/manual/develop.rst:63
msgid "content server: ``library.server`` is the calibre Content Server."
msgstr ""

#: ../../home/kovid/work/calibre/manual/develop.rst:65
msgid ""
"gui2 - The Graphical User Interface. GUI initialization happens in "
"``gui2.main`` and ``gui2.ui``. The ebook-viewer is in ``gui2.viewer``. The "
"ebook editor is in ``gui2.tweak_book``."
msgstr ""

#: ../../home/kovid/work/calibre/manual/develop.rst:67
msgid ""
"If you want to locate the entry points for all the various calibre "
"executables, look at the ``entry_points`` structure in `linux.py "
"<https://github.com/kovidgoyal/calibre/blob/master/src/calibre/linux.py>`_."
msgstr ""

#: ../../home/kovid/work/calibre/manual/develop.rst:71
msgid ""
"If you need help understanding the code, post in the `development forum "
"<https://www.mobileread.com/forums/forumdisplay.php?f=240>`_ and you will "
"most likely get help from one of calibre's many developers."
msgstr ""

#: ../../home/kovid/work/calibre/manual/develop.rst:75
msgid "Getting the code"
msgstr ""

#: ../../home/kovid/work/calibre/manual/develop.rst:77
msgid ""
"You can get the calibre source code in two ways, using a version control "
"system or directly downloading a `tarball <https://calibre-"
"ebook.com/dist/src>`_."
msgstr ""

#: ../../home/kovid/work/calibre/manual/develop.rst:80
msgid ""
"calibre uses `Git <https://www.git-scm.com/>`_, a distributed version "
"control system. Git is available on all the platforms calibre supports.  "
"After installing Git, you can get the calibre source code with the command::"
msgstr ""

#: ../../home/kovid/work/calibre/manual/develop.rst:86
msgid ""
"On Windows you will need the complete path name, that will be something like"
" :file:`C:\\\\Program Files\\\\Git\\\\git.exe`."
msgstr ""

#: ../../home/kovid/work/calibre/manual/develop.rst:88
msgid ""
"calibre is a very large project with a very long source control history, so "
"the above can take a while (10 mins to an hour depending on your internet "
"speed)."
msgstr ""

#: ../../home/kovid/work/calibre/manual/develop.rst:91
msgid ""
"If you want to get the code faster, the source code for the latest release "
"is always available as an `archive <https://calibre-ebook.com/dist/src>`_."
msgstr ""

#: ../../home/kovid/work/calibre/manual/develop.rst:94
msgid "To update a branch to the latest code, use the command::"
msgstr ""

#: ../../home/kovid/work/calibre/manual/develop.rst:99
msgid "Submitting your changes to be included"
msgstr ""

#: ../../home/kovid/work/calibre/manual/develop.rst:101
msgid ""
"If you only plan to make a few small changes, you can make your changes and "
"create a \"merge directive\" which you can then attach to a ticket in the "
"calibre `bug tracker <https://bugs.launchpad.net/calibre>`_. To do this, "
"make your changes, then run::"
msgstr ""

#: ../../home/kovid/work/calibre/manual/develop.rst:109
msgid ""
"This will create a :file:`my-changes` file in the current directory, simply "
"attach that to a ticket on the calibre `bug tracker "
"<https://bugs.launchpad.net/calibre>`_. Note that this will include *all* "
"the commits you have made. If you only want to send some commits, you have "
"to change ``origin/master`` above. To send only the last commit, use::"
msgstr ""

#: ../../home/kovid/work/calibre/manual/develop.rst:117
msgid ""
"To send the last *n* commits, replace *1* with *n*, for example, for the "
"last 3 commits::"
msgstr ""

#: ../../home/kovid/work/calibre/manual/develop.rst:122
msgid "Be careful to not include merges when using ``HEAD~n``."
msgstr ""

#: ../../home/kovid/work/calibre/manual/develop.rst:124
msgid ""
"If you plan to do a lot of development on calibre, then the best method is "
"to create a `GitHub <https://github.com>`_ account. Below is a basic guide "
"to setting up your own fork of calibre in a way that will allow you to "
"submit pull requests for inclusion into the main calibre repository:"
msgstr ""

#: ../../home/kovid/work/calibre/manual/develop.rst:129
msgid ""
"Setup git on your machine as described in this article: `Setup Git "
"<https://help.github.com/articles/set-up-git>`_"
msgstr ""

#: ../../home/kovid/work/calibre/manual/develop.rst:130
msgid ""
"Setup ssh keys for authentication to GitHub, as described here: `Generating "
"SSH keys <https://help.github.com/articles/generating-ssh-keys>`_"
msgstr ""

#: ../../home/kovid/work/calibre/manual/develop.rst:131
msgid ""
"Go to https://github.com/kovidgoyal/calibre and click the :guilabel:`Fork` "
"button."
msgstr ""

#: ../../home/kovid/work/calibre/manual/develop.rst:132
msgid "In a Terminal do::"
msgstr ""

#: ../../home/kovid/work/calibre/manual/develop.rst:137
msgid ""
"Replace <username> above with your github username. That will get your fork "
"checked out locally."
msgstr ""

#: ../../home/kovid/work/calibre/manual/develop.rst:138
msgid ""
"You can make changes and commit them whenever you like. When you are ready "
"to have your work merged, do a::"
msgstr ""

#: ../../home/kovid/work/calibre/manual/develop.rst:142
msgid ""
"and go to ``https://github.com/<username>/calibre`` and click the "
":guilabel:`Pull Request` button to generate a pull request that can be "
"merged."
msgstr ""

#: ../../home/kovid/work/calibre/manual/develop.rst:143
msgid ""
"You can update your local copy with code from the main repo at any time by "
"doing::"
msgstr ""

#: ../../home/kovid/work/calibre/manual/develop.rst:148
msgid ""
"You should also keep an eye on the calibre `development forum "
"<https://www.mobileread.com/forums/forumdisplay.php?f=240>`_. Before making "
"major changes, you should discuss them in the forum or contact Kovid "
"directly (his email address is all over the source code)."
msgstr ""

#: ../../home/kovid/work/calibre/manual/develop.rst:154
msgid "Windows development environment"
msgstr ""

#: ../../home/kovid/work/calibre/manual/develop.rst:156
#: ../../home/kovid/work/calibre/manual/develop.rst:190
#: ../../home/kovid/work/calibre/manual/develop.rst:222
msgid ""
"You must also get the calibre source code separately as described above."
msgstr ""

#: ../../home/kovid/work/calibre/manual/develop.rst:158
msgid ""
"Install calibre normally, using the Windows installer. Then open a Command "
"Prompt and change to the previously checked out calibre code directory. For "
"example::"
msgstr ""

#: ../../home/kovid/work/calibre/manual/develop.rst:163
#: ../../home/kovid/work/calibre/manual/develop.rst:234
msgid ""
"calibre is the directory that contains the src and resources sub-"
"directories."
msgstr ""

#: ../../home/kovid/work/calibre/manual/develop.rst:165
msgid ""
"The next step is to set the environment variable ``CALIBRE_DEVELOP_FROM`` to"
" the absolute path of the src directory. So, following the example above, it"
" would be ``C:\\Users\\kovid\\work\\calibre\\src``. `Here is a short guide "
"<https://docs.python.org/2/using/windows.html#excursus-setting-environment-"
"variables>`_ to setting environment variables on Windows."
msgstr ""

#: ../../home/kovid/work/calibre/manual/develop.rst:170
msgid ""
"Once you have set the environment variable, open a new command prompt and "
"check that it was correctly set by using the command::"
msgstr ""

#: ../../home/kovid/work/calibre/manual/develop.rst:175
#: ../../home/kovid/work/calibre/manual/develop.rst:245
msgid ""
"Setting this environment variable means that calibre will now load all its "
"Python code from the specified location."
msgstr ""

#: ../../home/kovid/work/calibre/manual/develop.rst:177
msgid ""
"That's it! You are now ready to start hacking on the calibre code. For "
"example, open the file :file:`src\\\\calibre\\\\__init__.py` in your "
"favorite editor and add the line::"
msgstr ""

#: ../../home/kovid/work/calibre/manual/develop.rst:182
#: ../../home/kovid/work/calibre/manual/develop.rst:252
msgid ""
"near the top of the file. Now run the command :command:`calibredb`. The very"
" first line of output should be ``Hello, world!``."
msgstr ""

#: ../../home/kovid/work/calibre/manual/develop.rst:184
msgid ""
"You can also setup a calibre development environment inside the free "
"Microsoft Visual Studio, if you like, following the instructions `here "
"<https://www.mobileread.com/forums/showthread.php?t=251201>`_."
msgstr ""

#: ../../home/kovid/work/calibre/manual/develop.rst:188
msgid "OS X development environment"
msgstr ""

#: ../../home/kovid/work/calibre/manual/develop.rst:192
msgid ""
"Install calibre normally using the provided .dmg. Then open a Terminal and "
"change to the previously checked out calibre code directory, for example::"
msgstr ""

#: ../../home/kovid/work/calibre/manual/develop.rst:197
msgid ""
"calibre is the directory that contains the src and resources sub-"
"directories. Ensure you have installed the calibre commandline tools via "
":guilabel:`Preferences->Advanced->Miscellaneous` in the calibre GUI."
msgstr ""

#: ../../home/kovid/work/calibre/manual/develop.rst:199
msgid ""
"The next step is to create a bash script that will set the environment "
"variable ``CALIBRE_DEVELOP_FROM`` to the absolute path of the src directory "
"when running calibre in debug mode."
msgstr ""

#: ../../home/kovid/work/calibre/manual/develop.rst:201
msgid "Create a plain text file::"
msgstr ""

#: ../../home/kovid/work/calibre/manual/develop.rst:207
msgid ""
"Save this file as ``/usr/bin/calibre-develop``, then set its permissions so "
"that it can be executed::"
msgstr ""

#: ../../home/kovid/work/calibre/manual/develop.rst:211
msgid "Once you have done this, run::"
msgstr ""

#: ../../home/kovid/work/calibre/manual/develop.rst:215
msgid ""
"You should see some diagnostic information in the Terminal window as calibre"
" starts up, and you should see an asterisk after the version number in the "
"GUI window, indicating that you are running from source."
msgstr ""

#: ../../home/kovid/work/calibre/manual/develop.rst:220
msgid "Linux development environment"
msgstr ""

#: ../../home/kovid/work/calibre/manual/develop.rst:224
msgid ""
"calibre is primarily developed on Linux. You have two choices in setting up "
"the development environment. You can install the calibre binary as normal "
"and use that as a runtime environment to do your development. This approach "
"is similar to that used in Windows and OS X. Alternatively, you can install "
"calibre from source. Instructions for setting up a development environment "
"from source are in the INSTALL file in the source tree. Here we will address"
" using the binary as a runtime, which is the recommended method."
msgstr ""

#: ../../home/kovid/work/calibre/manual/develop.rst:230
msgid ""
"Install calibre using the binary installer. Then open a terminal and change "
"to the previously checked out calibre code directory, for example::"
msgstr ""

#: ../../home/kovid/work/calibre/manual/develop.rst:236
msgid ""
"The next step is to set the environment variable ``CALIBRE_DEVELOP_FROM`` to"
" the absolute path of the src directory. So, following the example above, it"
" would be ``/home/kovid/work/calibre/src``. How to set environment variables"
" depends on your Linux distribution and what shell you are using."
msgstr ""

#: ../../home/kovid/work/calibre/manual/develop.rst:240
msgid ""
"Once you have set the environment variable, open a new terminal and check "
"that it was correctly set by using the command::"
msgstr ""

#: ../../home/kovid/work/calibre/manual/develop.rst:247
msgid ""
"That's it! You are now ready to start hacking on the calibre code. For "
"example, open the file :file:`src/calibre/__init__.py` in your favorite "
"editor and add the line::"
msgstr ""

#: ../../home/kovid/work/calibre/manual/develop.rst:255
msgid ""
"Having separate \"normal\" and \"development\" calibre installs on the same "
"computer"
msgstr ""

#: ../../home/kovid/work/calibre/manual/develop.rst:257
msgid ""
"The calibre source tree is very stable and rarely breaks, but if you feel "
"the need to run from source on a separate test library and run the released "
"calibre version with your everyday library, you can achieve this easily "
"using .bat files or shell scripts to launch calibre. The example below shows"
" how to do this on Windows using .bat files (the instructions for other "
"platforms are the same, just use a shell script instead of a .bat file)"
msgstr ""

#: ../../home/kovid/work/calibre/manual/develop.rst:262
msgid "To launch the release version of calibre with your everyday library:"
msgstr ""

#: ../../home/kovid/work/calibre/manual/develop.rst:264
msgid "calibre-normal.bat::"
msgstr ""

#: ../../home/kovid/work/calibre/manual/develop.rst:268
msgid "calibre-dev.bat::"
msgstr ""

#: ../../home/kovid/work/calibre/manual/develop.rst:275
msgid "Debugging tips"
msgstr ""

#: ../../home/kovid/work/calibre/manual/develop.rst:277
msgid ""
"Python is a dynamically typed language with excellent facilities for "
"introspection. Kovid wrote the core calibre code without once using a "
"debugger. There are many strategies to debug calibre code:"
msgstr ""

#: ../../home/kovid/work/calibre/manual/develop.rst:282
msgid "Using print statements"
msgstr ""

#: ../../home/kovid/work/calibre/manual/develop.rst:284
msgid ""
"This is Kovid's favorite way to debug. Simply insert print statements at "
"points of interest and run your program in the terminal. For example, you "
"can start the GUI from the terminal as::"
msgstr ""

#: ../../home/kovid/work/calibre/manual/develop.rst:289
msgid "Similarly, you can start the ebook-viewer as::"
msgstr ""

#: ../../home/kovid/work/calibre/manual/develop.rst:293
msgid "The ebook-editor can be started as::"
msgstr ""

#: ../../home/kovid/work/calibre/manual/develop.rst:298
msgid "Using an interactive python interpreter"
msgstr ""

#: ../../home/kovid/work/calibre/manual/develop.rst:300
msgid ""
"You can insert the following two lines of code to start an interactive "
"python session at that point::"
msgstr ""

#: ../../home/kovid/work/calibre/manual/develop.rst:305
msgid ""
"When running from the command line, this will start an interactive Python "
"interpreter with access to all locally defined variables (variables in the "
"local scope). The interactive prompt even has TAB completion for object "
"properties and you can use the various Python facilities for introspection, "
"such as :func:`dir`, :func:`type`, :func:`repr`, etc."
msgstr ""

#: ../../home/kovid/work/calibre/manual/develop.rst:311
msgid "Using the python debugger as a remote debugger"
msgstr ""

#: ../../home/kovid/work/calibre/manual/develop.rst:313
msgid ""
"You can use the builtin python debugger (pdb) as a remote debugger from the "
"command line. First, start the remote debugger at the point in the calibre "
"code you are interested in, like this::"
msgstr ""

#: ../../home/kovid/work/calibre/manual/develop.rst:320
msgid ""
"Then run calibre, either as normal, or using one of the calibre-debug "
"commands described in the previous section. Once the above point in the code"
" is reached, calibre will freeze, waiting for the debugger to connect."
msgstr ""

#: ../../home/kovid/work/calibre/manual/develop.rst:324
msgid ""
"Now open a terminal or command prompt and use the following command to start"
" the debugging session::"
msgstr ""

#: ../../home/kovid/work/calibre/manual/develop.rst:329
msgid ""
"You can read about how to use the python debugger in the `python stdlib docs"
" for the pdb module <https://docs.python.org/2/library/pdb.html#debugger-"
"commands>`_."
msgstr ""

#: ../../home/kovid/work/calibre/manual/develop.rst:333
msgid ""
"By default, the remote debugger will try to connect on port 4444. You can "
"change it, by passing the port parameter to both the set_trace() and the "
"cli() functions above, like this: ``set_trace(port=1234)`` and "
"``cli(port=1234)``."
msgstr ""

#: ../../home/kovid/work/calibre/manual/develop.rst:339
msgid ""
"The python debugger cannot handle multiple threads, so you have to call "
"set_trace once per thread, each time with a different port number."
msgstr ""

#: ../../home/kovid/work/calibre/manual/develop.rst:343
msgid "Using the debugger in your favorite python IDE"
msgstr ""

#: ../../home/kovid/work/calibre/manual/develop.rst:345
msgid ""
"It is possible to use the builtin debugger in your favorite python IDE, if "
"it supports remote debugging. The first step is to add the calibre src "
"checkout to the ``PYTHONPATH`` in your IDE. In other words, the directory "
"you set as ``CALIBRE_DEVELOP_FROM`` above, must also be in the "
"``PYTHONPATH`` of your IDE."
msgstr ""

#: ../../home/kovid/work/calibre/manual/develop.rst:350
msgid ""
"Then place the IDE's remote debugger module into the :file:`src` "
"subdirectory of the calibre source code checkout. Add whatever code is "
"needed to launch the remote debugger to calibre at the point of interest, "
"for example in the main function. Then run calibre as normal. Your IDE "
"should now be able to connect to the remote debugger running inside calibre."
msgstr ""

#: ../../home/kovid/work/calibre/manual/develop.rst:357
msgid "Executing arbitrary scripts in the calibre python environment"
msgstr ""

#: ../../home/kovid/work/calibre/manual/develop.rst:359
msgid ""
"The :command:`calibre-debug` command provides a couple of handy switches to "
"execute your own code, with access to the calibre modules::"
msgstr ""

#: ../../home/kovid/work/calibre/manual/develop.rst:364
msgid ""
"is great for testing a little snippet of code on the command line. It works "
"in the same way as the -c switch to the python interpreter::"
msgstr ""

#: ../../home/kovid/work/calibre/manual/develop.rst:368
msgid ""
"can be used to execute your own Python script. It works in the same way as "
"passing the script to the Python interpreter, except that the calibre "
"environment is fully initialized, so you can use all the calibre code in "
"your script. To use command line arguments with your script, use the form::"
msgstr ""

#: ../../home/kovid/work/calibre/manual/develop.rst:373
msgid ""
"The ``--`` causes all subsequent arguments to be passed to your script."
msgstr ""

#: ../../home/kovid/work/calibre/manual/develop.rst:377
msgid "Using calibre in your projects"
msgstr ""

#: ../../home/kovid/work/calibre/manual/develop.rst:379
msgid ""
"It is possible to directly use calibre functions/code in your Python "
"project. Two ways exist to do this:"
msgstr ""

#: ../../home/kovid/work/calibre/manual/develop.rst:382
msgid "Binary install of calibre"
msgstr ""

#: ../../home/kovid/work/calibre/manual/develop.rst:384
msgid ""
"If you have a binary install of calibre, you can use the Python interpreter "
"bundled with calibre, like this::"
msgstr ""

#: ../../home/kovid/work/calibre/manual/develop.rst:389
msgid "Source install on Linux"
msgstr ""

#: ../../home/kovid/work/calibre/manual/develop.rst:391
msgid ""
"In addition to using the above technique, if you do a source install on "
"Linux, you can also directly import calibre, as follows::"
msgstr ""

#: ../../home/kovid/work/calibre/manual/develop.rst:399
msgid ""
"It is essential that you import the init_calibre module before any other "
"calibre modules/packages as it sets up the interpreter to run calibre code."
msgstr ""

#: ../../home/kovid/work/calibre/manual/develop.rst:403
msgid "API documentation for various parts of calibre"
msgstr ""
