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 the source_language, return the string as translated into the target_language. Both languages are to be instances of babel.core.Locale.