{"parents": [], "prev": {"link": "../installation/", "title": "Installation guide"}, "next": {"link": "../contributing/", "title": "Contributing to polib"}, "title": "polib API", "meta": null, "body": "<section id=\"polib-api\">\n<span id=\"api\"></span><h1>polib API<a class=\"headerlink\" href=\"#polib-api\" title=\"Link to this heading\">\u00b6</a></h1>\n<section id=\"the-pofile-function\">\n<h2>The <code class=\"docutils literal notranslate\"><span class=\"pre\">pofile</span></code> function<a class=\"headerlink\" href=\"#the-pofile-function\" title=\"Link to this heading\">\u00b6</a></h2>\n<dl class=\"py function\">\n<dt class=\"sig sig-object py\" id=\"polib.pofile\">\n<span class=\"sig-prename descclassname\"><span class=\"pre\">polib.</span></span><span class=\"sig-name descname\"><span class=\"pre\">pofile</span></span><span class=\"sig-paren\">(</span><em class=\"sig-param\"><span class=\"n\"><span class=\"pre\">pofile</span></span></em>, <em class=\"sig-param\"><span class=\"o\"><span class=\"pre\">**</span></span><span class=\"n\"><span class=\"pre\">kwargs</span></span></em><span class=\"sig-paren\">)</span><a class=\"reference internal\" href=\"../_modules/polib/#pofile\"><span class=\"viewcode-link\"><span class=\"pre\">[source]</span></span></a><a class=\"headerlink\" href=\"#polib.pofile\" title=\"Link to this definition\">\u00b6</a></dt>\n<dd><p>Convenience function that parses the po or pot file <code class=\"docutils literal notranslate\"><span class=\"pre\">pofile</span></code> and returns\na <a class=\"reference internal\" href=\"#polib.POFile\" title=\"polib.POFile\"><code class=\"xref py py-class docutils literal notranslate\"><span class=\"pre\">POFile</span></code></a> instance.</p>\n<p>Arguments:</p>\n<dl class=\"simple\">\n<dt><code class=\"docutils literal notranslate\"><span class=\"pre\">pofile</span></code></dt><dd><p>string, full or relative path to the po/pot file or its content (data).</p>\n</dd>\n<dt><code class=\"docutils literal notranslate\"><span class=\"pre\">wrapwidth</span></code></dt><dd><p>integer, the wrap width, only useful when the <code class=\"docutils literal notranslate\"><span class=\"pre\">-w</span></code> option was passed\nto xgettext (optional, default: <code class=\"docutils literal notranslate\"><span class=\"pre\">78</span></code>).</p>\n</dd>\n<dt><code class=\"docutils literal notranslate\"><span class=\"pre\">encoding</span></code></dt><dd><p>string, the encoding to use (e.g. \u201cutf-8\u201d) (default: <code class=\"docutils literal notranslate\"><span class=\"pre\">None</span></code>, the\nencoding will be auto-detected).</p>\n</dd>\n<dt><code class=\"docutils literal notranslate\"><span class=\"pre\">check_for_duplicates</span></code></dt><dd><p>whether to check for duplicate entries when adding entries to the\nfile (optional, default: <code class=\"docutils literal notranslate\"><span class=\"pre\">False</span></code>).</p>\n</dd>\n<dt><code class=\"docutils literal notranslate\"><span class=\"pre\">klass</span></code></dt><dd><p>class which is used to instantiate the return value (optional,\ndefault: <code class=\"docutils literal notranslate\"><span class=\"pre\">None</span></code>, the return value with be a <a class=\"reference internal\" href=\"#polib.POFile\" title=\"polib.POFile\"><code class=\"xref py py-class docutils literal notranslate\"><span class=\"pre\">POFile</span></code></a>\ninstance).</p>\n</dd>\n</dl>\n</dd></dl>\n\n</section>\n<section id=\"the-mofile-function\">\n<h2>The <code class=\"docutils literal notranslate\"><span class=\"pre\">mofile</span></code> function<a class=\"headerlink\" href=\"#the-mofile-function\" title=\"Link to this heading\">\u00b6</a></h2>\n<dl class=\"py function\">\n<dt class=\"sig sig-object py\" id=\"polib.mofile\">\n<span class=\"sig-prename descclassname\"><span class=\"pre\">polib.</span></span><span class=\"sig-name descname\"><span class=\"pre\">mofile</span></span><span class=\"sig-paren\">(</span><em class=\"sig-param\"><span class=\"n\"><span class=\"pre\">mofile</span></span></em>, <em class=\"sig-param\"><span class=\"o\"><span class=\"pre\">**</span></span><span class=\"n\"><span class=\"pre\">kwargs</span></span></em><span class=\"sig-paren\">)</span><a class=\"reference internal\" href=\"../_modules/polib/#mofile\"><span class=\"viewcode-link\"><span class=\"pre\">[source]</span></span></a><a class=\"headerlink\" href=\"#polib.mofile\" title=\"Link to this definition\">\u00b6</a></dt>\n<dd><p>Convenience function that parses the mo file <code class=\"docutils literal notranslate\"><span class=\"pre\">mofile</span></code> and returns a\n<a class=\"reference internal\" href=\"#polib.MOFile\" title=\"polib.MOFile\"><code class=\"xref py py-class docutils literal notranslate\"><span class=\"pre\">MOFile</span></code></a> instance.</p>\n<p>Arguments:</p>\n<dl class=\"simple\">\n<dt><code class=\"docutils literal notranslate\"><span class=\"pre\">mofile</span></code></dt><dd><p>string, full or relative path to the mo file or its content (string\nor bytes).</p>\n</dd>\n<dt><code class=\"docutils literal notranslate\"><span class=\"pre\">wrapwidth</span></code></dt><dd><p>integer, the wrap width, only useful when the <code class=\"docutils literal notranslate\"><span class=\"pre\">-w</span></code> option was passed\nto xgettext to generate the po file that was used to format the mo file\n(optional, default: <code class=\"docutils literal notranslate\"><span class=\"pre\">78</span></code>).</p>\n</dd>\n<dt><code class=\"docutils literal notranslate\"><span class=\"pre\">encoding</span></code></dt><dd><p>string, the encoding to use (e.g. \u201cutf-8\u201d) (default: <code class=\"docutils literal notranslate\"><span class=\"pre\">None</span></code>, the\nencoding will be auto-detected).</p>\n</dd>\n<dt><code class=\"docutils literal notranslate\"><span class=\"pre\">check_for_duplicates</span></code></dt><dd><p>whether to check for duplicate entries when adding entries to the\nfile (optional, default: <code class=\"docutils literal notranslate\"><span class=\"pre\">False</span></code>).</p>\n</dd>\n<dt><code class=\"docutils literal notranslate\"><span class=\"pre\">klass</span></code></dt><dd><p>class which is used to instantiate the return value (optional,\ndefault: <code class=\"docutils literal notranslate\"><span class=\"pre\">None</span></code>, the return value with be a <a class=\"reference internal\" href=\"#polib.POFile\" title=\"polib.POFile\"><code class=\"xref py py-class docutils literal notranslate\"><span class=\"pre\">POFile</span></code></a>\ninstance).</p>\n</dd>\n</dl>\n</dd></dl>\n\n</section>\n<section id=\"the-detect-encoding-function\">\n<h2>The <code class=\"docutils literal notranslate\"><span class=\"pre\">detect_encoding</span></code> function<a class=\"headerlink\" href=\"#the-detect-encoding-function\" title=\"Link to this heading\">\u00b6</a></h2>\n<dl class=\"py function\">\n<dt class=\"sig sig-object py\" id=\"polib.detect_encoding\">\n<span class=\"sig-prename descclassname\"><span class=\"pre\">polib.</span></span><span class=\"sig-name descname\"><span class=\"pre\">detect_encoding</span></span><span class=\"sig-paren\">(</span><em class=\"sig-param\"><span class=\"n\"><span class=\"pre\">file</span></span></em>, <em class=\"sig-param\"><span class=\"n\"><span class=\"pre\">binary_mode</span></span><span class=\"o\"><span class=\"pre\">=</span></span><span class=\"default_value\"><span class=\"pre\">False</span></span></em><span class=\"sig-paren\">)</span><a class=\"reference internal\" href=\"../_modules/polib/#detect_encoding\"><span class=\"viewcode-link\"><span class=\"pre\">[source]</span></span></a><a class=\"headerlink\" href=\"#polib.detect_encoding\" title=\"Link to this definition\">\u00b6</a></dt>\n<dd><p>Try to detect the encoding used by the <code class=\"docutils literal notranslate\"><span class=\"pre\">file</span></code>. The <code class=\"docutils literal notranslate\"><span class=\"pre\">file</span></code> argument can\nbe a PO or MO file path or a string containing the contents of the file.\nIf the encoding cannot be detected, the function will return the value of\n<code class=\"docutils literal notranslate\"><span class=\"pre\">default_encoding</span></code>.</p>\n<p>Arguments:</p>\n<dl class=\"simple\">\n<dt><code class=\"docutils literal notranslate\"><span class=\"pre\">file</span></code></dt><dd><p>string, full or relative path to the po/mo file or its content.</p>\n</dd>\n<dt><code class=\"docutils literal notranslate\"><span class=\"pre\">binary_mode</span></code></dt><dd><p>boolean, set this to True if <code class=\"docutils literal notranslate\"><span class=\"pre\">file</span></code> is a mo file.</p>\n</dd>\n</dl>\n</dd></dl>\n\n</section>\n<section id=\"the-escape-function\">\n<h2>The <code class=\"docutils literal notranslate\"><span class=\"pre\">escape</span></code> function<a class=\"headerlink\" href=\"#the-escape-function\" title=\"Link to this heading\">\u00b6</a></h2>\n<dl class=\"py function\">\n<dt class=\"sig sig-object py\" id=\"polib.escape\">\n<span class=\"sig-prename descclassname\"><span class=\"pre\">polib.</span></span><span class=\"sig-name descname\"><span class=\"pre\">escape</span></span><span class=\"sig-paren\">(</span><em class=\"sig-param\"><span class=\"n\"><span class=\"pre\">st</span></span></em><span class=\"sig-paren\">)</span><a class=\"reference internal\" href=\"../_modules/polib/#escape\"><span class=\"viewcode-link\"><span class=\"pre\">[source]</span></span></a><a class=\"headerlink\" href=\"#polib.escape\" title=\"Link to this definition\">\u00b6</a></dt>\n<dd><p>Escapes the characters <code class=\"docutils literal notranslate\"><span class=\"pre\">\\\\</span></code>, <code class=\"docutils literal notranslate\"><span class=\"pre\">\\t</span></code>, <code class=\"docutils literal notranslate\"><span class=\"pre\">\\n</span></code>, <code class=\"docutils literal notranslate\"><span class=\"pre\">\\r</span></code>, <code class=\"docutils literal notranslate\"><span class=\"pre\">\\v</span></code>,\n<code class=\"docutils literal notranslate\"><span class=\"pre\">\\b</span></code>, <code class=\"docutils literal notranslate\"><span class=\"pre\">\\f</span></code> and <code class=\"docutils literal notranslate\"><span class=\"pre\">&quot;</span></code> in the given string <code class=\"docutils literal notranslate\"><span class=\"pre\">st</span></code> and returns it.</p>\n</dd></dl>\n\n</section>\n<section id=\"the-unescape-function\">\n<h2>The <code class=\"docutils literal notranslate\"><span class=\"pre\">unescape</span></code> function<a class=\"headerlink\" href=\"#the-unescape-function\" title=\"Link to this heading\">\u00b6</a></h2>\n<dl class=\"py function\">\n<dt class=\"sig sig-object py\" id=\"polib.unescape\">\n<span class=\"sig-prename descclassname\"><span class=\"pre\">polib.</span></span><span class=\"sig-name descname\"><span class=\"pre\">unescape</span></span><span class=\"sig-paren\">(</span><em class=\"sig-param\"><span class=\"n\"><span class=\"pre\">st</span></span></em><span class=\"sig-paren\">)</span><a class=\"reference internal\" href=\"../_modules/polib/#unescape\"><span class=\"viewcode-link\"><span class=\"pre\">[source]</span></span></a><a class=\"headerlink\" href=\"#polib.unescape\" title=\"Link to this definition\">\u00b6</a></dt>\n<dd><p>Unescapes the characters <code class=\"docutils literal notranslate\"><span class=\"pre\">\\\\</span></code>, <code class=\"docutils literal notranslate\"><span class=\"pre\">\\t</span></code>, <code class=\"docutils literal notranslate\"><span class=\"pre\">\\n</span></code>, <code class=\"docutils literal notranslate\"><span class=\"pre\">\\r</span></code>, <code class=\"docutils literal notranslate\"><span class=\"pre\">\\v</span></code>,\n<code class=\"docutils literal notranslate\"><span class=\"pre\">\\b</span></code>, <code class=\"docutils literal notranslate\"><span class=\"pre\">\\f</span></code> and <code class=\"docutils literal notranslate\"><span class=\"pre\">&quot;</span></code> in the given string <code class=\"docutils literal notranslate\"><span class=\"pre\">st</span></code> and returns it.</p>\n</dd></dl>\n\n</section>\n<section id=\"the-pofile-class\">\n<h2>The <code class=\"docutils literal notranslate\"><span class=\"pre\">POFile</span></code> class<a class=\"headerlink\" href=\"#the-pofile-class\" title=\"Link to this heading\">\u00b6</a></h2>\n<dl class=\"py class\">\n<dt class=\"sig sig-object py\" id=\"polib.POFile\">\n<em class=\"property\"><span class=\"pre\">class</span><span class=\"w\"> </span></em><span class=\"sig-prename descclassname\"><span class=\"pre\">polib.</span></span><span class=\"sig-name descname\"><span class=\"pre\">POFile</span></span><span class=\"sig-paren\">(</span><em class=\"sig-param\"><span class=\"o\"><span class=\"pre\">*</span></span><span class=\"n\"><span class=\"pre\">args</span></span></em>, <em class=\"sig-param\"><span class=\"o\"><span class=\"pre\">**</span></span><span class=\"n\"><span class=\"pre\">kwargs</span></span></em><span class=\"sig-paren\">)</span><a class=\"reference internal\" href=\"../_modules/polib/#POFile\"><span class=\"viewcode-link\"><span class=\"pre\">[source]</span></span></a><a class=\"headerlink\" href=\"#polib.POFile\" title=\"Link to this definition\">\u00b6</a></dt>\n<dd><p>Po (or Pot) file reader/writer.\nThis class inherits the <code class=\"xref py py-class docutils literal notranslate\"><span class=\"pre\">_BaseFile</span></code> class and, by extension,\nthe python <code class=\"docutils literal notranslate\"><span class=\"pre\">list</span></code> type.</p>\n<dl class=\"py method\">\n<dt class=\"sig sig-object py\" id=\"polib.POFile.fuzzy_entries\">\n<span class=\"sig-name descname\"><span class=\"pre\">fuzzy_entries</span></span><span class=\"sig-paren\">(</span><span class=\"sig-paren\">)</span><a class=\"reference internal\" href=\"../_modules/polib/#POFile.fuzzy_entries\"><span class=\"viewcode-link\"><span class=\"pre\">[source]</span></span></a><a class=\"headerlink\" href=\"#polib.POFile.fuzzy_entries\" title=\"Link to this definition\">\u00b6</a></dt>\n<dd><p>Convenience method that returns the list of fuzzy entries.</p>\n</dd></dl>\n\n<dl class=\"py method\">\n<dt class=\"sig sig-object py\" id=\"polib.POFile.merge\">\n<span class=\"sig-name descname\"><span class=\"pre\">merge</span></span><span class=\"sig-paren\">(</span><em class=\"sig-param\"><span class=\"n\"><span class=\"pre\">refpot</span></span></em><span class=\"sig-paren\">)</span><a class=\"reference internal\" href=\"../_modules/polib/#POFile.merge\"><span class=\"viewcode-link\"><span class=\"pre\">[source]</span></span></a><a class=\"headerlink\" href=\"#polib.POFile.merge\" title=\"Link to this definition\">\u00b6</a></dt>\n<dd><p>Convenience method that merges the current pofile with the pot file\nprovided. It behaves exactly as the gettext msgmerge utility:</p>\n<ul class=\"simple\">\n<li><p>comments of this file will be preserved, but extracted comments and\noccurrences will be discarded;</p></li>\n<li><p>any translations or comments in the file will be discarded, however,\ndot comments and file positions will be preserved;</p></li>\n<li><p>the fuzzy flags are preserved.</p></li>\n</ul>\n<p>Keyword argument:</p>\n<dl class=\"simple\">\n<dt><code class=\"docutils literal notranslate\"><span class=\"pre\">refpot</span></code></dt><dd><p>object POFile, the reference catalog.</p>\n</dd>\n</dl>\n</dd></dl>\n\n<dl class=\"py method\">\n<dt class=\"sig sig-object py\" id=\"polib.POFile.obsolete_entries\">\n<span class=\"sig-name descname\"><span class=\"pre\">obsolete_entries</span></span><span class=\"sig-paren\">(</span><span class=\"sig-paren\">)</span><a class=\"reference internal\" href=\"../_modules/polib/#POFile.obsolete_entries\"><span class=\"viewcode-link\"><span class=\"pre\">[source]</span></span></a><a class=\"headerlink\" href=\"#polib.POFile.obsolete_entries\" title=\"Link to this definition\">\u00b6</a></dt>\n<dd><p>Convenience method that returns the list of obsolete entries.</p>\n</dd></dl>\n\n<dl class=\"py method\">\n<dt class=\"sig sig-object py\" id=\"polib.POFile.percent_translated\">\n<span class=\"sig-name descname\"><span class=\"pre\">percent_translated</span></span><span class=\"sig-paren\">(</span><span class=\"sig-paren\">)</span><a class=\"reference internal\" href=\"../_modules/polib/#POFile.percent_translated\"><span class=\"viewcode-link\"><span class=\"pre\">[source]</span></span></a><a class=\"headerlink\" href=\"#polib.POFile.percent_translated\" title=\"Link to this definition\">\u00b6</a></dt>\n<dd><p>Convenience method that returns the percentage of translated\nmessages.</p>\n</dd></dl>\n\n<dl class=\"py method\">\n<dt class=\"sig sig-object py\" id=\"polib.POFile.save_as_mofile\">\n<span class=\"sig-name descname\"><span class=\"pre\">save_as_mofile</span></span><span class=\"sig-paren\">(</span><em class=\"sig-param\"><span class=\"n\"><span class=\"pre\">fpath</span></span></em><span class=\"sig-paren\">)</span><a class=\"reference internal\" href=\"../_modules/polib/#POFile.save_as_mofile\"><span class=\"viewcode-link\"><span class=\"pre\">[source]</span></span></a><a class=\"headerlink\" href=\"#polib.POFile.save_as_mofile\" title=\"Link to this definition\">\u00b6</a></dt>\n<dd><p>Saves the binary representation of the file to given <code class=\"docutils literal notranslate\"><span class=\"pre\">fpath</span></code>.</p>\n<p>Keyword argument:</p>\n<dl class=\"simple\">\n<dt><code class=\"docutils literal notranslate\"><span class=\"pre\">fpath</span></code></dt><dd><p>string, full or relative path to the mo file.</p>\n</dd>\n</dl>\n</dd></dl>\n\n<dl class=\"py method\">\n<dt class=\"sig sig-object py\" id=\"polib.POFile.translated_entries\">\n<span class=\"sig-name descname\"><span class=\"pre\">translated_entries</span></span><span class=\"sig-paren\">(</span><span class=\"sig-paren\">)</span><a class=\"reference internal\" href=\"../_modules/polib/#POFile.translated_entries\"><span class=\"viewcode-link\"><span class=\"pre\">[source]</span></span></a><a class=\"headerlink\" href=\"#polib.POFile.translated_entries\" title=\"Link to this definition\">\u00b6</a></dt>\n<dd><p>Convenience method that returns the list of translated entries.</p>\n</dd></dl>\n\n<dl class=\"py method\">\n<dt class=\"sig sig-object py\" id=\"polib.POFile.untranslated_entries\">\n<span class=\"sig-name descname\"><span class=\"pre\">untranslated_entries</span></span><span class=\"sig-paren\">(</span><span class=\"sig-paren\">)</span><a class=\"reference internal\" href=\"../_modules/polib/#POFile.untranslated_entries\"><span class=\"viewcode-link\"><span class=\"pre\">[source]</span></span></a><a class=\"headerlink\" href=\"#polib.POFile.untranslated_entries\" title=\"Link to this definition\">\u00b6</a></dt>\n<dd><p>Convenience method that returns the list of untranslated entries.</p>\n</dd></dl>\n\n</dd></dl>\n\n</section>\n<section id=\"the-mofile-class\">\n<h2>The <code class=\"docutils literal notranslate\"><span class=\"pre\">MOFile</span></code> class<a class=\"headerlink\" href=\"#the-mofile-class\" title=\"Link to this heading\">\u00b6</a></h2>\n<dl class=\"py class\">\n<dt class=\"sig sig-object py\" id=\"polib.MOFile\">\n<em class=\"property\"><span class=\"pre\">class</span><span class=\"w\"> </span></em><span class=\"sig-prename descclassname\"><span class=\"pre\">polib.</span></span><span class=\"sig-name descname\"><span class=\"pre\">MOFile</span></span><span class=\"sig-paren\">(</span><em class=\"sig-param\"><span class=\"o\"><span class=\"pre\">*</span></span><span class=\"n\"><span class=\"pre\">args</span></span></em>, <em class=\"sig-param\"><span class=\"o\"><span class=\"pre\">**</span></span><span class=\"n\"><span class=\"pre\">kwargs</span></span></em><span class=\"sig-paren\">)</span><a class=\"reference internal\" href=\"../_modules/polib/#MOFile\"><span class=\"viewcode-link\"><span class=\"pre\">[source]</span></span></a><a class=\"headerlink\" href=\"#polib.MOFile\" title=\"Link to this definition\">\u00b6</a></dt>\n<dd><p>Mo file reader/writer.\nThis class inherits the <code class=\"xref py py-class docutils literal notranslate\"><span class=\"pre\">_BaseFile</span></code> class and, by\nextension, the python <code class=\"docutils literal notranslate\"><span class=\"pre\">list</span></code> type.</p>\n<dl class=\"py method\">\n<dt class=\"sig sig-object py\" id=\"polib.MOFile.fuzzy_entries\">\n<span class=\"sig-name descname\"><span class=\"pre\">fuzzy_entries</span></span><span class=\"sig-paren\">(</span><span class=\"sig-paren\">)</span><a class=\"reference internal\" href=\"../_modules/polib/#MOFile.fuzzy_entries\"><span class=\"viewcode-link\"><span class=\"pre\">[source]</span></span></a><a class=\"headerlink\" href=\"#polib.MOFile.fuzzy_entries\" title=\"Link to this definition\">\u00b6</a></dt>\n<dd><p>Convenience method to keep the same interface with POFile instances.</p>\n</dd></dl>\n\n<dl class=\"py method\">\n<dt class=\"sig sig-object py\" id=\"polib.MOFile.obsolete_entries\">\n<span class=\"sig-name descname\"><span class=\"pre\">obsolete_entries</span></span><span class=\"sig-paren\">(</span><span class=\"sig-paren\">)</span><a class=\"reference internal\" href=\"../_modules/polib/#MOFile.obsolete_entries\"><span class=\"viewcode-link\"><span class=\"pre\">[source]</span></span></a><a class=\"headerlink\" href=\"#polib.MOFile.obsolete_entries\" title=\"Link to this definition\">\u00b6</a></dt>\n<dd><p>Convenience method to keep the same interface with POFile instances.</p>\n</dd></dl>\n\n<dl class=\"py method\">\n<dt class=\"sig sig-object py\" id=\"polib.MOFile.percent_translated\">\n<span class=\"sig-name descname\"><span class=\"pre\">percent_translated</span></span><span class=\"sig-paren\">(</span><span class=\"sig-paren\">)</span><a class=\"reference internal\" href=\"../_modules/polib/#MOFile.percent_translated\"><span class=\"viewcode-link\"><span class=\"pre\">[source]</span></span></a><a class=\"headerlink\" href=\"#polib.MOFile.percent_translated\" title=\"Link to this definition\">\u00b6</a></dt>\n<dd><p>Convenience method to keep the same interface with POFile instances.</p>\n</dd></dl>\n\n<dl class=\"py method\">\n<dt class=\"sig sig-object py\" id=\"polib.MOFile.save\">\n<span class=\"sig-name descname\"><span class=\"pre\">save</span></span><span class=\"sig-paren\">(</span><em class=\"sig-param\"><span class=\"n\"><span class=\"pre\">fpath</span></span><span class=\"o\"><span class=\"pre\">=</span></span><span class=\"default_value\"><span class=\"pre\">None</span></span></em><span class=\"sig-paren\">)</span><a class=\"reference internal\" href=\"../_modules/polib/#MOFile.save\"><span class=\"viewcode-link\"><span class=\"pre\">[source]</span></span></a><a class=\"headerlink\" href=\"#polib.MOFile.save\" title=\"Link to this definition\">\u00b6</a></dt>\n<dd><p>Saves the mofile to <code class=\"docutils literal notranslate\"><span class=\"pre\">fpath</span></code>.</p>\n<p>Keyword argument:</p>\n<dl class=\"simple\">\n<dt><code class=\"docutils literal notranslate\"><span class=\"pre\">fpath</span></code></dt><dd><p>string, full or relative path to the file.</p>\n</dd>\n</dl>\n</dd></dl>\n\n<dl class=\"py method\">\n<dt class=\"sig sig-object py\" id=\"polib.MOFile.save_as_pofile\">\n<span class=\"sig-name descname\"><span class=\"pre\">save_as_pofile</span></span><span class=\"sig-paren\">(</span><em class=\"sig-param\"><span class=\"n\"><span class=\"pre\">fpath</span></span></em><span class=\"sig-paren\">)</span><a class=\"reference internal\" href=\"../_modules/polib/#MOFile.save_as_pofile\"><span class=\"viewcode-link\"><span class=\"pre\">[source]</span></span></a><a class=\"headerlink\" href=\"#polib.MOFile.save_as_pofile\" title=\"Link to this definition\">\u00b6</a></dt>\n<dd><p>Saves the mofile as a pofile to <code class=\"docutils literal notranslate\"><span class=\"pre\">fpath</span></code>.</p>\n<p>Keyword argument:</p>\n<dl class=\"simple\">\n<dt><code class=\"docutils literal notranslate\"><span class=\"pre\">fpath</span></code></dt><dd><p>string, full or relative path to the file.</p>\n</dd>\n</dl>\n</dd></dl>\n\n<dl class=\"py method\">\n<dt class=\"sig sig-object py\" id=\"polib.MOFile.translated_entries\">\n<span class=\"sig-name descname\"><span class=\"pre\">translated_entries</span></span><span class=\"sig-paren\">(</span><span class=\"sig-paren\">)</span><a class=\"reference internal\" href=\"../_modules/polib/#MOFile.translated_entries\"><span class=\"viewcode-link\"><span class=\"pre\">[source]</span></span></a><a class=\"headerlink\" href=\"#polib.MOFile.translated_entries\" title=\"Link to this definition\">\u00b6</a></dt>\n<dd><p>Convenience method to keep the same interface with POFile instances.</p>\n</dd></dl>\n\n<dl class=\"py method\">\n<dt class=\"sig sig-object py\" id=\"polib.MOFile.untranslated_entries\">\n<span class=\"sig-name descname\"><span class=\"pre\">untranslated_entries</span></span><span class=\"sig-paren\">(</span><span class=\"sig-paren\">)</span><a class=\"reference internal\" href=\"../_modules/polib/#MOFile.untranslated_entries\"><span class=\"viewcode-link\"><span class=\"pre\">[source]</span></span></a><a class=\"headerlink\" href=\"#polib.MOFile.untranslated_entries\" title=\"Link to this definition\">\u00b6</a></dt>\n<dd><p>Convenience method to keep the same interface with POFile instances.</p>\n</dd></dl>\n\n</dd></dl>\n\n</section>\n<section id=\"the-poentry-class\">\n<h2>The <code class=\"docutils literal notranslate\"><span class=\"pre\">POEntry</span></code> class<a class=\"headerlink\" href=\"#the-poentry-class\" title=\"Link to this heading\">\u00b6</a></h2>\n<dl class=\"py class\">\n<dt class=\"sig sig-object py\" id=\"polib.POEntry\">\n<em class=\"property\"><span class=\"pre\">class</span><span class=\"w\"> </span></em><span class=\"sig-prename descclassname\"><span class=\"pre\">polib.</span></span><span class=\"sig-name descname\"><span class=\"pre\">POEntry</span></span><span class=\"sig-paren\">(</span><em class=\"sig-param\"><span class=\"o\"><span class=\"pre\">*</span></span><span class=\"n\"><span class=\"pre\">args</span></span></em>, <em class=\"sig-param\"><span class=\"o\"><span class=\"pre\">**</span></span><span class=\"n\"><span class=\"pre\">kwargs</span></span></em><span class=\"sig-paren\">)</span><a class=\"reference internal\" href=\"../_modules/polib/#POEntry\"><span class=\"viewcode-link\"><span class=\"pre\">[source]</span></span></a><a class=\"headerlink\" href=\"#polib.POEntry\" title=\"Link to this definition\">\u00b6</a></dt>\n<dd><p>Represents a po file entry.</p>\n<dl class=\"py method\">\n<dt class=\"sig sig-object py\" id=\"polib.POEntry.merge\">\n<span class=\"sig-name descname\"><span class=\"pre\">merge</span></span><span class=\"sig-paren\">(</span><em class=\"sig-param\"><span class=\"n\"><span class=\"pre\">other</span></span></em><span class=\"sig-paren\">)</span><a class=\"reference internal\" href=\"../_modules/polib/#POEntry.merge\"><span class=\"viewcode-link\"><span class=\"pre\">[source]</span></span></a><a class=\"headerlink\" href=\"#polib.POEntry.merge\" title=\"Link to this definition\">\u00b6</a></dt>\n<dd><p>Merge the current entry with the given pot entry.</p>\n</dd></dl>\n\n<dl class=\"py method\">\n<dt class=\"sig sig-object py\" id=\"polib.POEntry.translated\">\n<span class=\"sig-name descname\"><span class=\"pre\">translated</span></span><span class=\"sig-paren\">(</span><span class=\"sig-paren\">)</span><a class=\"reference internal\" href=\"../_modules/polib/#POEntry.translated\"><span class=\"viewcode-link\"><span class=\"pre\">[source]</span></span></a><a class=\"headerlink\" href=\"#polib.POEntry.translated\" title=\"Link to this definition\">\u00b6</a></dt>\n<dd><p>Returns <code class=\"docutils literal notranslate\"><span class=\"pre\">True</span></code> if the entry has been translated or <code class=\"docutils literal notranslate\"><span class=\"pre\">False</span></code>\notherwise.</p>\n</dd></dl>\n\n</dd></dl>\n\n</section>\n<section id=\"the-moentry-class\">\n<h2>The <code class=\"docutils literal notranslate\"><span class=\"pre\">MOEntry</span></code> class<a class=\"headerlink\" href=\"#the-moentry-class\" title=\"Link to this heading\">\u00b6</a></h2>\n<dl class=\"py class\">\n<dt class=\"sig sig-object py\" id=\"polib.MOEntry\">\n<em class=\"property\"><span class=\"pre\">class</span><span class=\"w\"> </span></em><span class=\"sig-prename descclassname\"><span class=\"pre\">polib.</span></span><span class=\"sig-name descname\"><span class=\"pre\">MOEntry</span></span><span class=\"sig-paren\">(</span><em class=\"sig-param\"><span class=\"o\"><span class=\"pre\">*</span></span><span class=\"n\"><span class=\"pre\">args</span></span></em>, <em class=\"sig-param\"><span class=\"o\"><span class=\"pre\">**</span></span><span class=\"n\"><span class=\"pre\">kwargs</span></span></em><span class=\"sig-paren\">)</span><a class=\"reference internal\" href=\"../_modules/polib/#MOEntry\"><span class=\"viewcode-link\"><span class=\"pre\">[source]</span></span></a><a class=\"headerlink\" href=\"#polib.MOEntry\" title=\"Link to this definition\">\u00b6</a></dt>\n<dd><p>Represents a mo file entry.</p>\n</dd></dl>\n\n</section>\n</section>\n", "metatags": "<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />\n", "rellinks": [["genindex", "General Index", "I", "index"], ["contributing", "Contributing to polib", "N", "next"], ["installation", "Installation guide", "P", "previous"]], "sourcename": "api.rst.txt", "toc": "<ul>\n<li><a class=\"reference internal\" href=\"#\">polib API</a><ul>\n<li><a class=\"reference internal\" href=\"#the-pofile-function\">The <code class=\"docutils literal notranslate\"><span class=\"pre\">pofile</span></code> function</a><ul>\n<li><a class=\"reference internal\" href=\"#polib.pofile\"><code class=\"docutils literal notranslate\"><span class=\"pre\">pofile()</span></code></a></li>\n</ul>\n</li>\n<li><a class=\"reference internal\" href=\"#the-mofile-function\">The <code class=\"docutils literal notranslate\"><span class=\"pre\">mofile</span></code> function</a><ul>\n<li><a class=\"reference internal\" href=\"#polib.mofile\"><code class=\"docutils literal notranslate\"><span class=\"pre\">mofile()</span></code></a></li>\n</ul>\n</li>\n<li><a class=\"reference internal\" href=\"#the-detect-encoding-function\">The <code class=\"docutils literal notranslate\"><span class=\"pre\">detect_encoding</span></code> function</a><ul>\n<li><a class=\"reference internal\" href=\"#polib.detect_encoding\"><code class=\"docutils literal notranslate\"><span class=\"pre\">detect_encoding()</span></code></a></li>\n</ul>\n</li>\n<li><a class=\"reference internal\" href=\"#the-escape-function\">The <code class=\"docutils literal notranslate\"><span class=\"pre\">escape</span></code> function</a><ul>\n<li><a class=\"reference internal\" href=\"#polib.escape\"><code class=\"docutils literal notranslate\"><span class=\"pre\">escape()</span></code></a></li>\n</ul>\n</li>\n<li><a class=\"reference internal\" href=\"#the-unescape-function\">The <code class=\"docutils literal notranslate\"><span class=\"pre\">unescape</span></code> function</a><ul>\n<li><a class=\"reference internal\" href=\"#polib.unescape\"><code class=\"docutils literal notranslate\"><span class=\"pre\">unescape()</span></code></a></li>\n</ul>\n</li>\n<li><a class=\"reference internal\" href=\"#the-pofile-class\">The <code class=\"docutils literal notranslate\"><span class=\"pre\">POFile</span></code> class</a><ul>\n<li><a class=\"reference internal\" href=\"#polib.POFile\"><code class=\"docutils literal notranslate\"><span class=\"pre\">POFile</span></code></a><ul>\n<li><a class=\"reference internal\" href=\"#polib.POFile.fuzzy_entries\"><code class=\"docutils literal notranslate\"><span class=\"pre\">POFile.fuzzy_entries()</span></code></a></li>\n<li><a class=\"reference internal\" href=\"#polib.POFile.merge\"><code class=\"docutils literal notranslate\"><span class=\"pre\">POFile.merge()</span></code></a></li>\n<li><a class=\"reference internal\" href=\"#polib.POFile.obsolete_entries\"><code class=\"docutils literal notranslate\"><span class=\"pre\">POFile.obsolete_entries()</span></code></a></li>\n<li><a class=\"reference internal\" href=\"#polib.POFile.percent_translated\"><code class=\"docutils literal notranslate\"><span class=\"pre\">POFile.percent_translated()</span></code></a></li>\n<li><a class=\"reference internal\" href=\"#polib.POFile.save_as_mofile\"><code class=\"docutils literal notranslate\"><span class=\"pre\">POFile.save_as_mofile()</span></code></a></li>\n<li><a class=\"reference internal\" href=\"#polib.POFile.translated_entries\"><code class=\"docutils literal notranslate\"><span class=\"pre\">POFile.translated_entries()</span></code></a></li>\n<li><a class=\"reference internal\" href=\"#polib.POFile.untranslated_entries\"><code class=\"docutils literal notranslate\"><span class=\"pre\">POFile.untranslated_entries()</span></code></a></li>\n</ul>\n</li>\n</ul>\n</li>\n<li><a class=\"reference internal\" href=\"#the-mofile-class\">The <code class=\"docutils literal notranslate\"><span class=\"pre\">MOFile</span></code> class</a><ul>\n<li><a class=\"reference internal\" href=\"#polib.MOFile\"><code class=\"docutils literal notranslate\"><span class=\"pre\">MOFile</span></code></a><ul>\n<li><a class=\"reference internal\" href=\"#polib.MOFile.fuzzy_entries\"><code class=\"docutils literal notranslate\"><span class=\"pre\">MOFile.fuzzy_entries()</span></code></a></li>\n<li><a class=\"reference internal\" href=\"#polib.MOFile.obsolete_entries\"><code class=\"docutils literal notranslate\"><span class=\"pre\">MOFile.obsolete_entries()</span></code></a></li>\n<li><a class=\"reference internal\" href=\"#polib.MOFile.percent_translated\"><code class=\"docutils literal notranslate\"><span class=\"pre\">MOFile.percent_translated()</span></code></a></li>\n<li><a class=\"reference internal\" href=\"#polib.MOFile.save\"><code class=\"docutils literal notranslate\"><span class=\"pre\">MOFile.save()</span></code></a></li>\n<li><a class=\"reference internal\" href=\"#polib.MOFile.save_as_pofile\"><code class=\"docutils literal notranslate\"><span class=\"pre\">MOFile.save_as_pofile()</span></code></a></li>\n<li><a class=\"reference internal\" href=\"#polib.MOFile.translated_entries\"><code class=\"docutils literal notranslate\"><span class=\"pre\">MOFile.translated_entries()</span></code></a></li>\n<li><a class=\"reference internal\" href=\"#polib.MOFile.untranslated_entries\"><code class=\"docutils literal notranslate\"><span class=\"pre\">MOFile.untranslated_entries()</span></code></a></li>\n</ul>\n</li>\n</ul>\n</li>\n<li><a class=\"reference internal\" href=\"#the-poentry-class\">The <code class=\"docutils literal notranslate\"><span class=\"pre\">POEntry</span></code> class</a><ul>\n<li><a class=\"reference internal\" href=\"#polib.POEntry\"><code class=\"docutils literal notranslate\"><span class=\"pre\">POEntry</span></code></a><ul>\n<li><a class=\"reference internal\" href=\"#polib.POEntry.merge\"><code class=\"docutils literal notranslate\"><span class=\"pre\">POEntry.merge()</span></code></a></li>\n<li><a class=\"reference internal\" href=\"#polib.POEntry.translated\"><code class=\"docutils literal notranslate\"><span class=\"pre\">POEntry.translated()</span></code></a></li>\n</ul>\n</li>\n</ul>\n</li>\n<li><a class=\"reference internal\" href=\"#the-moentry-class\">The <code class=\"docutils literal notranslate\"><span class=\"pre\">MOEntry</span></code> class</a><ul>\n<li><a class=\"reference internal\" href=\"#polib.MOEntry\"><code class=\"docutils literal notranslate\"><span class=\"pre\">MOEntry</span></code></a></li>\n</ul>\n</li>\n</ul>\n</li>\n</ul>\n", "display_toc": true, "page_source_suffix": ".rst", "current_page_name": "api", "sidebars": ["localtoc.html", "relations.html", "sourcelink.html", "searchbox.html"], "alabaster_version": "1.0.0", "alabaster_version_info": [1, 0, 0]}