Google Cloud Translator Adapter (hoshi.translators.gcloud
)¶
This module provides the the adapter for the integration Google Cloud Translate’s Basic (v2) API. Note that this translator requires that you have a valid API key.
- class hoshi.translators.gcloud.GoogleCloudTranslator(credentials=None)[source]
Bases:
hoshi.translators.base.TranslatorBase
Any initialization required to start or connect to the external translator should be done here.
- _name = 'gcloud translate v2'
- _upstream_loggers = ['urllib3.util.retry', 'urllib3.connectionpool', 'google.auth.transport.requests', 'google.auth._default']
- property name
- _silence_logging()[source]
- translate(source_language, target_language, string)[source]
Given a
string
in thesource_language
, return the string as translated into thetarget_language
. Both languages are to be instances ofbabel.core.Locale
.