3d2e775855
* doc: update Readthedoc * doc: update Readthedoc * doc: update Readthedoc
656 lines
52 KiB
HTML
656 lines
52 KiB
HTML
<!DOCTYPE html>
|
||
|
||
<html>
|
||
<head>
|
||
<meta charset="utf-8" />
|
||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||
<title>Googletrans: Free and Unlimited Google translate API for Python — Googletrans 3.0.0 documentation</title>
|
||
<link rel="stylesheet" href="_static/solar.css" type="text/css" />
|
||
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
|
||
<script id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
|
||
<script src="_static/jquery.js"></script>
|
||
<script src="_static/underscore.js"></script>
|
||
<script src="_static/doctools.js"></script>
|
||
<script src="_static/language_data.js"></script>
|
||
<link rel="search" title="Search" href="search.html" /><link href='http://fonts.googleapis.com/css?family=Source+Code+Pro|Open+Sans:300italic,400italic,700italic,400,300,700' rel='stylesheet' type='text/css'>
|
||
<link href="_static/solarized-dark.css" rel="stylesheet">
|
||
</head><body>
|
||
<div class="related" role="navigation" aria-label="related navigation">
|
||
<h3>Navigation</h3>
|
||
<ul>
|
||
<li class="right" style="margin-right: 10px">
|
||
<a href="py-modindex.html" title="Python Module Index"
|
||
>modules</a></li>
|
||
<li class="nav-item nav-item-0"><a href="#">Googletrans 3.0.0 documentation</a> »</li>
|
||
<li class="nav-item nav-item-this"><a href="">Googletrans: Free and Unlimited Google translate API for Python</a></li>
|
||
</ul>
|
||
</div>
|
||
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
|
||
<div class="sphinxsidebarwrapper">
|
||
<h3><a href="#">Table of Contents</a></h3>
|
||
<ul>
|
||
<li><a class="reference internal" href="#">Googletrans: Free and Unlimited Google translate API for Python</a><ul>
|
||
<li><a class="reference internal" href="#features">Features</a><ul>
|
||
<li><a class="reference internal" href="#note-on-library-usage">Note on library usage</a></li>
|
||
</ul>
|
||
</li>
|
||
<li><a class="reference internal" href="#quickstart">Quickstart</a><ul>
|
||
<li><a class="reference internal" href="#http-2-support">HTTP/2 support</a></li>
|
||
<li><a class="reference internal" href="#basic-usage">Basic Usage</a></li>
|
||
<li><a class="reference internal" href="#customize-service-url">Customize service URL</a></li>
|
||
<li><a class="reference internal" href="#advanced-usage-bulk">Advanced Usage (Bulk)</a></li>
|
||
<li><a class="reference internal" href="#language-detection">Language detection</a></li>
|
||
</ul>
|
||
</li>
|
||
<li><a class="reference internal" href="#api-guide">API Guide</a></li>
|
||
</ul>
|
||
</li>
|
||
<li><a class="reference internal" href="#googletrans-translator">googletrans.Translator</a></li>
|
||
<li><a class="reference internal" href="#module-googletrans.models">googletrans.models</a></li>
|
||
<li><a class="reference internal" href="#googletrans-gtoken">googletrans.gtoken</a></li>
|
||
<li><a class="reference internal" href="#googletrans-languages">googletrans.LANGUAGES</a></li>
|
||
<li><a class="reference internal" href="#googletrans-default-service-urls">googletrans.DEFAULT_SERVICE_URLS</a></li>
|
||
</ul>
|
||
|
||
<div role="note" aria-label="source link">
|
||
<h3>This Page</h3>
|
||
<ul class="this-page-menu">
|
||
<li><a href="_sources/index.rst.txt"
|
||
rel="nofollow">Show Source</a></li>
|
||
</ul>
|
||
</div>
|
||
<div id="searchbox" style="display: none" role="search">
|
||
<h3 id="searchlabel">Quick search</h3>
|
||
<div class="searchformwrapper">
|
||
<form class="search" action="search.html" method="get">
|
||
<input type="text" name="q" aria-labelledby="searchlabel" />
|
||
<input type="submit" value="Go" />
|
||
</form>
|
||
</div>
|
||
</div>
|
||
<script>$('#searchbox').show(0);</script>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="document">
|
||
<div class="documentwrapper">
|
||
<div class="bodywrapper">
|
||
<div class="body" role="main">
|
||
|
||
<div class="section" id="googletrans-free-and-unlimited-google-translate-api-for-python">
|
||
<h1>Googletrans: Free and Unlimited Google translate API for Python<a class="headerlink" href="#googletrans-free-and-unlimited-google-translate-api-for-python" title="Permalink to this headline">¶</a></h1>
|
||
<a class="reference external image-reference" href="http://opensource.org/licenses/MIT"><img alt="https://img.shields.io/github/license/mashape/apistatus.svg" src="https://img.shields.io/github/license/mashape/apistatus.svg" /></a>
|
||
<a class="reference external image-reference" href="https://travis-ci.org/ssut/py-googletrans"><img alt="https://travis-ci.org/ssut/py-googletrans.svg?branch=master" src="https://travis-ci.org/ssut/py-googletrans.svg?branch=master" /></a>
|
||
<a class="reference external image-reference" href="https://readthedocs.org/projects/py-googletrans/?badge=latest"><img alt="https://readthedocs.org/projects/py-googletrans/badge/?version=latest" src="https://readthedocs.org/projects/py-googletrans/badge/?version=latest" /></a>
|
||
<a class="reference external image-reference" href="http://badge.fury.io/py/googletrans"><img alt="https://badge.fury.io/py/googletrans.svg" src="https://badge.fury.io/py/googletrans.svg" /></a>
|
||
<a class="reference external image-reference" href="https://coveralls.io/github/ssut/py-googletrans"><img alt="https://coveralls.io/repos/github/ssut/py-googletrans/badge.svg" src="https://coveralls.io/repos/github/ssut/py-googletrans/badge.svg" /></a>
|
||
<a class="reference external image-reference" href="https://codeclimate.com/github/ssut/py-googletrans"><img alt="https://codeclimate.com/github/ssut/py-googletrans/badges/gpa.svg" src="https://codeclimate.com/github/ssut/py-googletrans/badges/gpa.svg" /></a>
|
||
<p>Googletrans is a <strong>free</strong> and <strong>unlimited</strong> python library that
|
||
implemented Google Translate API. This uses the <a class="reference external" href="https://translate.google.com">Google Translate Ajax
|
||
API</a> to make calls to such methods as
|
||
detect and translate.</p>
|
||
<div class="section" id="features">
|
||
<h2>Features<a class="headerlink" href="#features" title="Permalink to this headline">¶</a></h2>
|
||
<ul class="simple">
|
||
<li><p>Fast and reliable - it uses the same servers that
|
||
translate.google.com uses</p></li>
|
||
<li><p>Auto language detection</p></li>
|
||
<li><p>Bulk translations</p></li>
|
||
<li><p>Customizable service URL</p></li>
|
||
<li><p>Connection pooling (the advantage of using requests.Session)</p></li>
|
||
<li><p>HTTP/2 support</p></li>
|
||
</ul>
|
||
<div class="section" id="note-on-library-usage">
|
||
<h3>Note on library usage<a class="headerlink" href="#note-on-library-usage" title="Permalink to this headline">¶</a></h3>
|
||
<ul class="simple">
|
||
<li><p>The maximum character limit on a single text is 15k.</p></li>
|
||
<li><p>Due to limitations of the web version of google translate, this API
|
||
does not guarantee that the library would work properly at all times.
|
||
(so please use this library if you don’t care about stability.)</p></li>
|
||
<li><p>If you want to use a stable API, I highly recommend you to use
|
||
<a class="reference external" href="https://cloud.google.com/translate/docs">Google’s official translate
|
||
API</a>.</p></li>
|
||
<li><p>If you get HTTP 5xx error or errors like #6, it’s probably because
|
||
Google has banned your client IP address.</p></li>
|
||
</ul>
|
||
</div>
|
||
</div>
|
||
<div class="section" id="quickstart">
|
||
<h2>Quickstart<a class="headerlink" href="#quickstart" title="Permalink to this headline">¶</a></h2>
|
||
<p>You can install it from <a class="reference external" href="https://pypi.python.org/pypi/googletrans">PyPI</a>:</p>
|
||
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>$ pip install googletrans
|
||
</pre></div>
|
||
</div>
|
||
<div class="section" id="http-2-support">
|
||
<h3>HTTP/2 support<a class="headerlink" href="#http-2-support" title="Permalink to this headline">¶</a></h3>
|
||
<p>This is a great deal for everyone! (up to 2x times faster in my test) If
|
||
you want to get googletrans faster you should install
|
||
<a class="reference external" href="https://github.com/Lukasa/hyper">hyper</a> package. Googletrans will
|
||
automatically detect if hyper is installed and if so, it will be used
|
||
for http networking.</p>
|
||
</div>
|
||
<div class="section" id="basic-usage">
|
||
<h3>Basic Usage<a class="headerlink" href="#basic-usage" title="Permalink to this headline">¶</a></h3>
|
||
<p>If source language is not given, google translate attempts to detect the
|
||
source language.</p>
|
||
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">googletrans</span> <span class="kn">import</span> <span class="n">Translator</span>
|
||
<span class="gp">>>> </span><span class="n">translator</span> <span class="o">=</span> <span class="n">Translator</span><span class="p">()</span>
|
||
<span class="gp">>>> </span><span class="n">translator</span><span class="o">.</span><span class="n">translate</span><span class="p">(</span><span class="s1">'안녕하세요.'</span><span class="p">)</span>
|
||
<span class="go"># <Translated src=ko dest=en text=Good evening. pronunciation=Good evening.></span>
|
||
|
||
<span class="gp">>>> </span><span class="n">translator</span><span class="o">.</span><span class="n">translate</span><span class="p">(</span><span class="s1">'안녕하세요.'</span><span class="p">,</span> <span class="n">dest</span><span class="o">=</span><span class="s1">'ja'</span><span class="p">)</span>
|
||
<span class="go"># <Translated src=ko dest=ja text=こんにちは。 pronunciation=Kon'nichiwa.></span>
|
||
|
||
<span class="gp">>>> </span><span class="n">translator</span><span class="o">.</span><span class="n">translate</span><span class="p">(</span><span class="s1">'veritas lux mea'</span><span class="p">,</span> <span class="n">src</span><span class="o">=</span><span class="s1">'la'</span><span class="p">)</span>
|
||
<span class="go"># <Translated src=la dest=en text=The truth is my light pronunciation=The truth is my light></span>
|
||
</pre></div>
|
||
</div>
|
||
</div>
|
||
<div class="section" id="customize-service-url">
|
||
<h3>Customize service URL<a class="headerlink" href="#customize-service-url" title="Permalink to this headline">¶</a></h3>
|
||
<p>You can use another google translate domain for translation. If multiple
|
||
URLs are provided it then randomly chooses a domain.</p>
|
||
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">googletrans</span> <span class="kn">import</span> <span class="n">Translator</span>
|
||
<span class="gp">>>> </span><span class="n">translator</span> <span class="o">=</span> <span class="n">Translator</span><span class="p">(</span><span class="n">service_urls</span><span class="o">=</span><span class="p">[</span>
|
||
<span class="go"> 'translate.google.com',</span>
|
||
<span class="go"> 'translate.google.co.kr',</span>
|
||
<span class="go"> ])</span>
|
||
</pre></div>
|
||
</div>
|
||
</div>
|
||
<div class="section" id="advanced-usage-bulk">
|
||
<h3>Advanced Usage (Bulk)<a class="headerlink" href="#advanced-usage-bulk" title="Permalink to this headline">¶</a></h3>
|
||
<p>Array can be used to translate a batch of strings in a single method
|
||
call and a single HTTP session. The exact same method shown above work
|
||
for arrays as well.</p>
|
||
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">translations</span> <span class="o">=</span> <span class="n">translator</span><span class="o">.</span><span class="n">translate</span><span class="p">([</span><span class="s1">'The quick brown fox'</span><span class="p">,</span> <span class="s1">'jumps over'</span><span class="p">,</span> <span class="s1">'the lazy dog'</span><span class="p">],</span> <span class="n">dest</span><span class="o">=</span><span class="s1">'ko'</span><span class="p">)</span>
|
||
<span class="gp">>>> </span><span class="k">for</span> <span class="n">translation</span> <span class="ow">in</span> <span class="n">translations</span><span class="p">:</span>
|
||
<span class="gp">... </span> <span class="nb">print</span><span class="p">(</span><span class="n">translation</span><span class="o">.</span><span class="n">origin</span><span class="p">,</span> <span class="s1">' -> '</span><span class="p">,</span> <span class="n">translation</span><span class="o">.</span><span class="n">text</span><span class="p">)</span>
|
||
<span class="go"># The quick brown fox -> 빠른 갈색 여우</span>
|
||
<span class="go"># jumps over -> 이상 점프</span>
|
||
<span class="go"># the lazy dog -> 게으른 개</span>
|
||
</pre></div>
|
||
</div>
|
||
</div>
|
||
<div class="section" id="language-detection">
|
||
<h3>Language detection<a class="headerlink" href="#language-detection" title="Permalink to this headline">¶</a></h3>
|
||
<p>The detect method, as its name implies, identifies the language used in
|
||
a given sentence.</p>
|
||
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">translator</span><span class="o">.</span><span class="n">detect</span><span class="p">(</span><span class="s1">'이 문장은 한글로 쓰여졌습니다.'</span><span class="p">)</span>
|
||
<span class="go"># <Detected lang=ko confidence=0.27041003></span>
|
||
<span class="gp">>>> </span><span class="n">translator</span><span class="o">.</span><span class="n">detect</span><span class="p">(</span><span class="s1">'この文章は日本語で書かれました。'</span><span class="p">)</span>
|
||
<span class="go"># <Detected lang=ja confidence=0.64889508></span>
|
||
<span class="gp">>>> </span><span class="n">translator</span><span class="o">.</span><span class="n">detect</span><span class="p">(</span><span class="s1">'This sentence is written in English.'</span><span class="p">)</span>
|
||
<span class="go"># <Detected lang=en confidence=0.22348526></span>
|
||
<span class="gp">>>> </span><span class="n">translator</span><span class="o">.</span><span class="n">detect</span><span class="p">(</span><span class="s1">'Tiu frazo estas skribita en Esperanto.'</span><span class="p">)</span>
|
||
<span class="go"># <Detected lang=eo confidence=0.10538048></span>
|
||
</pre></div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="section" id="api-guide">
|
||
<h2>API Guide<a class="headerlink" href="#api-guide" title="Permalink to this headline">¶</a></h2>
|
||
</div>
|
||
</div>
|
||
<div class="section" id="googletrans-translator">
|
||
<h1>googletrans.Translator<a class="headerlink" href="#googletrans-translator" title="Permalink to this headline">¶</a></h1>
|
||
<dl class="py class">
|
||
<dt id="googletrans.Translator">
|
||
<em class="property">class </em><code class="sig-prename descclassname">googletrans.</code><code class="sig-name descname">Translator</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">service_urls</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">user_agent</span><span class="o">=</span><span class="default_value">'Mozilla/5.0 (Windows NT 10.0; Win64; x64)'</span></em>, <em class="sig-param"><span class="n">raise_exception</span><span class="o">=</span><span class="default_value">False</span></em>, <em class="sig-param"><span class="n">proxies</span><span class="p">:</span> <span class="n">Dict<span class="p">[</span><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.8)">str</a><span class="p">, </span>httpcore._sync.base.SyncHTTPTransport<span class="p">]</span></span> <span class="o">=</span> <span class="default_value">None</span></em>, <em class="sig-param"><span class="n">timeout</span><span class="p">:</span> <span class="n">httpx._config.Timeout</span> <span class="o">=</span> <span class="default_value">None</span></em>, <em class="sig-param"><span class="n">http2</span><span class="o">=</span><span class="default_value">True</span></em><span class="sig-paren">)</span><a class="headerlink" href="#googletrans.Translator" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Google Translate ajax API implementation class</p>
|
||
<p>You have to create an instance of Translator to use this API</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>service_urls</strong> (<em>a sequence of strings</em>) – google translate url list. URLs will be used randomly.
|
||
For example <code class="docutils literal notranslate"><span class="pre">['translate.google.com',</span> <span class="pre">'translate.google.co.kr']</span></code></p></li>
|
||
<li><p><strong>user_agent</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.8)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>) – the User-Agent header to send when making requests.</p></li>
|
||
<li><p><strong>proxies</strong> (<em>dictionary</em>) – proxies configuration.
|
||
Dictionary mapping protocol or protocol and host to the URL of the proxy
|
||
For example <code class="docutils literal notranslate"><span class="pre">{'http':</span> <span class="pre">'foo.bar:3128',</span> <span class="pre">'http://host.name':</span> <span class="pre">'foo.bar:4012'}</span></code></p></li>
|
||
<li><p><strong>timeout</strong> (<em>number</em><em> or </em><em>a double of numbers</em>) – Definition of timeout for httpx library.
|
||
Will be used for every request.</p></li>
|
||
<li><p><strong>proxies</strong> – proxies configuration.
|
||
Dictionary mapping protocol or protocol and host to the URL of the proxy
|
||
For example <code class="docutils literal notranslate"><span class="pre">{'http':</span> <span class="pre">'foo.bar:3128',</span> <span class="pre">'http://host.name':</span> <span class="pre">'foo.bar:4012'}</span></code></p></li>
|
||
<li><p><strong>raise_exception</strong> (<em>boolean</em>) – if <cite>True</cite> then raise exception if smth will go wrong</p></li>
|
||
</ul>
|
||
</dd>
|
||
</dl>
|
||
<dl class="py method">
|
||
<dt id="googletrans.Translator.translate">
|
||
<code class="sig-name descname">translate</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">text</span></em>, <em class="sig-param"><span class="n">dest</span><span class="o">=</span><span class="default_value">'en'</span></em>, <em class="sig-param"><span class="n">src</span><span class="o">=</span><span class="default_value">'auto'</span></em>, <em class="sig-param"><span class="o">**</span><span class="n">kwargs</span></em><span class="sig-paren">)</span><a class="headerlink" href="#googletrans.Translator.translate" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Translate text from source language to destination language</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>text</strong> (UTF-8 <a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.8)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>; <code class="xref py py-class docutils literal notranslate"><span class="pre">unicode</span></code>; string sequence (list, tuple, iterator, generator)) – The source text(s) to be translated. Batch translation is supported via sequence input.</p></li>
|
||
<li><p><strong>dest</strong> – The language to translate the source text into.
|
||
The value should be one of the language codes listed in <code class="xref py py-const docutils literal notranslate"><span class="pre">googletrans.LANGUAGES</span></code>
|
||
or one of the language names listed in <code class="xref py py-const docutils literal notranslate"><span class="pre">googletrans.LANGCODES</span></code>.</p></li>
|
||
<li><p><strong>dest</strong> – <a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.8)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>; <code class="xref py py-class docutils literal notranslate"><span class="pre">unicode</span></code></p></li>
|
||
<li><p><strong>src</strong> – The language of the source text.
|
||
The value should be one of the language codes listed in <code class="xref py py-const docutils literal notranslate"><span class="pre">googletrans.LANGUAGES</span></code>
|
||
or one of the language names listed in <code class="xref py py-const docutils literal notranslate"><span class="pre">googletrans.LANGCODES</span></code>.
|
||
If a language is not specified,
|
||
the system will attempt to identify the source language automatically.</p></li>
|
||
<li><p><strong>src</strong> – <a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.8)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>; <code class="xref py py-class docutils literal notranslate"><span class="pre">unicode</span></code></p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Return type</dt>
|
||
<dd class="field-even"><p><a class="reference internal" href="#googletrans.models.Translated" title="googletrans.models.Translated">Translated</a></p>
|
||
</dd>
|
||
<dt class="field-odd">Return type</dt>
|
||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#list" title="(in Python v3.8)"><code class="xref py py-class docutils literal notranslate"><span class="pre">list</span></code></a> (when a list is passed)</p>
|
||
</dd>
|
||
</dl>
|
||
<dl>
|
||
<dt>Basic usage:</dt><dd><div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">googletrans</span> <span class="kn">import</span> <span class="n">Translator</span>
|
||
<span class="gp">>>> </span><span class="n">translator</span> <span class="o">=</span> <span class="n">Translator</span><span class="p">()</span>
|
||
<span class="gp">>>> </span><span class="n">translator</span><span class="o">.</span><span class="n">translate</span><span class="p">(</span><span class="s1">'안녕하세요.'</span><span class="p">)</span>
|
||
<span class="go"><Translated src=ko dest=en text=Good evening. pronunciation=Good evening.></span>
|
||
<span class="gp">>>> </span><span class="n">translator</span><span class="o">.</span><span class="n">translate</span><span class="p">(</span><span class="s1">'안녕하세요.'</span><span class="p">,</span> <span class="n">dest</span><span class="o">=</span><span class="s1">'ja'</span><span class="p">)</span>
|
||
<span class="go"><Translated src=ko dest=ja text=こんにちは。 pronunciation=Kon'nichiwa.></span>
|
||
<span class="gp">>>> </span><span class="n">translator</span><span class="o">.</span><span class="n">translate</span><span class="p">(</span><span class="s1">'veritas lux mea'</span><span class="p">,</span> <span class="n">src</span><span class="o">=</span><span class="s1">'la'</span><span class="p">)</span>
|
||
<span class="go"><Translated src=la dest=en text=The truth is my light pronunciation=The truth is my light></span>
|
||
</pre></div>
|
||
</div>
|
||
</dd>
|
||
<dt>Advanced usage:</dt><dd><div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">translations</span> <span class="o">=</span> <span class="n">translator</span><span class="o">.</span><span class="n">translate</span><span class="p">([</span><span class="s1">'The quick brown fox'</span><span class="p">,</span> <span class="s1">'jumps over'</span><span class="p">,</span> <span class="s1">'the lazy dog'</span><span class="p">],</span> <span class="n">dest</span><span class="o">=</span><span class="s1">'ko'</span><span class="p">)</span>
|
||
<span class="gp">>>> </span><span class="k">for</span> <span class="n">translation</span> <span class="ow">in</span> <span class="n">translations</span><span class="p">:</span>
|
||
<span class="gp">... </span> <span class="nb">print</span><span class="p">(</span><span class="n">translation</span><span class="o">.</span><span class="n">origin</span><span class="p">,</span> <span class="s1">' -> '</span><span class="p">,</span> <span class="n">translation</span><span class="o">.</span><span class="n">text</span><span class="p">)</span>
|
||
<span class="go">The quick brown fox -> 빠른 갈색 여우</span>
|
||
<span class="go">jumps over -> 이상 점프</span>
|
||
<span class="go">the lazy dog -> 게으른 개</span>
|
||
</pre></div>
|
||
</div>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt id="googletrans.Translator.detect">
|
||
<code class="sig-name descname">detect</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">text</span></em>, <em class="sig-param"><span class="o">**</span><span class="n">kwargs</span></em><span class="sig-paren">)</span><a class="headerlink" href="#googletrans.Translator.detect" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Detect language of the input text</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>text</strong> (UTF-8 <a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.8)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>; <code class="xref py py-class docutils literal notranslate"><span class="pre">unicode</span></code>; string sequence (list, tuple, iterator, generator)) – The source text(s) whose language you want to identify.
|
||
Batch detection is supported via sequence input.</p>
|
||
</dd>
|
||
<dt class="field-even">Return type</dt>
|
||
<dd class="field-even"><p><a class="reference internal" href="#googletrans.models.Detected" title="googletrans.models.Detected">Detected</a></p>
|
||
</dd>
|
||
<dt class="field-odd">Return type</dt>
|
||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#list" title="(in Python v3.8)"><code class="xref py py-class docutils literal notranslate"><span class="pre">list</span></code></a> (when a list is passed)</p>
|
||
</dd>
|
||
</dl>
|
||
<dl>
|
||
<dt>Basic usage:</dt><dd><div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">googletrans</span> <span class="kn">import</span> <span class="n">Translator</span>
|
||
<span class="gp">>>> </span><span class="n">translator</span> <span class="o">=</span> <span class="n">Translator</span><span class="p">()</span>
|
||
<span class="gp">>>> </span><span class="n">translator</span><span class="o">.</span><span class="n">detect</span><span class="p">(</span><span class="s1">'이 문장은 한글로 쓰여졌습니다.'</span><span class="p">)</span>
|
||
<span class="go"><Detected lang=ko confidence=0.27041003></span>
|
||
<span class="gp">>>> </span><span class="n">translator</span><span class="o">.</span><span class="n">detect</span><span class="p">(</span><span class="s1">'この文章は日本語で書かれました。'</span><span class="p">)</span>
|
||
<span class="go"><Detected lang=ja confidence=0.64889508></span>
|
||
<span class="gp">>>> </span><span class="n">translator</span><span class="o">.</span><span class="n">detect</span><span class="p">(</span><span class="s1">'This sentence is written in English.'</span><span class="p">)</span>
|
||
<span class="go"><Detected lang=en confidence=0.22348526></span>
|
||
<span class="gp">>>> </span><span class="n">translator</span><span class="o">.</span><span class="n">detect</span><span class="p">(</span><span class="s1">'Tiu frazo estas skribita en Esperanto.'</span><span class="p">)</span>
|
||
<span class="go"><Detected lang=eo confidence=0.10538048></span>
|
||
</pre></div>
|
||
</div>
|
||
</dd>
|
||
<dt>Advanced usage:</dt><dd><div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">langs</span> <span class="o">=</span> <span class="n">translator</span><span class="o">.</span><span class="n">detect</span><span class="p">([</span><span class="s1">'한국어'</span><span class="p">,</span> <span class="s1">'日本語'</span><span class="p">,</span> <span class="s1">'English'</span><span class="p">,</span> <span class="s1">'le français'</span><span class="p">])</span>
|
||
<span class="gp">>>> </span><span class="k">for</span> <span class="n">lang</span> <span class="ow">in</span> <span class="n">langs</span><span class="p">:</span>
|
||
<span class="gp">... </span> <span class="nb">print</span><span class="p">(</span><span class="n">lang</span><span class="o">.</span><span class="n">lang</span><span class="p">,</span> <span class="n">lang</span><span class="o">.</span><span class="n">confidence</span><span class="p">)</span>
|
||
<span class="go">ko 1</span>
|
||
<span class="go">ja 0.92929292</span>
|
||
<span class="go">en 0.96954316</span>
|
||
<span class="go">fr 0.043500196</span>
|
||
</pre></div>
|
||
</div>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
</div>
|
||
<div class="section" id="module-googletrans.models">
|
||
<span id="googletrans-models"></span><h1>googletrans.models<a class="headerlink" href="#module-googletrans.models" title="Permalink to this headline">¶</a></h1>
|
||
<dl class="py class">
|
||
<dt id="googletrans.models.Translated">
|
||
<em class="property">class </em><code class="sig-prename descclassname">googletrans.models.</code><code class="sig-name descname">Translated</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">src</span></em>, <em class="sig-param"><span class="n">dest</span></em>, <em class="sig-param"><span class="n">origin</span></em>, <em class="sig-param"><span class="n">text</span></em>, <em class="sig-param"><span class="n">pronunciation</span></em>, <em class="sig-param"><span class="n">extra_data</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="o">**</span><span class="n">kwargs</span></em><span class="sig-paren">)</span><a class="headerlink" href="#googletrans.models.Translated" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Translate result object</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>src</strong> – source language (default: auto)</p></li>
|
||
<li><p><strong>dest</strong> – destination language (default: en)</p></li>
|
||
<li><p><strong>origin</strong> – original text</p></li>
|
||
<li><p><strong>text</strong> – translated text</p></li>
|
||
<li><p><strong>pronunciation</strong> – pronunciation</p></li>
|
||
</ul>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py class">
|
||
<dt id="googletrans.models.Detected">
|
||
<em class="property">class </em><code class="sig-prename descclassname">googletrans.models.</code><code class="sig-name descname">Detected</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">lang</span></em>, <em class="sig-param"><span class="n">confidence</span></em>, <em class="sig-param"><span class="o">**</span><span class="n">kwargs</span></em><span class="sig-paren">)</span><a class="headerlink" href="#googletrans.models.Detected" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Language detection result object</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>lang</strong> – detected language</p></li>
|
||
<li><p><strong>confidence</strong> – the confidence of detection result (0.00 to 1.00)</p></li>
|
||
</ul>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
</div>
|
||
<div class="section" id="googletrans-gtoken">
|
||
<h1>googletrans.gtoken<a class="headerlink" href="#googletrans-gtoken" title="Permalink to this headline">¶</a></h1>
|
||
<div class="admonition hint">
|
||
<p class="admonition-title">Hint</p>
|
||
<p>This is for internal use only to generate a valid token to access
|
||
translate.google.com ajax API.</p>
|
||
</div>
|
||
<span class="target" id="module-googletrans.gtoken"></span><dl class="py class">
|
||
<dt id="googletrans.gtoken.TokenAcquirer">
|
||
<em class="property">class </em><code class="sig-prename descclassname">googletrans.gtoken.</code><code class="sig-name descname">TokenAcquirer</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">client</span><span class="p">:</span> <span class="n">httpx._client.Client</span></em>, <em class="sig-param"><span class="n">tkk</span><span class="o">=</span><span class="default_value">'0'</span></em>, <em class="sig-param"><span class="n">host</span><span class="o">=</span><span class="default_value">'translate.google.com'</span></em><span class="sig-paren">)</span><a class="headerlink" href="#googletrans.gtoken.TokenAcquirer" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Google Translate API token generator</p>
|
||
<p>translate.google.com uses a token to authorize the requests. If you are
|
||
not Google, you do have this token and will have to pay for use.
|
||
This class is the result of reverse engineering on the obfuscated and
|
||
minified code used by Google to generate such token.</p>
|
||
<p>The token is based on a seed which is updated once per hour and on the
|
||
text that will be translated.
|
||
Both are combined - by some strange math - in order to generate a final
|
||
token (e.g. 744915.856682) which is used by the API to validate the
|
||
request.</p>
|
||
<p>This operation will cause an additional request to get an initial
|
||
token from translate.google.com.</p>
|
||
<dl>
|
||
<dt>Example usage:</dt><dd><div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">googletrans.gtoken</span> <span class="kn">import</span> <span class="n">TokenAcquirer</span>
|
||
<span class="gp">>>> </span><span class="n">acquirer</span> <span class="o">=</span> <span class="n">TokenAcquirer</span><span class="p">()</span>
|
||
<span class="gp">>>> </span><span class="n">text</span> <span class="o">=</span> <span class="s1">'test'</span>
|
||
<span class="gp">>>> </span><span class="n">tk</span> <span class="o">=</span> <span class="n">acquirer</span><span class="o">.</span><span class="n">do</span><span class="p">(</span><span class="n">text</span><span class="p">)</span>
|
||
<span class="gp">>>> </span><span class="n">tk</span>
|
||
<span class="go">950629.577246</span>
|
||
</pre></div>
|
||
</div>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
</div>
|
||
<div class="section" id="googletrans-languages">
|
||
<h1>googletrans.LANGUAGES<a class="headerlink" href="#googletrans-languages" title="Permalink to this headline">¶</a></h1>
|
||
<div class="admonition hint">
|
||
<p class="admonition-title">Hint</p>
|
||
<p>iso639-1 language codes for
|
||
<a class="reference external" href="https://developers.google.com/translate/v2/using_rest#language-params">supported languages</a>
|
||
for translation. Some language codes also include a country code, like zh-CN or zh-TW.</p>
|
||
</div>
|
||
<div class="highlight-python notranslate"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre> 1
|
||
2
|
||
3
|
||
4
|
||
5
|
||
6
|
||
7
|
||
8
|
||
9
|
||
10
|
||
11
|
||
12
|
||
13
|
||
14
|
||
15
|
||
16
|
||
17
|
||
18
|
||
19
|
||
20
|
||
21
|
||
22
|
||
23
|
||
24
|
||
25
|
||
26
|
||
27
|
||
28
|
||
29
|
||
30
|
||
31
|
||
32
|
||
33
|
||
34
|
||
35
|
||
36
|
||
37
|
||
38
|
||
39
|
||
40
|
||
41
|
||
42
|
||
43
|
||
44
|
||
45
|
||
46
|
||
47
|
||
48
|
||
49
|
||
50
|
||
51
|
||
52
|
||
53
|
||
54
|
||
55
|
||
56
|
||
57
|
||
58
|
||
59
|
||
60
|
||
61
|
||
62
|
||
63
|
||
64
|
||
65
|
||
66
|
||
67
|
||
68
|
||
69
|
||
70
|
||
71
|
||
72
|
||
73
|
||
74
|
||
75
|
||
76
|
||
77
|
||
78
|
||
79
|
||
80
|
||
81
|
||
82
|
||
83
|
||
84
|
||
85
|
||
86
|
||
87
|
||
88
|
||
89
|
||
90
|
||
91
|
||
92
|
||
93
|
||
94
|
||
95
|
||
96
|
||
97
|
||
98
|
||
99
|
||
100
|
||
101
|
||
102
|
||
103
|
||
104
|
||
105
|
||
106
|
||
107
|
||
108
|
||
109
|
||
110
|
||
111
|
||
112
|
||
113</pre></div></td><td class="code"><div class="highlight"><pre><span></span>
|
||
<span class="n">SPECIAL_CASES</span> <span class="o">=</span> <span class="p">{</span>
|
||
<span class="s1">'ee'</span><span class="p">:</span> <span class="s1">'et'</span><span class="p">,</span>
|
||
<span class="p">}</span>
|
||
|
||
<span class="n">LANGUAGES</span> <span class="o">=</span> <span class="p">{</span>
|
||
<span class="s1">'af'</span><span class="p">:</span> <span class="s1">'afrikaans'</span><span class="p">,</span>
|
||
<span class="s1">'sq'</span><span class="p">:</span> <span class="s1">'albanian'</span><span class="p">,</span>
|
||
<span class="s1">'am'</span><span class="p">:</span> <span class="s1">'amharic'</span><span class="p">,</span>
|
||
<span class="s1">'ar'</span><span class="p">:</span> <span class="s1">'arabic'</span><span class="p">,</span>
|
||
<span class="s1">'hy'</span><span class="p">:</span> <span class="s1">'armenian'</span><span class="p">,</span>
|
||
<span class="s1">'az'</span><span class="p">:</span> <span class="s1">'azerbaijani'</span><span class="p">,</span>
|
||
<span class="s1">'eu'</span><span class="p">:</span> <span class="s1">'basque'</span><span class="p">,</span>
|
||
<span class="s1">'be'</span><span class="p">:</span> <span class="s1">'belarusian'</span><span class="p">,</span>
|
||
<span class="s1">'bn'</span><span class="p">:</span> <span class="s1">'bengali'</span><span class="p">,</span>
|
||
<span class="s1">'bs'</span><span class="p">:</span> <span class="s1">'bosnian'</span><span class="p">,</span>
|
||
<span class="s1">'bg'</span><span class="p">:</span> <span class="s1">'bulgarian'</span><span class="p">,</span>
|
||
<span class="s1">'ca'</span><span class="p">:</span> <span class="s1">'catalan'</span><span class="p">,</span>
|
||
<span class="s1">'ceb'</span><span class="p">:</span> <span class="s1">'cebuano'</span><span class="p">,</span>
|
||
<span class="s1">'ny'</span><span class="p">:</span> <span class="s1">'chichewa'</span><span class="p">,</span>
|
||
<span class="s1">'zh-cn'</span><span class="p">:</span> <span class="s1">'chinese (simplified)'</span><span class="p">,</span>
|
||
<span class="s1">'zh-tw'</span><span class="p">:</span> <span class="s1">'chinese (traditional)'</span><span class="p">,</span>
|
||
<span class="s1">'co'</span><span class="p">:</span> <span class="s1">'corsican'</span><span class="p">,</span>
|
||
<span class="s1">'hr'</span><span class="p">:</span> <span class="s1">'croatian'</span><span class="p">,</span>
|
||
<span class="s1">'cs'</span><span class="p">:</span> <span class="s1">'czech'</span><span class="p">,</span>
|
||
<span class="s1">'da'</span><span class="p">:</span> <span class="s1">'danish'</span><span class="p">,</span>
|
||
<span class="s1">'nl'</span><span class="p">:</span> <span class="s1">'dutch'</span><span class="p">,</span>
|
||
<span class="s1">'en'</span><span class="p">:</span> <span class="s1">'english'</span><span class="p">,</span>
|
||
<span class="s1">'eo'</span><span class="p">:</span> <span class="s1">'esperanto'</span><span class="p">,</span>
|
||
<span class="s1">'et'</span><span class="p">:</span> <span class="s1">'estonian'</span><span class="p">,</span>
|
||
<span class="s1">'tl'</span><span class="p">:</span> <span class="s1">'filipino'</span><span class="p">,</span>
|
||
<span class="s1">'fi'</span><span class="p">:</span> <span class="s1">'finnish'</span><span class="p">,</span>
|
||
<span class="s1">'fr'</span><span class="p">:</span> <span class="s1">'french'</span><span class="p">,</span>
|
||
<span class="s1">'fy'</span><span class="p">:</span> <span class="s1">'frisian'</span><span class="p">,</span>
|
||
<span class="s1">'gl'</span><span class="p">:</span> <span class="s1">'galician'</span><span class="p">,</span>
|
||
<span class="s1">'ka'</span><span class="p">:</span> <span class="s1">'georgian'</span><span class="p">,</span>
|
||
<span class="s1">'de'</span><span class="p">:</span> <span class="s1">'german'</span><span class="p">,</span>
|
||
<span class="s1">'el'</span><span class="p">:</span> <span class="s1">'greek'</span><span class="p">,</span>
|
||
<span class="s1">'gu'</span><span class="p">:</span> <span class="s1">'gujarati'</span><span class="p">,</span>
|
||
<span class="s1">'ht'</span><span class="p">:</span> <span class="s1">'haitian creole'</span><span class="p">,</span>
|
||
<span class="s1">'ha'</span><span class="p">:</span> <span class="s1">'hausa'</span><span class="p">,</span>
|
||
<span class="s1">'haw'</span><span class="p">:</span> <span class="s1">'hawaiian'</span><span class="p">,</span>
|
||
<span class="s1">'iw'</span><span class="p">:</span> <span class="s1">'hebrew'</span><span class="p">,</span>
|
||
<span class="s1">'he'</span><span class="p">:</span> <span class="s1">'hebrew'</span><span class="p">,</span>
|
||
<span class="s1">'hi'</span><span class="p">:</span> <span class="s1">'hindi'</span><span class="p">,</span>
|
||
<span class="s1">'hmn'</span><span class="p">:</span> <span class="s1">'hmong'</span><span class="p">,</span>
|
||
<span class="s1">'hu'</span><span class="p">:</span> <span class="s1">'hungarian'</span><span class="p">,</span>
|
||
<span class="s1">'is'</span><span class="p">:</span> <span class="s1">'icelandic'</span><span class="p">,</span>
|
||
<span class="s1">'ig'</span><span class="p">:</span> <span class="s1">'igbo'</span><span class="p">,</span>
|
||
<span class="s1">'id'</span><span class="p">:</span> <span class="s1">'indonesian'</span><span class="p">,</span>
|
||
<span class="s1">'ga'</span><span class="p">:</span> <span class="s1">'irish'</span><span class="p">,</span>
|
||
<span class="s1">'it'</span><span class="p">:</span> <span class="s1">'italian'</span><span class="p">,</span>
|
||
<span class="s1">'ja'</span><span class="p">:</span> <span class="s1">'japanese'</span><span class="p">,</span>
|
||
<span class="s1">'jw'</span><span class="p">:</span> <span class="s1">'javanese'</span><span class="p">,</span>
|
||
<span class="s1">'kn'</span><span class="p">:</span> <span class="s1">'kannada'</span><span class="p">,</span>
|
||
<span class="s1">'kk'</span><span class="p">:</span> <span class="s1">'kazakh'</span><span class="p">,</span>
|
||
<span class="s1">'km'</span><span class="p">:</span> <span class="s1">'khmer'</span><span class="p">,</span>
|
||
<span class="s1">'ko'</span><span class="p">:</span> <span class="s1">'korean'</span><span class="p">,</span>
|
||
<span class="s1">'ku'</span><span class="p">:</span> <span class="s1">'kurdish (kurmanji)'</span><span class="p">,</span>
|
||
<span class="s1">'ky'</span><span class="p">:</span> <span class="s1">'kyrgyz'</span><span class="p">,</span>
|
||
<span class="s1">'lo'</span><span class="p">:</span> <span class="s1">'lao'</span><span class="p">,</span>
|
||
<span class="s1">'la'</span><span class="p">:</span> <span class="s1">'latin'</span><span class="p">,</span>
|
||
<span class="s1">'lv'</span><span class="p">:</span> <span class="s1">'latvian'</span><span class="p">,</span>
|
||
<span class="s1">'lt'</span><span class="p">:</span> <span class="s1">'lithuanian'</span><span class="p">,</span>
|
||
<span class="s1">'lb'</span><span class="p">:</span> <span class="s1">'luxembourgish'</span><span class="p">,</span>
|
||
<span class="s1">'mk'</span><span class="p">:</span> <span class="s1">'macedonian'</span><span class="p">,</span>
|
||
<span class="s1">'mg'</span><span class="p">:</span> <span class="s1">'malagasy'</span><span class="p">,</span>
|
||
<span class="s1">'ms'</span><span class="p">:</span> <span class="s1">'malay'</span><span class="p">,</span>
|
||
<span class="s1">'ml'</span><span class="p">:</span> <span class="s1">'malayalam'</span><span class="p">,</span>
|
||
<span class="s1">'mt'</span><span class="p">:</span> <span class="s1">'maltese'</span><span class="p">,</span>
|
||
<span class="s1">'mi'</span><span class="p">:</span> <span class="s1">'maori'</span><span class="p">,</span>
|
||
<span class="s1">'mr'</span><span class="p">:</span> <span class="s1">'marathi'</span><span class="p">,</span>
|
||
<span class="s1">'mn'</span><span class="p">:</span> <span class="s1">'mongolian'</span><span class="p">,</span>
|
||
<span class="s1">'my'</span><span class="p">:</span> <span class="s1">'myanmar (burmese)'</span><span class="p">,</span>
|
||
<span class="s1">'ne'</span><span class="p">:</span> <span class="s1">'nepali'</span><span class="p">,</span>
|
||
<span class="s1">'no'</span><span class="p">:</span> <span class="s1">'norwegian'</span><span class="p">,</span>
|
||
<span class="s1">'or'</span><span class="p">:</span> <span class="s1">'odia'</span><span class="p">,</span>
|
||
<span class="s1">'ps'</span><span class="p">:</span> <span class="s1">'pashto'</span><span class="p">,</span>
|
||
<span class="s1">'fa'</span><span class="p">:</span> <span class="s1">'persian'</span><span class="p">,</span>
|
||
<span class="s1">'pl'</span><span class="p">:</span> <span class="s1">'polish'</span><span class="p">,</span>
|
||
<span class="s1">'pt'</span><span class="p">:</span> <span class="s1">'portuguese'</span><span class="p">,</span>
|
||
<span class="s1">'pa'</span><span class="p">:</span> <span class="s1">'punjabi'</span><span class="p">,</span>
|
||
<span class="s1">'ro'</span><span class="p">:</span> <span class="s1">'romanian'</span><span class="p">,</span>
|
||
<span class="s1">'ru'</span><span class="p">:</span> <span class="s1">'russian'</span><span class="p">,</span>
|
||
<span class="s1">'sm'</span><span class="p">:</span> <span class="s1">'samoan'</span><span class="p">,</span>
|
||
<span class="s1">'gd'</span><span class="p">:</span> <span class="s1">'scots gaelic'</span><span class="p">,</span>
|
||
<span class="s1">'sr'</span><span class="p">:</span> <span class="s1">'serbian'</span><span class="p">,</span>
|
||
<span class="s1">'st'</span><span class="p">:</span> <span class="s1">'sesotho'</span><span class="p">,</span>
|
||
<span class="s1">'sn'</span><span class="p">:</span> <span class="s1">'shona'</span><span class="p">,</span>
|
||
<span class="s1">'sd'</span><span class="p">:</span> <span class="s1">'sindhi'</span><span class="p">,</span>
|
||
<span class="s1">'si'</span><span class="p">:</span> <span class="s1">'sinhala'</span><span class="p">,</span>
|
||
<span class="s1">'sk'</span><span class="p">:</span> <span class="s1">'slovak'</span><span class="p">,</span>
|
||
<span class="s1">'sl'</span><span class="p">:</span> <span class="s1">'slovenian'</span><span class="p">,</span>
|
||
<span class="s1">'so'</span><span class="p">:</span> <span class="s1">'somali'</span><span class="p">,</span>
|
||
<span class="s1">'es'</span><span class="p">:</span> <span class="s1">'spanish'</span><span class="p">,</span>
|
||
<span class="s1">'su'</span><span class="p">:</span> <span class="s1">'sundanese'</span><span class="p">,</span>
|
||
<span class="s1">'sw'</span><span class="p">:</span> <span class="s1">'swahili'</span><span class="p">,</span>
|
||
<span class="s1">'sv'</span><span class="p">:</span> <span class="s1">'swedish'</span><span class="p">,</span>
|
||
<span class="s1">'tg'</span><span class="p">:</span> <span class="s1">'tajik'</span><span class="p">,</span>
|
||
<span class="s1">'ta'</span><span class="p">:</span> <span class="s1">'tamil'</span><span class="p">,</span>
|
||
<span class="s1">'te'</span><span class="p">:</span> <span class="s1">'telugu'</span><span class="p">,</span>
|
||
<span class="s1">'th'</span><span class="p">:</span> <span class="s1">'thai'</span><span class="p">,</span>
|
||
<span class="s1">'tr'</span><span class="p">:</span> <span class="s1">'turkish'</span><span class="p">,</span>
|
||
<span class="s1">'uk'</span><span class="p">:</span> <span class="s1">'ukrainian'</span><span class="p">,</span>
|
||
<span class="s1">'ur'</span><span class="p">:</span> <span class="s1">'urdu'</span><span class="p">,</span>
|
||
<span class="s1">'ug'</span><span class="p">:</span> <span class="s1">'uyghur'</span><span class="p">,</span>
|
||
<span class="s1">'uz'</span><span class="p">:</span> <span class="s1">'uzbek'</span><span class="p">,</span>
|
||
<span class="s1">'vi'</span><span class="p">:</span> <span class="s1">'vietnamese'</span><span class="p">,</span>
|
||
<span class="s1">'cy'</span><span class="p">:</span> <span class="s1">'welsh'</span><span class="p">,</span>
|
||
<span class="s1">'xh'</span><span class="p">:</span> <span class="s1">'xhosa'</span><span class="p">,</span>
|
||
<span class="s1">'yi'</span><span class="p">:</span> <span class="s1">'yiddish'</span><span class="p">,</span>
|
||
<span class="s1">'yo'</span><span class="p">:</span> <span class="s1">'yoruba'</span><span class="p">,</span>
|
||
<span class="s1">'zu'</span><span class="p">:</span> <span class="s1">'zulu'</span><span class="p">,</span>
|
||
</pre></div>
|
||
</td></tr></table></div>
|
||
</div>
|
||
<div class="section" id="googletrans-default-service-urls">
|
||
<h1>googletrans.DEFAULT_SERVICE_URLS<a class="headerlink" href="#googletrans-default-service-urls" title="Permalink to this headline">¶</a></h1>
|
||
<div class="admonition hint">
|
||
<p class="admonition-title">Hint</p>
|
||
<p><a class="reference external" href="https://github.com/ssut/py-googletrans/blob/master/googletrans/constants.py#L3:1">DEFAULT_SERVICE_URLS</a> is the list of current available Google Translation service urls.</p>
|
||
<p>For using these service urls, please check <a class="reference internal" href="#customize-service-url">Customize service URL</a>.</p>
|
||
</div>
|
||
</div>
|
||
|
||
|
||
<div class="clearer"></div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<a href="https://github.com/ssut/py-googletrans" class="github-corner" aria-label="View source on Github"><svg width="80" height="80" viewBox="0 0 250 250" style="fill:#64CEAA; color:#fff; position: absolute; top: 0; border: 0; right: 0;" aria-hidden="true"><path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path><path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2" fill="currentColor" style="transform-origin: 130px 106px;" class="octo-arm"></path><path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z" fill="currentColor" class="octo-body"></path></svg></a><style>.github-corner:hover .octo-arm{animation:octocat-wave 560ms ease-in-out}@keyframes octocat-wave{0%,100%{transform:rotate(0)}20%,60%{transform:rotate(-25deg)}40%,80%{transform:rotate(10deg)}}@media (max-width:500px){.github-corner:hover .octo-arm{animation:none}.github-corner .octo-arm{animation:octocat-wave 560ms ease-in-out}}</style>
|
||
|
||
<div class="clearer"></div>
|
||
</div>
|
||
<div class="related" role="navigation" aria-label="related navigation">
|
||
<h3>Navigation</h3>
|
||
<ul>
|
||
<li class="right" style="margin-right: 10px">
|
||
<a href="py-modindex.html" title="Python Module Index"
|
||
>modules</a></li>
|
||
<li class="nav-item nav-item-0"><a href="#">Googletrans 3.0.0 documentation</a> »</li>
|
||
<li class="nav-item nav-item-this"><a href="">Googletrans: Free and Unlimited Google translate API for Python</a></li>
|
||
</ul>
|
||
</div>
|
||
<div class="footer">
|
||
© Copyright 2020, SuHun Han (ssut).
|
||
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 3.2.1.Theme by <a href="http://github.com/vkvn">vkvn</a>
|
||
</div>
|
||
</body>
|
||
</html> |