diff --git a/.repo-metadata.json b/.repo-metadata.json index 3927d8d1..85f651a8 100644 --- a/.repo-metadata.json +++ b/.repo-metadata.json @@ -2,7 +2,7 @@ "name": "translation", "name_pretty": "Cloud Translation", "product_documentation": "https://cloud.google.com/translate/docs/", - "client_documentation": "https://googleapis.dev/python/translate/latest", + "client_documentation": "https://googleapis.dev/python/translation/latest", "issue_tracker": "https://issuetracker.google.com/savedsearches/559749", "release_level": "ga", "language": "python", @@ -10,4 +10,4 @@ "distribution_name": "google-cloud-translate", "api_id": "translation.googleapis.com", "requires_billing": true -} \ No newline at end of file +} diff --git a/CHANGELOG.md b/CHANGELOG.md index 7cdbb940..595e3a57 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,32 @@ [1]: https://pypi.org/project/google-cloud-translate/#history +## 1.7.0 + +10-07-2019 14:57 PDT + +### Implementation Changes +- Update docstrings, client confg (via synth). ([#9411](https://github.com/googleapis/google-cloud-python/pull/9411)) +- Remove send / receive message size limit (via synth). ([#8974](https://github.com/googleapis/google-cloud-python/pull/8974)) + +### New Features +- Add support for V3 of the API. ([#9020](https://github.com/googleapis/google-cloud-python/pull/9020)) +- Make `parent` argument required for all client methods in v3beta1; add `labels` argument (via synth). ([#9354](https://github.com/googleapis/google-cloud-python/pull/9354)) +- Add client options to translate_v2. ([#8737](https://github.com/googleapis/google-cloud-python/pull/8737)) + +### Dependencies +- Bump minimum version for google-api-core to 1.14.0. ([#8709](https://github.com/googleapis/google-cloud-python/pull/8709)) + +### Documentation +- Fix links to reference documentation. ([#8884](https://github.com/googleapis/google-cloud-python/pull/8884)) +- Link to googleapis.dev documentation in READMEs. ([#8705](https://github.com/googleapis/google-cloud-python/pull/8705)) + +### Internal / Testing Changes +- Update `ListGlossaries` method annotation (via synth) ([#9385](https://github.com/googleapis/google-cloud-python/pull/9385)) +- Fix intersphinx reference to requests ([#9294](https://github.com/googleapis/google-cloud-python/pull/9294)) +- Remove CI for gh-pages, use googleapis.dev for api_core refs. ([#9085](https://github.com/googleapis/google-cloud-python/pull/9085)) +- Update intersphinx mapping for requests. ([#8805](https://github.com/googleapis/google-cloud-python/pull/8805)) + ## 1.6.0 07-09-2019 13:13 PDT diff --git a/README.rst b/README.rst index ab1762ed..af398ee4 100644 --- a/README.rst +++ b/README.rst @@ -1,7 +1,7 @@ Python Client for Google Cloud Translation ========================================== -|GA| |pypi| |versions| +|GA| |pypi| |versions| With `Google Cloud Translation`_, you can dynamically translate text between thousands of language pairs. The Google Cloud Translation API lets websites @@ -21,7 +21,7 @@ Cloud Translation is available as a paid service. See the `Pricing`_ and .. _Google Cloud Translation: https://cloud.google.com/translate/ .. _Pricing: https://cloud.google.com/translate/pricing .. _FAQ: https://cloud.google.com/translate/faq -.. _Client Library Documentation: https://googleapis.github.io/google-cloud-python/latest/translate/usage.html +.. _Client Library Documentation: https://googleapis.dev/python/translation/latest .. _Product Documentation: https://cloud.google.com/translate/docs Quick Start @@ -37,7 +37,7 @@ In order to use this library, you first need to go through the following steps: .. _Select or create a Cloud Platform project.: https://console.cloud.google.com/project .. _Enable billing for your project.: https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project .. _Enable the Google Cloud Translate API.: https://cloud.google.com/translate -.. _Setup Authentication.: https://googleapis.github.io/google-cloud-python/latest/core/auth.html +.. _Setup Authentication.: https://googleapis.dev/python/google-api-core/latest/auth.html Installation ~~~~~~~~~~~~ diff --git a/docs/conf.py b/docs/conf.py index c0014b43..15ac56f7 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -337,12 +337,9 @@ "gax": ("https://gax-python.readthedocs.org/en/latest/", None), "google-auth": ("https://google-auth.readthedocs.io/en/stable", None), "google-gax": ("https://gax-python.readthedocs.io/en/latest/", None), - "google.api_core": ( - "https://googleapis.github.io/google-cloud-python/latest", - None, - ), + "google.api_core": ("https://googleapis.dev/python/google-api-core/latest", None), "grpc": ("https://grpc.io/grpc/python/", None), - "requests": ("http://docs.python-requests.org/en/master/", None), + "requests": ("https://requests.kennethreitz.org/en/stable/", None), "fastavro": ("https://fastavro.readthedocs.io/en/stable/", None), "pandas": ("https://pandas.pydata.org/pandas-docs/stable/", None), } diff --git a/docs/gapic/v3/api.rst b/docs/gapic/v3/api.rst new file mode 100644 index 00000000..e16ef6a8 --- /dev/null +++ b/docs/gapic/v3/api.rst @@ -0,0 +1,6 @@ +Client for Cloud Translation API +================================ + +.. automodule:: google.cloud.translate_v3 + :members: + :inherited-members: \ No newline at end of file diff --git a/docs/gapic/v3/types.rst b/docs/gapic/v3/types.rst new file mode 100644 index 00000000..fb83ab06 --- /dev/null +++ b/docs/gapic/v3/types.rst @@ -0,0 +1,5 @@ +Types for Cloud Translation API Client +====================================== + +.. automodule:: google.cloud.translate_v3.types + :members: \ No newline at end of file diff --git a/docs/index.rst b/docs/index.rst index 8b370cfd..604ac048 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -1,31 +1,31 @@ .. include:: README.rst -Detailed Usage Guide +v2 Usage Guide -------------------- .. toctree:: :maxdepth: 2 usage + API Reference ------------- -A new beta release, spelled ``v3beta1``, is provided to provide for preview -of upcoming features. In order to use this, you will want to import from -``google.cloud.translate_v3beta1`` in lieu of ``google.cloud.translate``. - -.. toctree:: - :maxdepth: 2 +An API and type reference is provided for ``v3``, ``v3beta1``, and ``v2``. - gapic/v3beta1/api - gapic/v3beta1/types +By default, you will get ``v3``. A beta release, spelled ``v3beta1`` is +provided for preview of upcoming features. In order to use this, you will +want to import from ``google.cloud.translate_v3beta1`` in lieu of +``google.cloud.translate``. The previous release ``v2`` is also available. +Import from ``google.cloud.translate_v2`` to use this release. -An API and type reference is provided for v2: .. toctree:: - :maxdepth: 2 - - client + :maxdepth: 2 + + v3 + v3beta1 + v2 Changelog diff --git a/docs/v2.rst b/docs/v2.rst new file mode 100644 index 00000000..d8e7f237 --- /dev/null +++ b/docs/v2.rst @@ -0,0 +1,7 @@ +v2 +=== + +.. toctree:: + :maxdepth: 2 + + client diff --git a/docs/v3.rst b/docs/v3.rst new file mode 100644 index 00000000..b6b8cd17 --- /dev/null +++ b/docs/v3.rst @@ -0,0 +1,8 @@ +v3 +=== + +.. toctree:: + :maxdepth: 2 + + gapic/v3/api + gapic/v3/types diff --git a/docs/v3beta1.rst b/docs/v3beta1.rst new file mode 100644 index 00000000..368aed30 --- /dev/null +++ b/docs/v3beta1.rst @@ -0,0 +1,8 @@ +v3beta1 +======= + +.. toctree:: + :maxdepth: 2 + + gapic/v3beta1/api + gapic/v3beta1/types diff --git a/google/cloud/translate_v2/_http.py b/google/cloud/translate_v2/_http.py index b73f5f59..d33647c7 100644 --- a/google/cloud/translate_v2/_http.py +++ b/google/cloud/translate_v2/_http.py @@ -29,15 +29,14 @@ class Connection(_http.JSONConnection): :param client_info: (Optional) instance used to generate user agent. """ - def __init__(self, client, client_info=None): - super(Connection, self).__init__(client, client_info) + DEFAULT_API_ENDPOINT = "https://translation.googleapis.com" + def __init__(self, client, client_info=None, api_endpoint=DEFAULT_API_ENDPOINT): + super(Connection, self).__init__(client, client_info) + self.API_BASE_URL = api_endpoint self._client_info.gapic_version = __version__ self._client_info.client_library_version = __version__ - API_BASE_URL = "https://translation.googleapis.com" - """The base of the API call URL.""" - API_VERSION = "v2" """The version of the API, used in building the API call's URL.""" diff --git a/google/cloud/translate_v2/client.py b/google/cloud/translate_v2/client.py index 9e7e4d35..6c561675 100644 --- a/google/cloud/translate_v2/client.py +++ b/google/cloud/translate_v2/client.py @@ -17,6 +17,7 @@ import six +import google.api_core.client_options from google.cloud.client import Client as BaseClient from google.cloud.translate_v2._http import Connection @@ -61,6 +62,9 @@ class Client(BaseClient): requests. If ``None``, then default info will be used. Generally, you only need to set this if you're developing your own library or partner tool. + :type client_options: :class:`~google.api_core.client_options.ClientOptions` or :class:`dict` + :param client_options: (Optional) Client options used to set user options on the client. + API Endpoint should be set through client_options. """ SCOPE = ("https://www.googleapis.com/auth/cloud-platform",) @@ -72,10 +76,22 @@ def __init__( credentials=None, _http=None, client_info=None, + client_options=None, ): self.target_language = target_language super(Client, self).__init__(credentials=credentials, _http=_http) - self._connection = Connection(self, client_info=client_info) + + kw_args = {"client_info": client_info} + if client_options: + if type(client_options) == dict: + client_options = google.api_core.client_options.from_dict( + client_options + ) + if client_options.api_endpoint: + api_endpoint = client_options.api_endpoint + kw_args["api_endpoint"] = api_endpoint + + self._connection = Connection(self, **kw_args) def get_languages(self, target_language=None): """Get list of supported languages for translation. diff --git a/google/cloud/translate_v3/__init__.py b/google/cloud/translate_v3/__init__.py new file mode 100644 index 00000000..f4e61721 --- /dev/null +++ b/google/cloud/translate_v3/__init__.py @@ -0,0 +1,28 @@ +# -*- coding: utf-8 -*- +# +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +from __future__ import absolute_import + +from google.cloud.translate_v3 import types +from google.cloud.translate_v3.gapic import translation_service_client + + +class TranslationServiceClient(translation_service_client.TranslationServiceClient): + __doc__ = translation_service_client.TranslationServiceClient.__doc__ + + +__all__ = ("types", "TranslationServiceClient") diff --git a/google/cloud/translate_v3/gapic/__init__.py b/google/cloud/translate_v3/gapic/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/google/cloud/translate_v3/gapic/enums.py b/google/cloud/translate_v3/gapic/enums.py new file mode 100644 index 00000000..051328da --- /dev/null +++ b/google/cloud/translate_v3/gapic/enums.py @@ -0,0 +1,91 @@ +# -*- coding: utf-8 -*- +# +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""Wrappers for protocol buffer enum types.""" + +import enum + + +class BatchTranslateMetadata(object): + class State(enum.IntEnum): + """ + State of the job. + + Attributes: + STATE_UNSPECIFIED (int): Invalid. + RUNNING (int): Request is being processed. + SUCCEEDED (int): The batch is processed, and at least one item was successfully + processed. + FAILED (int): The batch is done and no item was successfully processed. + CANCELLING (int): Request is in the process of being canceled after caller invoked + longrunning.Operations.CancelOperation on the request id. + CANCELLED (int): The batch is done after the user has called the + longrunning.Operations.CancelOperation. Any records processed before the + cancel command are output as specified in the request. + """ + + STATE_UNSPECIFIED = 0 + RUNNING = 1 + SUCCEEDED = 2 + FAILED = 3 + CANCELLING = 4 + CANCELLED = 5 + + +class CreateGlossaryMetadata(object): + class State(enum.IntEnum): + """ + Enumerates the possible states that the creation request can be in. + + Attributes: + STATE_UNSPECIFIED (int): Invalid. + RUNNING (int): Request is being processed. + SUCCEEDED (int): The glossary was successfully created. + FAILED (int): Failed to create the glossary. + CANCELLING (int): Request is in the process of being canceled after caller invoked + longrunning.Operations.CancelOperation on the request id. + CANCELLED (int): The glossary creation request was successfully canceled. + """ + + STATE_UNSPECIFIED = 0 + RUNNING = 1 + SUCCEEDED = 2 + FAILED = 3 + CANCELLING = 4 + CANCELLED = 5 + + +class DeleteGlossaryMetadata(object): + class State(enum.IntEnum): + """ + Enumerates the possible states that the creation request can be in. + + Attributes: + STATE_UNSPECIFIED (int): Invalid. + RUNNING (int): Request is being processed. + SUCCEEDED (int): The glossary was successfully deleted. + FAILED (int): Failed to delete the glossary. + CANCELLING (int): Request is in the process of being canceled after caller invoked + longrunning.Operations.CancelOperation on the request id. + CANCELLED (int): The glossary deletion request was successfully canceled. + """ + + STATE_UNSPECIFIED = 0 + RUNNING = 1 + SUCCEEDED = 2 + FAILED = 3 + CANCELLING = 4 + CANCELLED = 5 diff --git a/google/cloud/translate_v3/gapic/translation_service_client.py b/google/cloud/translate_v3/gapic/translation_service_client.py new file mode 100644 index 00000000..c993c434 --- /dev/null +++ b/google/cloud/translate_v3/gapic/translation_service_client.py @@ -0,0 +1,1099 @@ +# -*- coding: utf-8 -*- +# +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""Accesses the google.cloud.translation.v3 TranslationService API.""" + +import functools +import pkg_resources +import warnings + +from google.oauth2 import service_account +import google.api_core.client_options +import google.api_core.gapic_v1.client_info +import google.api_core.gapic_v1.config +import google.api_core.gapic_v1.method +import google.api_core.gapic_v1.routing_header +import google.api_core.grpc_helpers +import google.api_core.operation +import google.api_core.operations_v1 +import google.api_core.page_iterator +import google.api_core.path_template +import google.api_core.protobuf_helpers +import grpc + +from google.cloud.translate_v3.gapic import translation_service_client_config +from google.cloud.translate_v3.gapic.transports import ( + translation_service_grpc_transport, +) +from google.cloud.translate_v3.proto import translation_service_pb2 +from google.cloud.translate_v3.proto import translation_service_pb2_grpc +from google.longrunning import operations_pb2 + + +_GAPIC_LIBRARY_VERSION = pkg_resources.get_distribution( + "google-cloud-translate" +).version + + +class TranslationServiceClient(object): + """Provides natural language translation operations.""" + + SERVICE_ADDRESS = "translate.googleapis.com:443" + """The default address of the service.""" + + # The name of the interface for this client. This is the key used to + # find the method configuration in the client_config dictionary. + _INTERFACE_NAME = "google.cloud.translation.v3.TranslationService" + + @classmethod + def from_service_account_file(cls, filename, *args, **kwargs): + """Creates an instance of this client using the provided credentials + file. + + Args: + filename (str): The path to the service account private key json + file. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + TranslationServiceClient: The constructed client. + """ + credentials = service_account.Credentials.from_service_account_file(filename) + kwargs["credentials"] = credentials + return cls(*args, **kwargs) + + from_service_account_json = from_service_account_file + + @classmethod + def glossary_path(cls, project, location, glossary): + """Return a fully-qualified glossary string.""" + return google.api_core.path_template.expand( + "projects/{project}/locations/{location}/glossaries/{glossary}", + project=project, + location=location, + glossary=glossary, + ) + + @classmethod + def location_path(cls, project, location): + """Return a fully-qualified location string.""" + return google.api_core.path_template.expand( + "projects/{project}/locations/{location}", + project=project, + location=location, + ) + + def __init__( + self, + transport=None, + channel=None, + credentials=None, + client_config=None, + client_info=None, + client_options=None, + ): + """Constructor. + + Args: + transport (Union[~.TranslationServiceGrpcTransport, + Callable[[~.Credentials, type], ~.TranslationServiceGrpcTransport]): A transport + instance, responsible for actually making the API calls. + The default transport uses the gRPC protocol. + This argument may also be a callable which returns a + transport instance. Callables will be sent the credentials + as the first argument and the default transport class as + the second argument. + channel (grpc.Channel): DEPRECATED. A ``Channel`` instance + through which to make calls. This argument is mutually exclusive + with ``credentials``; providing both will raise an exception. + credentials (google.auth.credentials.Credentials): The + authorization credentials to attach to requests. These + credentials identify this application to the service. If none + are specified, the client will attempt to ascertain the + credentials from the environment. + This argument is mutually exclusive with providing a + transport instance to ``transport``; doing so will raise + an exception. + client_config (dict): DEPRECATED. A dictionary of call options for + each method. If not specified, the default configuration is used. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. + client_options (Union[dict, google.api_core.client_options.ClientOptions]): + Client options used to set user options on the client. API Endpoint + should be set through client_options. + """ + # Raise deprecation warnings for things we want to go away. + if client_config is not None: + warnings.warn( + "The `client_config` argument is deprecated.", + PendingDeprecationWarning, + stacklevel=2, + ) + else: + client_config = translation_service_client_config.config + + if channel: + warnings.warn( + "The `channel` argument is deprecated; use " "`transport` instead.", + PendingDeprecationWarning, + stacklevel=2, + ) + + api_endpoint = self.SERVICE_ADDRESS + if client_options: + if type(client_options) == dict: + client_options = google.api_core.client_options.from_dict( + client_options + ) + if client_options.api_endpoint: + api_endpoint = client_options.api_endpoint + + # Instantiate the transport. + # The transport is responsible for handling serialization and + # deserialization and actually sending data to the service. + if transport: + if callable(transport): + self.transport = transport( + credentials=credentials, + default_class=translation_service_grpc_transport.TranslationServiceGrpcTransport, + address=api_endpoint, + ) + else: + if credentials: + raise ValueError( + "Received both a transport instance and " + "credentials; these are mutually exclusive." + ) + self.transport = transport + else: + self.transport = translation_service_grpc_transport.TranslationServiceGrpcTransport( + address=api_endpoint, channel=channel, credentials=credentials + ) + + if client_info is None: + client_info = google.api_core.gapic_v1.client_info.ClientInfo( + gapic_version=_GAPIC_LIBRARY_VERSION + ) + else: + client_info.gapic_version = _GAPIC_LIBRARY_VERSION + self._client_info = client_info + + # Parse out the default settings for retry and timeout for each RPC + # from the client configuration. + # (Ordinarily, these are the defaults specified in the `*_config.py` + # file next to this one.) + self._method_configs = google.api_core.gapic_v1.config.parse_method_configs( + client_config["interfaces"][self._INTERFACE_NAME] + ) + + # Save a dictionary of cached API call functions. + # These are the actual callables which invoke the proper + # transport methods, wrapped with `wrap_method` to add retry, + # timeout, and the like. + self._inner_api_calls = {} + + # Service calls + def translate_text( + self, + contents, + target_language_code, + parent, + mime_type=None, + source_language_code=None, + model=None, + glossary_config=None, + labels=None, + retry=google.api_core.gapic_v1.method.DEFAULT, + timeout=google.api_core.gapic_v1.method.DEFAULT, + metadata=None, + ): + """ + Translates input text and returns translated text. + + Example: + >>> from google.cloud import translate_v3 + >>> + >>> client = translate_v3.TranslationServiceClient() + >>> + >>> # TODO: Initialize `contents`: + >>> contents = [] + >>> + >>> # TODO: Initialize `target_language_code`: + >>> target_language_code = '' + >>> parent = client.location_path('[PROJECT]', '[LOCATION]') + >>> + >>> response = client.translate_text(contents, target_language_code, parent) + + Args: + contents (list[str]): Required. The content of the input in string format. + We recommend the total content be less than 30k codepoints. + Use BatchTranslateText for larger text. + target_language_code (str): Required. The BCP-47 language code to use for translation of the input + text, set to one of the language codes listed in Language Support. + parent (str): Required. Project or location to make a call. Must refer to a caller's + project. + + Format: ``projects/{project-number-or-id}`` or + ``projects/{project-number-or-id}/locations/{location-id}``. + + For global calls, use + ``projects/{project-number-or-id}/locations/global`` or + ``projects/{project-number-or-id}``. + + Non-global location is required for requests using AutoML models or + custom glossaries. + + Models and glossaries must be within the same region (have same + location-id), otherwise an INVALID\_ARGUMENT (400) error is returned. + mime_type (str): Optional. The format of the source text, for example, "text/html", + "text/plain". If left blank, the MIME type defaults to "text/html". + source_language_code (str): Optional. The BCP-47 language code of the input text if + known, for example, "en-US" or "sr-Latn". Supported language codes are + listed in Language Support. If the source language isn't specified, the API + attempts to identify the source language automatically and returns the + source language within the response. + model (str): Optional. The ``model`` type requested for this translation. + + The format depends on model type: + + - AutoML Translation models: + ``projects/{project-number-or-id}/locations/{location-id}/models/{model-id}`` + + - General (built-in) models: + ``projects/{project-number-or-id}/locations/{location-id}/models/general/nmt``, + ``projects/{project-number-or-id}/locations/{location-id}/models/general/base`` + + For global (non-regionalized) requests, use ``location-id`` ``global``. + For example, + ``projects/{project-number-or-id}/locations/global/models/general/nmt``. + + If missing, the system decides which google base model to use. + glossary_config (Union[dict, ~google.cloud.translate_v3.types.TranslateTextGlossaryConfig]): Optional. Glossary to be applied. The glossary must be within the same + region (have the same location-id) as the model, otherwise an + INVALID\_ARGUMENT (400) error is returned. + + If a dict is provided, it must be of the same form as the protobuf + message :class:`~google.cloud.translate_v3.types.TranslateTextGlossaryConfig` + labels (dict[str -> str]): Optional. The labels with user-defined metadata for the request. + + Label keys and values can be no longer than 63 characters + (Unicode codepoints), can only contain lowercase letters, numeric + characters, underscores and dashes. International characters are allowed. + Label values are optional. Label keys must start with a letter. + + See https://cloud.google.com/translate/docs/labels for more information. + retry (Optional[google.api_core.retry.Retry]): A retry object used + to retry requests. If ``None`` is specified, requests will + be retried using a default configuration. + timeout (Optional[float]): The amount of time, in seconds, to wait + for the request to complete. Note that if ``retry`` is + specified, the timeout applies to each individual attempt. + metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata + that is provided to the method. + + Returns: + A :class:`~google.cloud.translate_v3.types.TranslateTextResponse` instance. + + Raises: + google.api_core.exceptions.GoogleAPICallError: If the request + failed for any reason. + google.api_core.exceptions.RetryError: If the request failed due + to a retryable error and retry attempts failed. + ValueError: If the parameters are invalid. + """ + # Wrap the transport method to add retry and timeout logic. + if "translate_text" not in self._inner_api_calls: + self._inner_api_calls[ + "translate_text" + ] = google.api_core.gapic_v1.method.wrap_method( + self.transport.translate_text, + default_retry=self._method_configs["TranslateText"].retry, + default_timeout=self._method_configs["TranslateText"].timeout, + client_info=self._client_info, + ) + + request = translation_service_pb2.TranslateTextRequest( + contents=contents, + target_language_code=target_language_code, + parent=parent, + mime_type=mime_type, + source_language_code=source_language_code, + model=model, + glossary_config=glossary_config, + labels=labels, + ) + if metadata is None: + metadata = [] + metadata = list(metadata) + try: + routing_header = [("parent", parent)] + except AttributeError: + pass + else: + routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( + routing_header + ) + metadata.append(routing_metadata) + + return self._inner_api_calls["translate_text"]( + request, retry=retry, timeout=timeout, metadata=metadata + ) + + def detect_language( + self, + parent, + model=None, + content=None, + mime_type=None, + labels=None, + retry=google.api_core.gapic_v1.method.DEFAULT, + timeout=google.api_core.gapic_v1.method.DEFAULT, + metadata=None, + ): + """ + Detects the language of text within a request. + + Example: + >>> from google.cloud import translate_v3 + >>> + >>> client = translate_v3.TranslationServiceClient() + >>> + >>> parent = client.location_path('[PROJECT]', '[LOCATION]') + >>> + >>> response = client.detect_language(parent) + + Args: + parent (str): Required. Project or location to make a call. Must refer to a caller's + project. + + Format: ``projects/{project-number-or-id}/locations/{location-id}`` or + ``projects/{project-number-or-id}``. + + For global calls, use + ``projects/{project-number-or-id}/locations/global`` or + ``projects/{project-number-or-id}``. + + Only models within the same region (has same location-id) can be used. + Otherwise an INVALID\_ARGUMENT (400) error is returned. + model (str): Optional. The language detection model to be used. + + Format: + ``projects/{project-number-or-id}/locations/{location-id}/models/language-detection/{model-id}`` + + Only one language detection model is currently supported: + ``projects/{project-number-or-id}/locations/{location-id}/models/language-detection/default``. + + If not specified, the default model is used. + content (str): The content of the input stored as a string. + mime_type (str): Optional. The format of the source text, for example, "text/html", + "text/plain". If left blank, the MIME type defaults to "text/html". + labels (dict[str -> str]): Optional. The labels with user-defined metadata for the request. + + Label keys and values can be no longer than 63 characters + (Unicode codepoints), can only contain lowercase letters, numeric + characters, underscores and dashes. International characters are allowed. + Label values are optional. Label keys must start with a letter. + + See https://cloud.google.com/translate/docs/labels for more information. + retry (Optional[google.api_core.retry.Retry]): A retry object used + to retry requests. If ``None`` is specified, requests will + be retried using a default configuration. + timeout (Optional[float]): The amount of time, in seconds, to wait + for the request to complete. Note that if ``retry`` is + specified, the timeout applies to each individual attempt. + metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata + that is provided to the method. + + Returns: + A :class:`~google.cloud.translate_v3.types.DetectLanguageResponse` instance. + + Raises: + google.api_core.exceptions.GoogleAPICallError: If the request + failed for any reason. + google.api_core.exceptions.RetryError: If the request failed due + to a retryable error and retry attempts failed. + ValueError: If the parameters are invalid. + """ + # Wrap the transport method to add retry and timeout logic. + if "detect_language" not in self._inner_api_calls: + self._inner_api_calls[ + "detect_language" + ] = google.api_core.gapic_v1.method.wrap_method( + self.transport.detect_language, + default_retry=self._method_configs["DetectLanguage"].retry, + default_timeout=self._method_configs["DetectLanguage"].timeout, + client_info=self._client_info, + ) + + # Sanity check: We have some fields which are mutually exclusive; + # raise ValueError if more than one is sent. + google.api_core.protobuf_helpers.check_oneof(content=content) + + request = translation_service_pb2.DetectLanguageRequest( + parent=parent, + model=model, + content=content, + mime_type=mime_type, + labels=labels, + ) + if metadata is None: + metadata = [] + metadata = list(metadata) + try: + routing_header = [("parent", parent)] + except AttributeError: + pass + else: + routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( + routing_header + ) + metadata.append(routing_metadata) + + return self._inner_api_calls["detect_language"]( + request, retry=retry, timeout=timeout, metadata=metadata + ) + + def get_supported_languages( + self, + parent, + display_language_code=None, + model=None, + retry=google.api_core.gapic_v1.method.DEFAULT, + timeout=google.api_core.gapic_v1.method.DEFAULT, + metadata=None, + ): + """ + Returns a list of supported languages for translation. + + Example: + >>> from google.cloud import translate_v3 + >>> + >>> client = translate_v3.TranslationServiceClient() + >>> + >>> parent = client.location_path('[PROJECT]', '[LOCATION]') + >>> + >>> response = client.get_supported_languages(parent) + + Args: + parent (str): Required. Project or location to make a call. Must refer to a caller's + project. + + Format: ``projects/{project-number-or-id}`` or + ``projects/{project-number-or-id}/locations/{location-id}``. + + For global calls, use + ``projects/{project-number-or-id}/locations/global`` or + ``projects/{project-number-or-id}``. + + Non-global location is required for AutoML models. + + Only models within the same region (have same location-id) can be used, + otherwise an INVALID\_ARGUMENT (400) error is returned. + display_language_code (str): Optional. The language to use to return localized, human readable names + of supported languages. If missing, then display names are not returned + in a response. + model (str): Optional. Get supported languages of this model. + + The format depends on model type: + + - AutoML Translation models: + ``projects/{project-number-or-id}/locations/{location-id}/models/{model-id}`` + + - General (built-in) models: + ``projects/{project-number-or-id}/locations/{location-id}/models/general/nmt``, + ``projects/{project-number-or-id}/locations/{location-id}/models/general/base`` + + Returns languages supported by the specified model. If missing, we get + supported languages of Google general base (PBMT) model. + retry (Optional[google.api_core.retry.Retry]): A retry object used + to retry requests. If ``None`` is specified, requests will + be retried using a default configuration. + timeout (Optional[float]): The amount of time, in seconds, to wait + for the request to complete. Note that if ``retry`` is + specified, the timeout applies to each individual attempt. + metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata + that is provided to the method. + + Returns: + A :class:`~google.cloud.translate_v3.types.SupportedLanguages` instance. + + Raises: + google.api_core.exceptions.GoogleAPICallError: If the request + failed for any reason. + google.api_core.exceptions.RetryError: If the request failed due + to a retryable error and retry attempts failed. + ValueError: If the parameters are invalid. + """ + # Wrap the transport method to add retry and timeout logic. + if "get_supported_languages" not in self._inner_api_calls: + self._inner_api_calls[ + "get_supported_languages" + ] = google.api_core.gapic_v1.method.wrap_method( + self.transport.get_supported_languages, + default_retry=self._method_configs["GetSupportedLanguages"].retry, + default_timeout=self._method_configs["GetSupportedLanguages"].timeout, + client_info=self._client_info, + ) + + request = translation_service_pb2.GetSupportedLanguagesRequest( + parent=parent, display_language_code=display_language_code, model=model + ) + if metadata is None: + metadata = [] + metadata = list(metadata) + try: + routing_header = [("parent", parent)] + except AttributeError: + pass + else: + routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( + routing_header + ) + metadata.append(routing_metadata) + + return self._inner_api_calls["get_supported_languages"]( + request, retry=retry, timeout=timeout, metadata=metadata + ) + + def batch_translate_text( + self, + parent, + source_language_code, + target_language_codes, + input_configs, + output_config, + models=None, + glossaries=None, + labels=None, + retry=google.api_core.gapic_v1.method.DEFAULT, + timeout=google.api_core.gapic_v1.method.DEFAULT, + metadata=None, + ): + """ + Translates a large volume of text in asynchronous batch mode. + This function provides real-time output as the inputs are being processed. + If caller cancels a request, the partial results (for an input file, it's + all or nothing) may still be available on the specified output location. + + This call returns immediately and you can + use google.longrunning.Operation.name to poll the status of the call. + + Example: + >>> from google.cloud import translate_v3 + >>> + >>> client = translate_v3.TranslationServiceClient() + >>> + >>> parent = client.location_path('[PROJECT]', '[LOCATION]') + >>> + >>> # TODO: Initialize `source_language_code`: + >>> source_language_code = '' + >>> + >>> # TODO: Initialize `target_language_codes`: + >>> target_language_codes = [] + >>> + >>> # TODO: Initialize `input_configs`: + >>> input_configs = [] + >>> + >>> # TODO: Initialize `output_config`: + >>> output_config = {} + >>> + >>> response = client.batch_translate_text(parent, source_language_code, target_language_codes, input_configs, output_config) + >>> + >>> def callback(operation_future): + ... # Handle result. + ... result = operation_future.result() + >>> + >>> response.add_done_callback(callback) + >>> + >>> # Handle metadata. + >>> metadata = response.metadata() + + Args: + parent (str): Required. Location to make a call. Must refer to a caller's project. + + Format: ``projects/{project-number-or-id}/locations/{location-id}``. + + The ``global`` location is not supported for batch translation. + + Only AutoML Translation models or glossaries within the same region + (have the same location-id) can be used, otherwise an INVALID\_ARGUMENT + (400) error is returned. + source_language_code (str): Required. Source language code. + target_language_codes (list[str]): Required. Specify up to 10 language codes here. + input_configs (list[Union[dict, ~google.cloud.translate_v3.types.InputConfig]]): Required. Input configurations. + The total number of files matched should be <= 1000. + The total content size should be <= 100M Unicode codepoints. + The files must use UTF-8 encoding. + + If a dict is provided, it must be of the same form as the protobuf + message :class:`~google.cloud.translate_v3.types.InputConfig` + output_config (Union[dict, ~google.cloud.translate_v3.types.OutputConfig]): Required. Output configuration. + If 2 input configs match to the same file (that is, same input path), + we don't generate output for duplicate inputs. + + If a dict is provided, it must be of the same form as the protobuf + message :class:`~google.cloud.translate_v3.types.OutputConfig` + models (dict[str -> str]): Optional. The models to use for translation. Map's key is target + language code. Map's value is model name. Value can be a built-in + general model, or an AutoML Translation model. + + The value format depends on model type: + + - AutoML Translation models: + ``projects/{project-number-or-id}/locations/{location-id}/models/{model-id}`` + + - General (built-in) models: + ``projects/{project-number-or-id}/locations/{location-id}/models/general/nmt``, + ``projects/{project-number-or-id}/locations/{location-id}/models/general/base`` + + If the map is empty or a specific model is not requested for a language + pair, then default google model (nmt) is used. + glossaries (dict[str -> Union[dict, ~google.cloud.translate_v3.types.TranslateTextGlossaryConfig]]): Optional. Glossaries to be applied for translation. + It's keyed by target language code. + + If a dict is provided, it must be of the same form as the protobuf + message :class:`~google.cloud.translate_v3.types.TranslateTextGlossaryConfig` + labels (dict[str -> str]): Optional. The labels with user-defined metadata for the request. + + Label keys and values can be no longer than 63 characters + (Unicode codepoints), can only contain lowercase letters, numeric + characters, underscores and dashes. International characters are allowed. + Label values are optional. Label keys must start with a letter. + + See https://cloud.google.com/translate/docs/labels for more information. + retry (Optional[google.api_core.retry.Retry]): A retry object used + to retry requests. If ``None`` is specified, requests will + be retried using a default configuration. + timeout (Optional[float]): The amount of time, in seconds, to wait + for the request to complete. Note that if ``retry`` is + specified, the timeout applies to each individual attempt. + metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata + that is provided to the method. + + Returns: + A :class:`~google.cloud.translate_v3.types._OperationFuture` instance. + + Raises: + google.api_core.exceptions.GoogleAPICallError: If the request + failed for any reason. + google.api_core.exceptions.RetryError: If the request failed due + to a retryable error and retry attempts failed. + ValueError: If the parameters are invalid. + """ + # Wrap the transport method to add retry and timeout logic. + if "batch_translate_text" not in self._inner_api_calls: + self._inner_api_calls[ + "batch_translate_text" + ] = google.api_core.gapic_v1.method.wrap_method( + self.transport.batch_translate_text, + default_retry=self._method_configs["BatchTranslateText"].retry, + default_timeout=self._method_configs["BatchTranslateText"].timeout, + client_info=self._client_info, + ) + + request = translation_service_pb2.BatchTranslateTextRequest( + parent=parent, + source_language_code=source_language_code, + target_language_codes=target_language_codes, + input_configs=input_configs, + output_config=output_config, + models=models, + glossaries=glossaries, + labels=labels, + ) + if metadata is None: + metadata = [] + metadata = list(metadata) + try: + routing_header = [("parent", parent)] + except AttributeError: + pass + else: + routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( + routing_header + ) + metadata.append(routing_metadata) + + operation = self._inner_api_calls["batch_translate_text"]( + request, retry=retry, timeout=timeout, metadata=metadata + ) + return google.api_core.operation.from_gapic( + operation, + self.transport._operations_client, + translation_service_pb2.BatchTranslateResponse, + metadata_type=translation_service_pb2.BatchTranslateMetadata, + ) + + def create_glossary( + self, + parent, + glossary, + retry=google.api_core.gapic_v1.method.DEFAULT, + timeout=google.api_core.gapic_v1.method.DEFAULT, + metadata=None, + ): + """ + Creates a glossary and returns the long-running operation. Returns + NOT\_FOUND, if the project doesn't exist. + + Example: + >>> from google.cloud import translate_v3 + >>> + >>> client = translate_v3.TranslationServiceClient() + >>> + >>> parent = client.location_path('[PROJECT]', '[LOCATION]') + >>> + >>> # TODO: Initialize `glossary`: + >>> glossary = {} + >>> + >>> response = client.create_glossary(parent, glossary) + >>> + >>> def callback(operation_future): + ... # Handle result. + ... result = operation_future.result() + >>> + >>> response.add_done_callback(callback) + >>> + >>> # Handle metadata. + >>> metadata = response.metadata() + + Args: + parent (str): Required. The project name. + glossary (Union[dict, ~google.cloud.translate_v3.types.Glossary]): Required. The glossary to create. + + If a dict is provided, it must be of the same form as the protobuf + message :class:`~google.cloud.translate_v3.types.Glossary` + retry (Optional[google.api_core.retry.Retry]): A retry object used + to retry requests. If ``None`` is specified, requests will + be retried using a default configuration. + timeout (Optional[float]): The amount of time, in seconds, to wait + for the request to complete. Note that if ``retry`` is + specified, the timeout applies to each individual attempt. + metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata + that is provided to the method. + + Returns: + A :class:`~google.cloud.translate_v3.types._OperationFuture` instance. + + Raises: + google.api_core.exceptions.GoogleAPICallError: If the request + failed for any reason. + google.api_core.exceptions.RetryError: If the request failed due + to a retryable error and retry attempts failed. + ValueError: If the parameters are invalid. + """ + # Wrap the transport method to add retry and timeout logic. + if "create_glossary" not in self._inner_api_calls: + self._inner_api_calls[ + "create_glossary" + ] = google.api_core.gapic_v1.method.wrap_method( + self.transport.create_glossary, + default_retry=self._method_configs["CreateGlossary"].retry, + default_timeout=self._method_configs["CreateGlossary"].timeout, + client_info=self._client_info, + ) + + request = translation_service_pb2.CreateGlossaryRequest( + parent=parent, glossary=glossary + ) + if metadata is None: + metadata = [] + metadata = list(metadata) + try: + routing_header = [("parent", parent)] + except AttributeError: + pass + else: + routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( + routing_header + ) + metadata.append(routing_metadata) + + operation = self._inner_api_calls["create_glossary"]( + request, retry=retry, timeout=timeout, metadata=metadata + ) + return google.api_core.operation.from_gapic( + operation, + self.transport._operations_client, + translation_service_pb2.Glossary, + metadata_type=translation_service_pb2.CreateGlossaryMetadata, + ) + + def list_glossaries( + self, + parent, + page_size=None, + filter_=None, + retry=google.api_core.gapic_v1.method.DEFAULT, + timeout=google.api_core.gapic_v1.method.DEFAULT, + metadata=None, + ): + """ + Lists glossaries in a project. Returns NOT\_FOUND, if the project + doesn't exist. + + Example: + >>> from google.cloud import translate_v3 + >>> + >>> client = translate_v3.TranslationServiceClient() + >>> + >>> parent = client.location_path('[PROJECT]', '[LOCATION]') + >>> + >>> # Iterate over all results + >>> for element in client.list_glossaries(parent): + ... # process element + ... pass + >>> + >>> + >>> # Alternatively: + >>> + >>> # Iterate over results one page at a time + >>> for page in client.list_glossaries(parent).pages: + ... for element in page: + ... # process element + ... pass + + Args: + parent (str): Required. The name of the project from which to list all of the glossaries. + page_size (int): The maximum number of resources contained in the + underlying API response. If page streaming is performed per- + resource, this parameter does not affect the return value. If page + streaming is performed per-page, this determines the maximum number + of resources in a page. + filter_ (str): Optional. Filter specifying constraints of a list operation. + Filtering is not supported yet, and the parameter currently has no effect. + If missing, no filtering is performed. + retry (Optional[google.api_core.retry.Retry]): A retry object used + to retry requests. If ``None`` is specified, requests will + be retried using a default configuration. + timeout (Optional[float]): The amount of time, in seconds, to wait + for the request to complete. Note that if ``retry`` is + specified, the timeout applies to each individual attempt. + metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata + that is provided to the method. + + Returns: + A :class:`~google.api_core.page_iterator.PageIterator` instance. + An iterable of :class:`~google.cloud.translate_v3.types.Glossary` instances. + You can also iterate over the pages of the response + using its `pages` property. + + Raises: + google.api_core.exceptions.GoogleAPICallError: If the request + failed for any reason. + google.api_core.exceptions.RetryError: If the request failed due + to a retryable error and retry attempts failed. + ValueError: If the parameters are invalid. + """ + # Wrap the transport method to add retry and timeout logic. + if "list_glossaries" not in self._inner_api_calls: + self._inner_api_calls[ + "list_glossaries" + ] = google.api_core.gapic_v1.method.wrap_method( + self.transport.list_glossaries, + default_retry=self._method_configs["ListGlossaries"].retry, + default_timeout=self._method_configs["ListGlossaries"].timeout, + client_info=self._client_info, + ) + + request = translation_service_pb2.ListGlossariesRequest( + parent=parent, page_size=page_size, filter=filter_ + ) + if metadata is None: + metadata = [] + metadata = list(metadata) + try: + routing_header = [("parent", parent)] + except AttributeError: + pass + else: + routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( + routing_header + ) + metadata.append(routing_metadata) + + iterator = google.api_core.page_iterator.GRPCIterator( + client=None, + method=functools.partial( + self._inner_api_calls["list_glossaries"], + retry=retry, + timeout=timeout, + metadata=metadata, + ), + request=request, + items_field="glossaries", + request_token_field="page_token", + response_token_field="next_page_token", + ) + return iterator + + def get_glossary( + self, + name, + retry=google.api_core.gapic_v1.method.DEFAULT, + timeout=google.api_core.gapic_v1.method.DEFAULT, + metadata=None, + ): + """ + Gets a glossary. Returns NOT\_FOUND, if the glossary doesn't exist. + + Example: + >>> from google.cloud import translate_v3 + >>> + >>> client = translate_v3.TranslationServiceClient() + >>> + >>> name = client.glossary_path('[PROJECT]', '[LOCATION]', '[GLOSSARY]') + >>> + >>> response = client.get_glossary(name) + + Args: + name (str): Required. The name of the glossary to retrieve. + retry (Optional[google.api_core.retry.Retry]): A retry object used + to retry requests. If ``None`` is specified, requests will + be retried using a default configuration. + timeout (Optional[float]): The amount of time, in seconds, to wait + for the request to complete. Note that if ``retry`` is + specified, the timeout applies to each individual attempt. + metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata + that is provided to the method. + + Returns: + A :class:`~google.cloud.translate_v3.types.Glossary` instance. + + Raises: + google.api_core.exceptions.GoogleAPICallError: If the request + failed for any reason. + google.api_core.exceptions.RetryError: If the request failed due + to a retryable error and retry attempts failed. + ValueError: If the parameters are invalid. + """ + # Wrap the transport method to add retry and timeout logic. + if "get_glossary" not in self._inner_api_calls: + self._inner_api_calls[ + "get_glossary" + ] = google.api_core.gapic_v1.method.wrap_method( + self.transport.get_glossary, + default_retry=self._method_configs["GetGlossary"].retry, + default_timeout=self._method_configs["GetGlossary"].timeout, + client_info=self._client_info, + ) + + request = translation_service_pb2.GetGlossaryRequest(name=name) + if metadata is None: + metadata = [] + metadata = list(metadata) + try: + routing_header = [("name", name)] + except AttributeError: + pass + else: + routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( + routing_header + ) + metadata.append(routing_metadata) + + return self._inner_api_calls["get_glossary"]( + request, retry=retry, timeout=timeout, metadata=metadata + ) + + def delete_glossary( + self, + name, + retry=google.api_core.gapic_v1.method.DEFAULT, + timeout=google.api_core.gapic_v1.method.DEFAULT, + metadata=None, + ): + """ + Deletes a glossary, or cancels glossary construction if the glossary + isn't created yet. Returns NOT\_FOUND, if the glossary doesn't exist. + + Example: + >>> from google.cloud import translate_v3 + >>> + >>> client = translate_v3.TranslationServiceClient() + >>> + >>> name = client.glossary_path('[PROJECT]', '[LOCATION]', '[GLOSSARY]') + >>> + >>> response = client.delete_glossary(name) + >>> + >>> def callback(operation_future): + ... # Handle result. + ... result = operation_future.result() + >>> + >>> response.add_done_callback(callback) + >>> + >>> # Handle metadata. + >>> metadata = response.metadata() + + Args: + name (str): Required. The name of the glossary to delete. + retry (Optional[google.api_core.retry.Retry]): A retry object used + to retry requests. If ``None`` is specified, requests will + be retried using a default configuration. + timeout (Optional[float]): The amount of time, in seconds, to wait + for the request to complete. Note that if ``retry`` is + specified, the timeout applies to each individual attempt. + metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata + that is provided to the method. + + Returns: + A :class:`~google.cloud.translate_v3.types._OperationFuture` instance. + + Raises: + google.api_core.exceptions.GoogleAPICallError: If the request + failed for any reason. + google.api_core.exceptions.RetryError: If the request failed due + to a retryable error and retry attempts failed. + ValueError: If the parameters are invalid. + """ + # Wrap the transport method to add retry and timeout logic. + if "delete_glossary" not in self._inner_api_calls: + self._inner_api_calls[ + "delete_glossary" + ] = google.api_core.gapic_v1.method.wrap_method( + self.transport.delete_glossary, + default_retry=self._method_configs["DeleteGlossary"].retry, + default_timeout=self._method_configs["DeleteGlossary"].timeout, + client_info=self._client_info, + ) + + request = translation_service_pb2.DeleteGlossaryRequest(name=name) + if metadata is None: + metadata = [] + metadata = list(metadata) + try: + routing_header = [("name", name)] + except AttributeError: + pass + else: + routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( + routing_header + ) + metadata.append(routing_metadata) + + operation = self._inner_api_calls["delete_glossary"]( + request, retry=retry, timeout=timeout, metadata=metadata + ) + return google.api_core.operation.from_gapic( + operation, + self.transport._operations_client, + translation_service_pb2.DeleteGlossaryResponse, + metadata_type=translation_service_pb2.DeleteGlossaryMetadata, + ) diff --git a/google/cloud/translate_v3/gapic/translation_service_client_config.py b/google/cloud/translate_v3/gapic/translation_service_client_config.py new file mode 100644 index 00000000..0e611ae4 --- /dev/null +++ b/google/cloud/translate_v3/gapic/translation_service_client_config.py @@ -0,0 +1,63 @@ +config = { + "interfaces": { + "google.cloud.translation.v3.TranslationService": { + "retry_codes": { + "idempotent": ["DEADLINE_EXCEEDED", "UNAVAILABLE"], + "non_idempotent": [], + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 20000, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 20000, + "total_timeout_millis": 600000, + } + }, + "methods": { + "TranslateText": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default", + }, + "DetectLanguage": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default", + }, + "GetSupportedLanguages": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default", + }, + "BatchTranslateText": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default", + }, + "CreateGlossary": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default", + }, + "ListGlossaries": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default", + }, + "GetGlossary": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default", + }, + "DeleteGlossary": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default", + }, + }, + } + } +} diff --git a/google/cloud/translate_v3/gapic/transports/__init__.py b/google/cloud/translate_v3/gapic/transports/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/google/cloud/translate_v3/gapic/transports/translation_service_grpc_transport.py b/google/cloud/translate_v3/gapic/transports/translation_service_grpc_transport.py new file mode 100644 index 00000000..ed038e37 --- /dev/null +++ b/google/cloud/translate_v3/gapic/transports/translation_service_grpc_transport.py @@ -0,0 +1,234 @@ +# -*- coding: utf-8 -*- +# +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +import google.api_core.grpc_helpers +import google.api_core.operations_v1 + +from google.cloud.translate_v3.proto import translation_service_pb2_grpc + + +class TranslationServiceGrpcTransport(object): + """gRPC transport class providing stubs for + google.cloud.translation.v3 TranslationService API. + + The transport provides access to the raw gRPC stubs, + which can be used to take advantage of advanced + features of gRPC. + """ + + # The scopes needed to make gRPC calls to all of the methods defined + # in this service. + _OAUTH_SCOPES = ( + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloud-translation", + ) + + def __init__( + self, channel=None, credentials=None, address="translate.googleapis.com:443" + ): + """Instantiate the transport class. + + Args: + channel (grpc.Channel): A ``Channel`` instance through + which to make calls. This argument is mutually exclusive + with ``credentials``; providing both will raise an exception. + credentials (google.auth.credentials.Credentials): The + authorization credentials to attach to requests. These + credentials identify this application to the service. If none + are specified, the client will attempt to ascertain the + credentials from the environment. + address (str): The address where the service is hosted. + """ + # If both `channel` and `credentials` are specified, raise an + # exception (channels come with credentials baked in already). + if channel is not None and credentials is not None: + raise ValueError( + "The `channel` and `credentials` arguments are mutually " "exclusive." + ) + + # Create the channel. + if channel is None: + channel = self.create_channel( + address=address, + credentials=credentials, + options={ + "grpc.max_send_message_length": -1, + "grpc.max_receive_message_length": -1, + }.items(), + ) + + self._channel = channel + + # gRPC uses objects called "stubs" that are bound to the + # channel and provide a basic method for each RPC. + self._stubs = { + "translation_service_stub": translation_service_pb2_grpc.TranslationServiceStub( + channel + ) + } + + # Because this API includes a method that returns a + # long-running operation (proto: google.longrunning.Operation), + # instantiate an LRO client. + self._operations_client = google.api_core.operations_v1.OperationsClient( + channel + ) + + @classmethod + def create_channel( + cls, address="translate.googleapis.com:443", credentials=None, **kwargs + ): + """Create and return a gRPC channel object. + + Args: + address (str): The host for the channel to use. + credentials (~.Credentials): The + authorization credentials to attach to requests. These + credentials identify this application to the service. If + none are specified, the client will attempt to ascertain + the credentials from the environment. + kwargs (dict): Keyword arguments, which are passed to the + channel creation. + + Returns: + grpc.Channel: A gRPC channel object. + """ + return google.api_core.grpc_helpers.create_channel( + address, credentials=credentials, scopes=cls._OAUTH_SCOPES, **kwargs + ) + + @property + def channel(self): + """The gRPC channel used by the transport. + + Returns: + grpc.Channel: A gRPC channel object. + """ + return self._channel + + @property + def translate_text(self): + """Return the gRPC stub for :meth:`TranslationServiceClient.translate_text`. + + Translates input text and returns translated text. + + Returns: + Callable: A callable which accepts the appropriate + deserialized request object and returns a + deserialized response object. + """ + return self._stubs["translation_service_stub"].TranslateText + + @property + def detect_language(self): + """Return the gRPC stub for :meth:`TranslationServiceClient.detect_language`. + + Detects the language of text within a request. + + Returns: + Callable: A callable which accepts the appropriate + deserialized request object and returns a + deserialized response object. + """ + return self._stubs["translation_service_stub"].DetectLanguage + + @property + def get_supported_languages(self): + """Return the gRPC stub for :meth:`TranslationServiceClient.get_supported_languages`. + + Returns a list of supported languages for translation. + + Returns: + Callable: A callable which accepts the appropriate + deserialized request object and returns a + deserialized response object. + """ + return self._stubs["translation_service_stub"].GetSupportedLanguages + + @property + def batch_translate_text(self): + """Return the gRPC stub for :meth:`TranslationServiceClient.batch_translate_text`. + + Translates a large volume of text in asynchronous batch mode. + This function provides real-time output as the inputs are being processed. + If caller cancels a request, the partial results (for an input file, it's + all or nothing) may still be available on the specified output location. + + This call returns immediately and you can + use google.longrunning.Operation.name to poll the status of the call. + + Returns: + Callable: A callable which accepts the appropriate + deserialized request object and returns a + deserialized response object. + """ + return self._stubs["translation_service_stub"].BatchTranslateText + + @property + def create_glossary(self): + """Return the gRPC stub for :meth:`TranslationServiceClient.create_glossary`. + + Creates a glossary and returns the long-running operation. Returns + NOT\_FOUND, if the project doesn't exist. + + Returns: + Callable: A callable which accepts the appropriate + deserialized request object and returns a + deserialized response object. + """ + return self._stubs["translation_service_stub"].CreateGlossary + + @property + def list_glossaries(self): + """Return the gRPC stub for :meth:`TranslationServiceClient.list_glossaries`. + + Lists glossaries in a project. Returns NOT\_FOUND, if the project + doesn't exist. + + Returns: + Callable: A callable which accepts the appropriate + deserialized request object and returns a + deserialized response object. + """ + return self._stubs["translation_service_stub"].ListGlossaries + + @property + def get_glossary(self): + """Return the gRPC stub for :meth:`TranslationServiceClient.get_glossary`. + + Gets a glossary. Returns NOT\_FOUND, if the glossary doesn't exist. + + Returns: + Callable: A callable which accepts the appropriate + deserialized request object and returns a + deserialized response object. + """ + return self._stubs["translation_service_stub"].GetGlossary + + @property + def delete_glossary(self): + """Return the gRPC stub for :meth:`TranslationServiceClient.delete_glossary`. + + Deletes a glossary, or cancels glossary construction if the glossary + isn't created yet. Returns NOT\_FOUND, if the glossary doesn't exist. + + Returns: + Callable: A callable which accepts the appropriate + deserialized request object and returns a + deserialized response object. + """ + return self._stubs["translation_service_stub"].DeleteGlossary diff --git a/google/cloud/translate_v3/proto/__init__.py b/google/cloud/translate_v3/proto/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/google/cloud/translate_v3/proto/translation_service.proto b/google/cloud/translate_v3/proto/translation_service.proto new file mode 100644 index 00000000..ad43831c --- /dev/null +++ b/google/cloud/translate_v3/proto/translation_service.proto @@ -0,0 +1,926 @@ +// Copyright 2019 Google LLC. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +syntax = "proto3"; + +package google.cloud.translation.v3; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/timestamp.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Translate.V3"; +option go_package = "google.golang.org/genproto/googleapis/cloud/translate/v3;translate"; +option java_multiple_files = true; +option java_outer_classname = "TranslationServiceProto"; +option java_package = "com.google.cloud.translate.v3"; +option php_namespace = "Google\\Cloud\\Translate\\V3"; +option ruby_package = "Google::Cloud::Translate::V3"; + +// Proto file for the Cloud Translation API (v3 GA). + +// Provides natural language translation operations. +service TranslationService { + option (google.api.default_host) = "translate.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/cloud-translation"; + + // Translates input text and returns translated text. + rpc TranslateText(TranslateTextRequest) returns (TranslateTextResponse) { + option (google.api.http) = { + post: "/v3/{parent=projects/*/locations/*}:translateText" + body: "*" + additional_bindings { + post: "/v3/{parent=projects/*}:translateText" + body: "*" + } + }; + option (google.api.method_signature) = + "parent,target_language_code,contents"; + option (google.api.method_signature) = + "parent,model,mime_type,source_language_code,target_language_code,contents"; + } + + // Detects the language of text within a request. + rpc DetectLanguage(DetectLanguageRequest) returns (DetectLanguageResponse) { + option (google.api.http) = { + post: "/v3/{parent=projects/*/locations/*}:detectLanguage" + body: "*" + additional_bindings { + post: "/v3/{parent=projects/*}:detectLanguage" + body: "*" + } + }; + option (google.api.method_signature) = "parent,model,mime_type,content"; + } + + // Returns a list of supported languages for translation. + rpc GetSupportedLanguages(GetSupportedLanguagesRequest) + returns (SupportedLanguages) { + option (google.api.http) = { + get: "/v3/{parent=projects/*/locations/*}/supportedLanguages" + additional_bindings { get: "/v3/{parent=projects/*}/supportedLanguages" } + }; + option (google.api.method_signature) = "parent,model,display_language_code"; + } + + // Translates a large volume of text in asynchronous batch mode. + // This function provides real-time output as the inputs are being processed. + // If caller cancels a request, the partial results (for an input file, it's + // all or nothing) may still be available on the specified output location. + // + // This call returns immediately and you can + // use google.longrunning.Operation.name to poll the status of the call. + rpc BatchTranslateText(BatchTranslateTextRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v3/{parent=projects/*/locations/*}:batchTranslateText" + body: "*" + }; + option (google.longrunning.operation_info) = { + response_type: "BatchTranslateResponse" + metadata_type: "BatchTranslateMetadata" + }; + } + + // Creates a glossary and returns the long-running operation. Returns + // NOT_FOUND, if the project doesn't exist. + rpc CreateGlossary(CreateGlossaryRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v3/{parent=projects/*/locations/*}/glossaries" + body: "glossary" + }; + option (google.api.method_signature) = "parent,glossary"; + option (google.longrunning.operation_info) = { + response_type: "Glossary" + metadata_type: "CreateGlossaryMetadata" + }; + } + + // Lists glossaries in a project. Returns NOT_FOUND, if the project doesn't + // exist. + rpc ListGlossaries(ListGlossariesRequest) returns (ListGlossariesResponse) { + option (google.api.http) = { + get: "/v3/{parent=projects/*/locations/*}/glossaries" + }; + option (google.api.method_signature) = "parent"; + } + + // Gets a glossary. Returns NOT_FOUND, if the glossary doesn't + // exist. + rpc GetGlossary(GetGlossaryRequest) returns (Glossary) { + option (google.api.http) = { + get: "/v3/{name=projects/*/locations/*/glossaries/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Deletes a glossary, or cancels glossary construction + // if the glossary isn't created yet. + // Returns NOT_FOUND, if the glossary doesn't exist. + rpc DeleteGlossary(DeleteGlossaryRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v3/{name=projects/*/locations/*/glossaries/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "DeleteGlossaryResponse" + metadata_type: "DeleteGlossaryMetadata" + }; + } +} + +// Configures which glossary should be used for a specific target language, +// and defines options for applying that glossary. +message TranslateTextGlossaryConfig { + // Required. Specifies the glossary used for this translation. Use + // this format: projects/*/locations/*/glossaries/* + string glossary = 1 [(google.api.field_behavior) = REQUIRED]; + + // Optional. Indicates match is case-insensitive. + // Default value is false if missing. + bool ignore_case = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// The request message for synchronous translation. +message TranslateTextRequest { + // Required. The content of the input in string format. + // We recommend the total content be less than 30k codepoints. + // Use BatchTranslateText for larger text. + repeated string contents = 1 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The format of the source text, for example, "text/html", + // "text/plain". If left blank, the MIME type defaults to "text/html". + string mime_type = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The BCP-47 language code of the input text if + // known, for example, "en-US" or "sr-Latn". Supported language codes are + // listed in Language Support. If the source language isn't specified, the API + // attempts to identify the source language automatically and returns the + // source language within the response. + string source_language_code = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Required. The BCP-47 language code to use for translation of the input + // text, set to one of the language codes listed in Language Support. + string target_language_code = 5 [(google.api.field_behavior) = REQUIRED]; + + // Required. Project or location to make a call. Must refer to a caller's + // project. + // + // Format: `projects/{project-number-or-id}` or + // `projects/{project-number-or-id}/locations/{location-id}`. + // + // For global calls, use `projects/{project-number-or-id}/locations/global` or + // `projects/{project-number-or-id}`. + // + // Non-global location is required for requests using AutoML models or + // custom glossaries. + // + // Models and glossaries must be within the same region (have same + // location-id), otherwise an INVALID_ARGUMENT (400) error is returned. + string parent = 8 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // Optional. The `model` type requested for this translation. + // + // The format depends on model type: + // + // - AutoML Translation models: + // `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` + // + // - General (built-in) models: + // `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, + // `projects/{project-number-or-id}/locations/{location-id}/models/general/base` + // + // + // For global (non-regionalized) requests, use `location-id` `global`. + // For example, + // `projects/{project-number-or-id}/locations/global/models/general/nmt`. + // + // If missing, the system decides which google base model to use. + string model = 6 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Glossary to be applied. The glossary must be + // within the same region (have the same location-id) as the model, otherwise + // an INVALID_ARGUMENT (400) error is returned. + TranslateTextGlossaryConfig glossary_config = 7 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The labels with user-defined metadata for the request. + // + // Label keys and values can be no longer than 63 characters + // (Unicode codepoints), can only contain lowercase letters, numeric + // characters, underscores and dashes. International characters are allowed. + // Label values are optional. Label keys must start with a letter. + // + // See https://cloud.google.com/translate/docs/labels for more information. + map labels = 10 [(google.api.field_behavior) = OPTIONAL]; +} + +message TranslateTextResponse { + // Text translation responses with no glossary applied. + // This field has the same length as + // [`contents`][google.cloud.translation.v3.TranslateTextRequest.contents]. + repeated Translation translations = 1; + + // Text translation responses if a glossary is provided in the request. + // This can be the same as + // [`translations`][google.cloud.translation.v3.TranslateTextResponse.translations] + // if no terms apply. This field has the same length as + // [`contents`][google.cloud.translation.v3.TranslateTextRequest.contents]. + repeated Translation glossary_translations = 3; +} + +// A single translation response. +message Translation { + // Text translated into the target language. + string translated_text = 1; + + // Only present when `model` is present in the request. + // `model` here is normalized to have project number. + // + // For example: + // If the `model` requested in TranslationTextRequest is + // `projects/{project-id}/locations/{location-id}/models/general/nmt` then + // `model` here would be normalized to + // `projects/{project-number}/locations/{location-id}/models/general/nmt`. + string model = 2; + + // The BCP-47 language code of source text in the initial request, detected + // automatically, if no source language was passed within the initial + // request. If the source language was passed, auto-detection of the language + // does not occur and this field is empty. + string detected_language_code = 4; + + // The `glossary_config` used for this translation. + TranslateTextGlossaryConfig glossary_config = 3; +} + +// The request message for language detection. +message DetectLanguageRequest { + // Required. Project or location to make a call. Must refer to a caller's + // project. + // + // Format: `projects/{project-number-or-id}/locations/{location-id}` or + // `projects/{project-number-or-id}`. + // + // For global calls, use `projects/{project-number-or-id}/locations/global` or + // `projects/{project-number-or-id}`. + // + // Only models within the same region (has same location-id) can be used. + // Otherwise an INVALID_ARGUMENT (400) error is returned. + string parent = 5 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // Optional. The language detection model to be used. + // + // Format: + // `projects/{project-number-or-id}/locations/{location-id}/models/language-detection/{model-id}` + // + // Only one language detection model is currently supported: + // `projects/{project-number-or-id}/locations/{location-id}/models/language-detection/default`. + // + // If not specified, the default model is used. + string model = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Required. The source of the document from which to detect the language. + oneof source { + // The content of the input stored as a string. + string content = 1; + } + + // Optional. The format of the source text, for example, "text/html", + // "text/plain". If left blank, the MIME type defaults to "text/html". + string mime_type = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The labels with user-defined metadata for the request. + // + // Label keys and values can be no longer than 63 characters + // (Unicode codepoints), can only contain lowercase letters, numeric + // characters, underscores and dashes. International characters are allowed. + // Label values are optional. Label keys must start with a letter. + // + // See https://cloud.google.com/translate/docs/labels for more information. + map labels = 6 [(google.api.field_behavior) = OPTIONAL]; +} + +// The response message for language detection. +message DetectedLanguage { + // The BCP-47 language code of source content in the request, detected + // automatically. + string language_code = 1; + + // The confidence of the detection result for this language. + float confidence = 2; +} + +// The response message for language detection. +message DetectLanguageResponse { + // A list of detected languages sorted by detection confidence in descending + // order. The most probable language first. + repeated DetectedLanguage languages = 1; +} + +// The request message for discovering supported languages. +message GetSupportedLanguagesRequest { + // Required. Project or location to make a call. Must refer to a caller's + // project. + // + // Format: `projects/{project-number-or-id}` or + // `projects/{project-number-or-id}/locations/{location-id}`. + // + // For global calls, use `projects/{project-number-or-id}/locations/global` or + // `projects/{project-number-or-id}`. + // + // Non-global location is required for AutoML models. + // + // Only models within the same region (have same location-id) can be used, + // otherwise an INVALID_ARGUMENT (400) error is returned. + string parent = 3 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // Optional. The language to use to return localized, human readable names + // of supported languages. If missing, then display names are not returned + // in a response. + string display_language_code = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Get supported languages of this model. + // + // The format depends on model type: + // + // - AutoML Translation models: + // `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` + // + // - General (built-in) models: + // `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, + // `projects/{project-number-or-id}/locations/{location-id}/models/general/base` + // + // + // Returns languages supported by the specified model. + // If missing, we get supported languages of Google general base (PBMT) model. + string model = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// The response message for discovering supported languages. +message SupportedLanguages { + // A list of supported language responses. This list contains an entry + // for each language the Translation API supports. + repeated SupportedLanguage languages = 1; +} + +// A single supported language response corresponds to information related +// to one supported language. +message SupportedLanguage { + // Supported language code, generally consisting of its ISO 639-1 + // identifier, for example, 'en', 'ja'. In certain cases, BCP-47 codes + // including language and region identifiers are returned (for example, + // 'zh-TW' and 'zh-CN') + string language_code = 1; + + // Human readable name of the language localized in the display language + // specified in the request. + string display_name = 2; + + // Can be used as source language. + bool support_source = 3; + + // Can be used as target language. + bool support_target = 4; +} + +// The Google Cloud Storage location for the input content. +message GcsSource { + // Required. Source data URI. For example, `gs://my_bucket/my_object`. + string input_uri = 1; +} + +// Input configuration for BatchTranslateText request. +message InputConfig { + // Optional. Can be "text/plain" or "text/html". + // For `.tsv`, "text/html" is used if mime_type is missing. + // For `.html`, this field must be "text/html" or empty. + // For `.txt`, this field must be "text/plain" or empty. + string mime_type = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Required. Specify the input. + oneof source { + // Required. Google Cloud Storage location for the source input. + // This can be a single file (for example, + // `gs://translation-test/input.tsv`) or a wildcard (for example, + // `gs://translation-test/*`). If a file extension is `.tsv`, it can + // contain either one or two columns. The first column (optional) is the id + // of the text request. If the first column is missing, we use the row + // number (0-based) from the input file as the ID in the output file. The + // second column is the actual text to be + // translated. We recommend each row be <= 10K Unicode codepoints, + // otherwise an error might be returned. + // Note that the input tsv must be RFC 4180 compliant. + // + // You could use https://github.com/Clever/csvlint to check potential + // formatting errors in your tsv file. + // csvlint --delimiter='\t' your_input_file.tsv + // + // The other supported file extensions are `.txt` or `.html`, which is + // treated as a single large chunk of text. + GcsSource gcs_source = 2; + } +} + +// The Google Cloud Storage location for the output content. +message GcsDestination { + // Required. There must be no files under 'output_uri_prefix'. + // 'output_uri_prefix' must end with "/" and start with "gs://", otherwise an + // INVALID_ARGUMENT (400) error is returned. + string output_uri_prefix = 1; +} + +// Output configuration for BatchTranslateText request. +message OutputConfig { + // Required. The destination of output. + oneof destination { + // Google Cloud Storage destination for output content. + // For every single input file (for example, gs://a/b/c.[extension]), we + // generate at most 2 * n output files. (n is the # of target_language_codes + // in the BatchTranslateTextRequest). + // + // Output files (tsv) generated are compliant with RFC 4180 except that + // record delimiters are '\n' instead of '\r\n'. We don't provide any way to + // change record delimiters. + // + // While the input files are being processed, we write/update an index file + // 'index.csv' under 'output_uri_prefix' (for example, + // gs://translation-test/index.csv) The index file is generated/updated as + // new files are being translated. The format is: + // + // input_file,target_language_code,translations_file,errors_file, + // glossary_translations_file,glossary_errors_file + // + // input_file is one file we matched using gcs_source.input_uri. + // target_language_code is provided in the request. + // translations_file contains the translations. (details provided below) + // errors_file contains the errors during processing of the file. (details + // below). Both translations_file and errors_file could be empty + // strings if we have no content to output. + // glossary_translations_file and glossary_errors_file are always empty + // strings if the input_file is tsv. They could also be empty if we have no + // content to output. + // + // Once a row is present in index.csv, the input/output matching never + // changes. Callers should also expect all the content in input_file are + // processed and ready to be consumed (that is, no partial output file is + // written). + // + // The format of translations_file (for target language code 'trg') is: + // gs://translation_test/a_b_c_'trg'_translations.[extension] + // + // If the input file extension is tsv, the output has the following + // columns: + // Column 1: ID of the request provided in the input, if it's not + // provided in the input, then the input row number is used (0-based). + // Column 2: source sentence. + // Column 3: translation without applying a glossary. Empty string if there + // is an error. + // Column 4 (only present if a glossary is provided in the request): + // translation after applying the glossary. Empty string if there is an + // error applying the glossary. Could be same string as column 3 if there is + // no glossary applied. + // + // If input file extension is a txt or html, the translation is directly + // written to the output file. If glossary is requested, a separate + // glossary_translations_file has format of + // gs://translation_test/a_b_c_'trg'_glossary_translations.[extension] + // + // The format of errors file (for target language code 'trg') is: + // gs://translation_test/a_b_c_'trg'_errors.[extension] + // + // If the input file extension is tsv, errors_file contains the following: + // Column 1: ID of the request provided in the input, if it's not + // provided in the input, then the input row number is used (0-based). + // Column 2: source sentence. + // Column 3: Error detail for the translation. Could be empty. + // Column 4 (only present if a glossary is provided in the request): + // Error when applying the glossary. + // + // If the input file extension is txt or html, glossary_error_file will be + // generated that contains error details. glossary_error_file has format of + // gs://translation_test/a_b_c_'trg'_glossary_errors.[extension] + GcsDestination gcs_destination = 1; + } +} + +// The batch translation request. +message BatchTranslateTextRequest { + // Required. Location to make a call. Must refer to a caller's project. + // + // Format: `projects/{project-number-or-id}/locations/{location-id}`. + // + // The `global` location is not supported for batch translation. + // + // Only AutoML Translation models or glossaries within the same region (have + // the same location-id) can be used, otherwise an INVALID_ARGUMENT (400) + // error is returned. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // Required. Source language code. + string source_language_code = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. Specify up to 10 language codes here. + repeated string target_language_codes = 3 + [(google.api.field_behavior) = REQUIRED]; + + // Optional. The models to use for translation. Map's key is target language + // code. Map's value is model name. Value can be a built-in general model, + // or an AutoML Translation model. + // + // The value format depends on model type: + // + // - AutoML Translation models: + // `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` + // + // - General (built-in) models: + // `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, + // `projects/{project-number-or-id}/locations/{location-id}/models/general/base` + // + // + // If the map is empty or a specific model is + // not requested for a language pair, then default google model (nmt) is used. + map models = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Required. Input configurations. + // The total number of files matched should be <= 1000. + // The total content size should be <= 100M Unicode codepoints. + // The files must use UTF-8 encoding. + repeated InputConfig input_configs = 5 + [(google.api.field_behavior) = REQUIRED]; + + // Required. Output configuration. + // If 2 input configs match to the same file (that is, same input path), + // we don't generate output for duplicate inputs. + OutputConfig output_config = 6 [(google.api.field_behavior) = REQUIRED]; + + // Optional. Glossaries to be applied for translation. + // It's keyed by target language code. + map glossaries = 7 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The labels with user-defined metadata for the request. + // + // Label keys and values can be no longer than 63 characters + // (Unicode codepoints), can only contain lowercase letters, numeric + // characters, underscores and dashes. International characters are allowed. + // Label values are optional. Label keys must start with a letter. + // + // See https://cloud.google.com/translate/docs/labels for more information. + map labels = 9 [(google.api.field_behavior) = OPTIONAL]; +} + +// State metadata for the batch translation operation. +message BatchTranslateMetadata { + // State of the job. + enum State { + // Invalid. + STATE_UNSPECIFIED = 0; + + // Request is being processed. + RUNNING = 1; + + // The batch is processed, and at least one item was successfully + // processed. + SUCCEEDED = 2; + + // The batch is done and no item was successfully processed. + FAILED = 3; + + // Request is in the process of being canceled after caller invoked + // longrunning.Operations.CancelOperation on the request id. + CANCELLING = 4; + + // The batch is done after the user has called the + // longrunning.Operations.CancelOperation. Any records processed before the + // cancel command are output as specified in the request. + CANCELLED = 5; + } + + // The state of the operation. + State state = 1; + + // Number of successfully translated characters so far (Unicode codepoints). + int64 translated_characters = 2; + + // Number of characters that have failed to process so far (Unicode + // codepoints). + int64 failed_characters = 3; + + // Total number of characters (Unicode codepoints). + // This is the total number of codepoints from input files times the number of + // target languages and appears here shortly after the call is submitted. + int64 total_characters = 4; + + // Time when the operation was submitted. + google.protobuf.Timestamp submit_time = 5; +} + +// Stored in the +// [google.longrunning.Operation.response][google.longrunning.Operation.response] +// field returned by BatchTranslateText if at least one sentence is translated +// successfully. +message BatchTranslateResponse { + // Total number of characters (Unicode codepoints). + int64 total_characters = 1; + + // Number of successfully translated characters (Unicode codepoints). + int64 translated_characters = 2; + + // Number of characters that have failed to process (Unicode codepoints). + int64 failed_characters = 3; + + // Time when the operation was submitted. + google.protobuf.Timestamp submit_time = 4; + + // The time when the operation is finished and + // [google.longrunning.Operation.done][google.longrunning.Operation.done] is + // set to true. + google.protobuf.Timestamp end_time = 5; +} + +// Input configuration for glossaries. +message GlossaryInputConfig { + // Required. Specify the input. + oneof source { + // Required. Google Cloud Storage location of glossary data. + // File format is determined based on the filename extension. API returns + // [google.rpc.Code.INVALID_ARGUMENT] for unsupported URI-s and file + // formats. Wildcards are not allowed. This must be a single file in one of + // the following formats: + // + // For unidirectional glossaries: + // + // - TSV/CSV (`.tsv`/`.csv`): 2 column file, tab- or comma-separated. + // The first column is source text. The second column is target text. + // The file must not contain headers. That is, the first row is data, not + // column names. + // + // - TMX (`.tmx`): TMX file with parallel data defining source/target term + // pairs. + // + // For equivalent term sets glossaries: + // + // - CSV (`.csv`): Multi-column CSV file defining equivalent glossary terms + // in multiple languages. The format is defined for Google Translation + // Toolkit and documented in [Use a + // glossary](https://support.google.com/translatortoolkit/answer/6306379?hl=en). + GcsSource gcs_source = 1; + } +} + +// Represents a glossary built from user provided data. +message Glossary { + option (google.api.resource) = { + type: "translate.googleapis.com/Glossary" + pattern: "projects/{project}/locations/{location}/glossaries/{glossary}" + }; + + // Used with unidirectional glossaries. + message LanguageCodePair { + // Required. The BCP-47 language code of the input text, for example, + // "en-US". Expected to be an exact match for GlossaryTerm.language_code. + string source_language_code = 1; + + // Required. The BCP-47 language code for translation output, for example, + // "zh-CN". Expected to be an exact match for GlossaryTerm.language_code. + string target_language_code = 2; + } + + // Used with equivalent term set glossaries. + message LanguageCodesSet { + // The BCP-47 language code(s) for terms defined in the glossary. + // All entries are unique. The list contains at least two entries. + // Expected to be an exact match for GlossaryTerm.language_code. + repeated string language_codes = 1; + } + + // Required. The resource name of the glossary. Glossary names have the form + // `projects/{project-number-or-id}/locations/{location-id}/glossaries/{glossary-id}`. + string name = 1; + + // Languages supported by the glossary. + oneof languages { + // Used with unidirectional glossaries. + LanguageCodePair language_pair = 3; + + // Used with equivalent term set glossaries. + LanguageCodesSet language_codes_set = 4; + } + + // Required. Provides examples to build the glossary from. + // Total glossary must not exceed 10M Unicode codepoints. + GlossaryInputConfig input_config = 5; + + // Output only. The number of entries defined in the glossary. + int32 entry_count = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. When CreateGlossary was called. + google.protobuf.Timestamp submit_time = 7 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. When the glossary creation was finished. + google.protobuf.Timestamp end_time = 8 + [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Request message for CreateGlossary. +message CreateGlossaryRequest { + // Required. The project name. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // Required. The glossary to create. + Glossary glossary = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for GetGlossary. +message GetGlossaryRequest { + // Required. The name of the glossary to retrieve. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "translate.googleapis.com/Glossary" + } + ]; +} + +// Request message for DeleteGlossary. +message DeleteGlossaryRequest { + // Required. The name of the glossary to delete. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "translate.googleapis.com/Glossary" + } + ]; +} + +// Request message for ListGlossaries. +message ListGlossariesRequest { + // Required. The name of the project from which to list all of the glossaries. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // Optional. Requested page size. The server may return fewer glossaries than + // requested. If unspecified, the server picks an appropriate default. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A token identifying a page of results the server should return. + // Typically, this is the value of [ListGlossariesResponse.next_page_token] + // returned from the previous call to `ListGlossaries` method. + // The first page is returned if `page_token`is empty or missing. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Filter specifying constraints of a list operation. + // Filtering is not supported yet, and the parameter currently has no effect. + // If missing, no filtering is performed. + string filter = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// Response message for ListGlossaries. +message ListGlossariesResponse { + // The list of glossaries for a project. + repeated Glossary glossaries = 1; + + // A token to retrieve a page of results. Pass this value in the + // [ListGlossariesRequest.page_token] field in the subsequent call to + // `ListGlossaries` method to retrieve the next page of results. + string next_page_token = 2; +} + +// Stored in the +// [google.longrunning.Operation.metadata][google.longrunning.Operation.metadata] +// field returned by CreateGlossary. +message CreateGlossaryMetadata { + // Enumerates the possible states that the creation request can be in. + enum State { + // Invalid. + STATE_UNSPECIFIED = 0; + + // Request is being processed. + RUNNING = 1; + + // The glossary was successfully created. + SUCCEEDED = 2; + + // Failed to create the glossary. + FAILED = 3; + + // Request is in the process of being canceled after caller invoked + // longrunning.Operations.CancelOperation on the request id. + CANCELLING = 4; + + // The glossary creation request was successfully canceled. + CANCELLED = 5; + } + + // The name of the glossary that is being created. + string name = 1; + + // The current state of the glossary creation operation. + State state = 2; + + // The time when the operation was submitted to the server. + google.protobuf.Timestamp submit_time = 3; +} + +// Stored in the +// [google.longrunning.Operation.metadata][google.longrunning.Operation.metadata] +// field returned by DeleteGlossary. +message DeleteGlossaryMetadata { + // Enumerates the possible states that the creation request can be in. + enum State { + // Invalid. + STATE_UNSPECIFIED = 0; + + // Request is being processed. + RUNNING = 1; + + // The glossary was successfully deleted. + SUCCEEDED = 2; + + // Failed to delete the glossary. + FAILED = 3; + + // Request is in the process of being canceled after caller invoked + // longrunning.Operations.CancelOperation on the request id. + CANCELLING = 4; + + // The glossary deletion request was successfully canceled. + CANCELLED = 5; + } + + // The name of the glossary that is being deleted. + string name = 1; + + // The current state of the glossary deletion operation. + State state = 2; + + // The time when the operation was submitted to the server. + google.protobuf.Timestamp submit_time = 3; +} + +// Stored in the +// [google.longrunning.Operation.response][google.longrunning.Operation.response] +// field returned by DeleteGlossary. +message DeleteGlossaryResponse { + // The name of the deleted glossary. + string name = 1; + + // The time when the operation was submitted to the server. + google.protobuf.Timestamp submit_time = 2; + + // The time when the glossary deletion is finished and + // [google.longrunning.Operation.done][google.longrunning.Operation.done] is + // set to true. + google.protobuf.Timestamp end_time = 3; +} diff --git a/google/cloud/translate_v3/proto/translation_service_pb2.py b/google/cloud/translate_v3/proto/translation_service_pb2.py new file mode 100644 index 00000000..7bc7e15d --- /dev/null +++ b/google/cloud/translate_v3/proto/translation_service_pb2.py @@ -0,0 +1,3902 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: google/cloud/translation_v3/proto/translation_service.proto + +import sys + +_b = sys.version_info[0] < 3 and (lambda x: x) or (lambda x: x.encode("latin1")) +from google.protobuf import descriptor as _descriptor +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database + +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + +from google.api import annotations_pb2 as google_dot_api_dot_annotations__pb2 +from google.api import client_pb2 as google_dot_api_dot_client__pb2 +from google.api import field_behavior_pb2 as google_dot_api_dot_field__behavior__pb2 +from google.api import resource_pb2 as google_dot_api_dot_resource__pb2 +from google.longrunning import ( + operations_pb2 as google_dot_longrunning_dot_operations__pb2, +) +from google.protobuf import timestamp_pb2 as google_dot_protobuf_dot_timestamp__pb2 + + +DESCRIPTOR = _descriptor.FileDescriptor( + name="google/cloud/translation_v3/proto/translation_service.proto", + package="google.cloud.translation.v3", + syntax="proto3", + serialized_options=_b( + "\n\035com.google.cloud.translate.v3B\027TranslationServiceProtoP\001ZBgoogle.golang.org/genproto/googleapis/cloud/translate/v3;translate\370\001\001\252\002\031Google.Cloud.Translate.V3\312\002\031Google\\Cloud\\Translate\\V3\352\002\034Google::Cloud::Translate::V3" + ), + serialized_pb=_b( + '\n;google/cloud/translation_v3/proto/translation_service.proto\x12\x1bgoogle.cloud.translation.v3\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a#google/longrunning/operations.proto\x1a\x1fgoogle/protobuf/timestamp.proto"N\n\x1bTranslateTextGlossaryConfig\x12\x15\n\x08glossary\x18\x01 \x01(\tB\x03\xe0\x41\x02\x12\x18\n\x0bignore_case\x18\x02 \x01(\x08\x42\x03\xe0\x41\x01"\xb5\x03\n\x14TranslateTextRequest\x12\x15\n\x08\x63ontents\x18\x01 \x03(\tB\x03\xe0\x41\x02\x12\x16\n\tmime_type\x18\x03 \x01(\tB\x03\xe0\x41\x01\x12!\n\x14source_language_code\x18\x04 \x01(\tB\x03\xe0\x41\x01\x12!\n\x14target_language_code\x18\x05 \x01(\tB\x03\xe0\x41\x02\x12\x39\n\x06parent\x18\x08 \x01(\tB)\xe0\x41\x02\xfa\x41#\n!locations.googleapis.com/Location\x12\x12\n\x05model\x18\x06 \x01(\tB\x03\xe0\x41\x01\x12V\n\x0fglossary_config\x18\x07 \x01(\x0b\x32\x38.google.cloud.translation.v3.TranslateTextGlossaryConfigB\x03\xe0\x41\x01\x12R\n\x06labels\x18\n \x03(\x0b\x32=.google.cloud.translation.v3.TranslateTextRequest.LabelsEntryB\x03\xe0\x41\x01\x1a-\n\x0bLabelsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01"\xa0\x01\n\x15TranslateTextResponse\x12>\n\x0ctranslations\x18\x01 \x03(\x0b\x32(.google.cloud.translation.v3.Translation\x12G\n\x15glossary_translations\x18\x03 \x03(\x0b\x32(.google.cloud.translation.v3.Translation"\xa8\x01\n\x0bTranslation\x12\x17\n\x0ftranslated_text\x18\x01 \x01(\t\x12\r\n\x05model\x18\x02 \x01(\t\x12\x1e\n\x16\x64\x65tected_language_code\x18\x04 \x01(\t\x12Q\n\x0fglossary_config\x18\x03 \x01(\x0b\x32\x38.google.cloud.translation.v3.TranslateTextGlossaryConfig"\x9f\x02\n\x15\x44\x65tectLanguageRequest\x12\x39\n\x06parent\x18\x05 \x01(\tB)\xe0\x41\x02\xfa\x41#\n!locations.googleapis.com/Location\x12\x12\n\x05model\x18\x04 \x01(\tB\x03\xe0\x41\x01\x12\x11\n\x07\x63ontent\x18\x01 \x01(\tH\x00\x12\x16\n\tmime_type\x18\x03 \x01(\tB\x03\xe0\x41\x01\x12S\n\x06labels\x18\x06 \x03(\x0b\x32>.google.cloud.translation.v3.DetectLanguageRequest.LabelsEntryB\x03\xe0\x41\x01\x1a-\n\x0bLabelsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\x42\x08\n\x06source"=\n\x10\x44\x65tectedLanguage\x12\x15\n\rlanguage_code\x18\x01 \x01(\t\x12\x12\n\nconfidence\x18\x02 \x01(\x02"Z\n\x16\x44\x65tectLanguageResponse\x12@\n\tlanguages\x18\x01 \x03(\x0b\x32-.google.cloud.translation.v3.DetectedLanguage"\x91\x01\n\x1cGetSupportedLanguagesRequest\x12\x39\n\x06parent\x18\x03 \x01(\tB)\xe0\x41\x02\xfa\x41#\n!locations.googleapis.com/Location\x12"\n\x15\x64isplay_language_code\x18\x01 \x01(\tB\x03\xe0\x41\x01\x12\x12\n\x05model\x18\x02 \x01(\tB\x03\xe0\x41\x01"W\n\x12SupportedLanguages\x12\x41\n\tlanguages\x18\x01 \x03(\x0b\x32..google.cloud.translation.v3.SupportedLanguage"p\n\x11SupportedLanguage\x12\x15\n\rlanguage_code\x18\x01 \x01(\t\x12\x14\n\x0c\x64isplay_name\x18\x02 \x01(\t\x12\x16\n\x0esupport_source\x18\x03 \x01(\x08\x12\x16\n\x0esupport_target\x18\x04 \x01(\x08"\x1e\n\tGcsSource\x12\x11\n\tinput_uri\x18\x01 \x01(\t"m\n\x0bInputConfig\x12\x16\n\tmime_type\x18\x01 \x01(\tB\x03\xe0\x41\x01\x12<\n\ngcs_source\x18\x02 \x01(\x0b\x32&.google.cloud.translation.v3.GcsSourceH\x00\x42\x08\n\x06source"+\n\x0eGcsDestination\x12\x19\n\x11output_uri_prefix\x18\x01 \x01(\t"e\n\x0cOutputConfig\x12\x46\n\x0fgcs_destination\x18\x01 \x01(\x0b\x32+.google.cloud.translation.v3.GcsDestinationH\x00\x42\r\n\x0b\x64\x65stination"\x88\x06\n\x19\x42\x61tchTranslateTextRequest\x12\x39\n\x06parent\x18\x01 \x01(\tB)\xe0\x41\x02\xfa\x41#\n!locations.googleapis.com/Location\x12!\n\x14source_language_code\x18\x02 \x01(\tB\x03\xe0\x41\x02\x12"\n\x15target_language_codes\x18\x03 \x03(\tB\x03\xe0\x41\x02\x12W\n\x06models\x18\x04 \x03(\x0b\x32\x42.google.cloud.translation.v3.BatchTranslateTextRequest.ModelsEntryB\x03\xe0\x41\x01\x12\x44\n\rinput_configs\x18\x05 \x03(\x0b\x32(.google.cloud.translation.v3.InputConfigB\x03\xe0\x41\x02\x12\x45\n\routput_config\x18\x06 \x01(\x0b\x32).google.cloud.translation.v3.OutputConfigB\x03\xe0\x41\x02\x12_\n\nglossaries\x18\x07 \x03(\x0b\x32\x46.google.cloud.translation.v3.BatchTranslateTextRequest.GlossariesEntryB\x03\xe0\x41\x01\x12W\n\x06labels\x18\t \x03(\x0b\x32\x42.google.cloud.translation.v3.BatchTranslateTextRequest.LabelsEntryB\x03\xe0\x41\x01\x1a-\n\x0bModelsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\x1ak\n\x0fGlossariesEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12G\n\x05value\x18\x02 \x01(\x0b\x32\x38.google.cloud.translation.v3.TranslateTextGlossaryConfig:\x02\x38\x01\x1a-\n\x0bLabelsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01"\xce\x02\n\x16\x42\x61tchTranslateMetadata\x12H\n\x05state\x18\x01 \x01(\x0e\x32\x39.google.cloud.translation.v3.BatchTranslateMetadata.State\x12\x1d\n\x15translated_characters\x18\x02 \x01(\x03\x12\x19\n\x11\x66\x61iled_characters\x18\x03 \x01(\x03\x12\x18\n\x10total_characters\x18\x04 \x01(\x03\x12/\n\x0bsubmit_time\x18\x05 \x01(\x0b\x32\x1a.google.protobuf.Timestamp"e\n\x05State\x12\x15\n\x11STATE_UNSPECIFIED\x10\x00\x12\x0b\n\x07RUNNING\x10\x01\x12\r\n\tSUCCEEDED\x10\x02\x12\n\n\x06\x46\x41ILED\x10\x03\x12\x0e\n\nCANCELLING\x10\x04\x12\r\n\tCANCELLED\x10\x05"\xcb\x01\n\x16\x42\x61tchTranslateResponse\x12\x18\n\x10total_characters\x18\x01 \x01(\x03\x12\x1d\n\x15translated_characters\x18\x02 \x01(\x03\x12\x19\n\x11\x66\x61iled_characters\x18\x03 \x01(\x03\x12/\n\x0bsubmit_time\x18\x04 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12,\n\x08\x65nd_time\x18\x05 \x01(\x0b\x32\x1a.google.protobuf.Timestamp"]\n\x13GlossaryInputConfig\x12<\n\ngcs_source\x18\x01 \x01(\x0b\x32&.google.cloud.translation.v3.GcsSourceH\x00\x42\x08\n\x06source"\xfa\x04\n\x08Glossary\x12\x0c\n\x04name\x18\x01 \x01(\t\x12O\n\rlanguage_pair\x18\x03 \x01(\x0b\x32\x36.google.cloud.translation.v3.Glossary.LanguageCodePairH\x00\x12T\n\x12language_codes_set\x18\x04 \x01(\x0b\x32\x36.google.cloud.translation.v3.Glossary.LanguageCodesSetH\x00\x12\x46\n\x0cinput_config\x18\x05 \x01(\x0b\x32\x30.google.cloud.translation.v3.GlossaryInputConfig\x12\x18\n\x0b\x65ntry_count\x18\x06 \x01(\x05\x42\x03\xe0\x41\x03\x12\x34\n\x0bsubmit_time\x18\x07 \x01(\x0b\x32\x1a.google.protobuf.TimestampB\x03\xe0\x41\x03\x12\x31\n\x08\x65nd_time\x18\x08 \x01(\x0b\x32\x1a.google.protobuf.TimestampB\x03\xe0\x41\x03\x1aN\n\x10LanguageCodePair\x12\x1c\n\x14source_language_code\x18\x01 \x01(\t\x12\x1c\n\x14target_language_code\x18\x02 \x01(\t\x1a*\n\x10LanguageCodesSet\x12\x16\n\x0elanguage_codes\x18\x01 \x03(\t:e\xea\x41\x62\n!translate.googleapis.com/Glossary\x12=projects/{project}/locations/{location}/glossaries/{glossary}B\x0b\n\tlanguages"\x90\x01\n\x15\x43reateGlossaryRequest\x12\x39\n\x06parent\x18\x01 \x01(\tB)\xe0\x41\x02\xfa\x41#\n!locations.googleapis.com/Location\x12<\n\x08glossary\x18\x02 \x01(\x0b\x32%.google.cloud.translation.v3.GlossaryB\x03\xe0\x41\x02"M\n\x12GetGlossaryRequest\x12\x37\n\x04name\x18\x01 \x01(\tB)\xe0\x41\x02\xfa\x41#\n!translate.googleapis.com/Glossary"P\n\x15\x44\x65leteGlossaryRequest\x12\x37\n\x04name\x18\x01 \x01(\tB)\xe0\x41\x02\xfa\x41#\n!translate.googleapis.com/Glossary"\x98\x01\n\x15ListGlossariesRequest\x12\x39\n\x06parent\x18\x01 \x01(\tB)\xe0\x41\x02\xfa\x41#\n!locations.googleapis.com/Location\x12\x16\n\tpage_size\x18\x02 \x01(\x05\x42\x03\xe0\x41\x01\x12\x17\n\npage_token\x18\x03 \x01(\tB\x03\xe0\x41\x01\x12\x13\n\x06\x66ilter\x18\x04 \x01(\tB\x03\xe0\x41\x01"l\n\x16ListGlossariesResponse\x12\x39\n\nglossaries\x18\x01 \x03(\x0b\x32%.google.cloud.translation.v3.Glossary\x12\x17\n\x0fnext_page_token\x18\x02 \x01(\t"\x88\x02\n\x16\x43reateGlossaryMetadata\x12\x0c\n\x04name\x18\x01 \x01(\t\x12H\n\x05state\x18\x02 \x01(\x0e\x32\x39.google.cloud.translation.v3.CreateGlossaryMetadata.State\x12/\n\x0bsubmit_time\x18\x03 \x01(\x0b\x32\x1a.google.protobuf.Timestamp"e\n\x05State\x12\x15\n\x11STATE_UNSPECIFIED\x10\x00\x12\x0b\n\x07RUNNING\x10\x01\x12\r\n\tSUCCEEDED\x10\x02\x12\n\n\x06\x46\x41ILED\x10\x03\x12\x0e\n\nCANCELLING\x10\x04\x12\r\n\tCANCELLED\x10\x05"\x88\x02\n\x16\x44\x65leteGlossaryMetadata\x12\x0c\n\x04name\x18\x01 \x01(\t\x12H\n\x05state\x18\x02 \x01(\x0e\x32\x39.google.cloud.translation.v3.DeleteGlossaryMetadata.State\x12/\n\x0bsubmit_time\x18\x03 \x01(\x0b\x32\x1a.google.protobuf.Timestamp"e\n\x05State\x12\x15\n\x11STATE_UNSPECIFIED\x10\x00\x12\x0b\n\x07RUNNING\x10\x01\x12\r\n\tSUCCEEDED\x10\x02\x12\n\n\x06\x46\x41ILED\x10\x03\x12\x0e\n\nCANCELLING\x10\x04\x12\r\n\tCANCELLED\x10\x05"\x85\x01\n\x16\x44\x65leteGlossaryResponse\x12\x0c\n\x04name\x18\x01 \x01(\t\x12/\n\x0bsubmit_time\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12,\n\x08\x65nd_time\x18\x03 \x01(\x0b\x32\x1a.google.protobuf.Timestamp2\x8e\x10\n\x12TranslationService\x12\xd4\x02\n\rTranslateText\x12\x31.google.cloud.translation.v3.TranslateTextRequest\x1a\x32.google.cloud.translation.v3.TranslateTextResponse"\xdb\x01\x82\xd3\xe4\x93\x02\x62"1/v3/{parent=projects/*/locations/*}:translateText:\x01*Z*"%/v3/{parent=projects/*}:translateText:\x01*\xda\x41$parent,target_language_code,contents\xda\x41Iparent,model,mime_type,source_language_code,target_language_code,contents\x12\x87\x02\n\x0e\x44\x65tectLanguage\x12\x32.google.cloud.translation.v3.DetectLanguageRequest\x1a\x33.google.cloud.translation.v3.DetectLanguageResponse"\x8b\x01\x82\xd3\xe4\x93\x02\x64"2/v3/{parent=projects/*/locations/*}:detectLanguage:\x01*Z+"&/v3/{parent=projects/*}:detectLanguage:\x01*\xda\x41\x1eparent,model,mime_type,content\x12\x97\x02\n\x15GetSupportedLanguages\x12\x39.google.cloud.translation.v3.GetSupportedLanguagesRequest\x1a/.google.cloud.translation.v3.SupportedLanguages"\x91\x01\x82\xd3\xe4\x93\x02\x66\x12\x36/v3/{parent=projects/*/locations/*}/supportedLanguagesZ,\x12*/v3/{parent=projects/*}/supportedLanguages\xda\x41"parent,model,display_language_code\x12\xe1\x01\n\x12\x42\x61tchTranslateText\x12\x36.google.cloud.translation.v3.BatchTranslateTextRequest\x1a\x1d.google.longrunning.Operation"t\x82\xd3\xe4\x93\x02;"6/v3/{parent=projects/*/locations/*}:batchTranslateText:\x01*\xca\x41\x30\n\x16\x42\x61tchTranslateResponse\x12\x16\x42\x61tchTranslateMetadata\x12\xdc\x01\n\x0e\x43reateGlossary\x12\x32.google.cloud.translation.v3.CreateGlossaryRequest\x1a\x1d.google.longrunning.Operation"w\x82\xd3\xe4\x93\x02:"./v3/{parent=projects/*/locations/*}/glossaries:\x08glossary\xda\x41\x0fparent,glossary\xca\x41"\n\x08Glossary\x12\x16\x43reateGlossaryMetadata\x12\xba\x01\n\x0eListGlossaries\x12\x32.google.cloud.translation.v3.ListGlossariesRequest\x1a\x33.google.cloud.translation.v3.ListGlossariesResponse"?\x82\xd3\xe4\x93\x02\x30\x12./v3/{parent=projects/*/locations/*}/glossaries\xda\x41\x06parent\x12\xa4\x01\n\x0bGetGlossary\x12/.google.cloud.translation.v3.GetGlossaryRequest\x1a%.google.cloud.translation.v3.Glossary"=\x82\xd3\xe4\x93\x02\x30\x12./v3/{name=projects/*/locations/*/glossaries/*}\xda\x41\x04name\x12\xd5\x01\n\x0e\x44\x65leteGlossary\x12\x32.google.cloud.translation.v3.DeleteGlossaryRequest\x1a\x1d.google.longrunning.Operation"p\x82\xd3\xe4\x93\x02\x30*./v3/{name=projects/*/locations/*/glossaries/*}\xda\x41\x04name\xca\x41\x30\n\x16\x44\x65leteGlossaryResponse\x12\x16\x44\x65leteGlossaryMetadata\x1a~\xca\x41\x18translate.googleapis.com\xd2\x41`https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/cloud-translationB\xd8\x01\n\x1d\x63om.google.cloud.translate.v3B\x17TranslationServiceProtoP\x01ZBgoogle.golang.org/genproto/googleapis/cloud/translate/v3;translate\xf8\x01\x01\xaa\x02\x19Google.Cloud.Translate.V3\xca\x02\x19Google\\Cloud\\Translate\\V3\xea\x02\x1cGoogle::Cloud::Translate::V3b\x06proto3' + ), + dependencies=[ + google_dot_api_dot_annotations__pb2.DESCRIPTOR, + google_dot_api_dot_client__pb2.DESCRIPTOR, + google_dot_api_dot_field__behavior__pb2.DESCRIPTOR, + google_dot_api_dot_resource__pb2.DESCRIPTOR, + google_dot_longrunning_dot_operations__pb2.DESCRIPTOR, + google_dot_protobuf_dot_timestamp__pb2.DESCRIPTOR, + ], +) + + +_BATCHTRANSLATEMETADATA_STATE = _descriptor.EnumDescriptor( + name="State", + full_name="google.cloud.translation.v3.BatchTranslateMetadata.State", + filename=None, + file=DESCRIPTOR, + values=[ + _descriptor.EnumValueDescriptor( + name="STATE_UNSPECIFIED", + index=0, + number=0, + serialized_options=None, + type=None, + ), + _descriptor.EnumValueDescriptor( + name="RUNNING", index=1, number=1, serialized_options=None, type=None + ), + _descriptor.EnumValueDescriptor( + name="SUCCEEDED", index=2, number=2, serialized_options=None, type=None + ), + _descriptor.EnumValueDescriptor( + name="FAILED", index=3, number=3, serialized_options=None, type=None + ), + _descriptor.EnumValueDescriptor( + name="CANCELLING", index=4, number=4, serialized_options=None, type=None + ), + _descriptor.EnumValueDescriptor( + name="CANCELLED", index=5, number=5, serialized_options=None, type=None + ), + ], + containing_type=None, + serialized_options=None, + serialized_start=3231, + serialized_end=3332, +) +_sym_db.RegisterEnumDescriptor(_BATCHTRANSLATEMETADATA_STATE) + +_CREATEGLOSSARYMETADATA_STATE = _descriptor.EnumDescriptor( + name="State", + full_name="google.cloud.translation.v3.CreateGlossaryMetadata.State", + filename=None, + file=DESCRIPTOR, + values=[ + _descriptor.EnumValueDescriptor( + name="STATE_UNSPECIFIED", + index=0, + number=0, + serialized_options=None, + type=None, + ), + _descriptor.EnumValueDescriptor( + name="RUNNING", index=1, number=1, serialized_options=None, type=None + ), + _descriptor.EnumValueDescriptor( + name="SUCCEEDED", index=2, number=2, serialized_options=None, type=None + ), + _descriptor.EnumValueDescriptor( + name="FAILED", index=3, number=3, serialized_options=None, type=None + ), + _descriptor.EnumValueDescriptor( + name="CANCELLING", index=4, number=4, serialized_options=None, type=None + ), + _descriptor.EnumValueDescriptor( + name="CANCELLED", index=5, number=5, serialized_options=None, type=None + ), + ], + containing_type=None, + serialized_options=None, + serialized_start=3231, + serialized_end=3332, +) +_sym_db.RegisterEnumDescriptor(_CREATEGLOSSARYMETADATA_STATE) + +_DELETEGLOSSARYMETADATA_STATE = _descriptor.EnumDescriptor( + name="State", + full_name="google.cloud.translation.v3.DeleteGlossaryMetadata.State", + filename=None, + file=DESCRIPTOR, + values=[ + _descriptor.EnumValueDescriptor( + name="STATE_UNSPECIFIED", + index=0, + number=0, + serialized_options=None, + type=None, + ), + _descriptor.EnumValueDescriptor( + name="RUNNING", index=1, number=1, serialized_options=None, type=None + ), + _descriptor.EnumValueDescriptor( + name="SUCCEEDED", index=2, number=2, serialized_options=None, type=None + ), + _descriptor.EnumValueDescriptor( + name="FAILED", index=3, number=3, serialized_options=None, type=None + ), + _descriptor.EnumValueDescriptor( + name="CANCELLING", index=4, number=4, serialized_options=None, type=None + ), + _descriptor.EnumValueDescriptor( + name="CANCELLED", index=5, number=5, serialized_options=None, type=None + ), + ], + containing_type=None, + serialized_options=None, + serialized_start=3231, + serialized_end=3332, +) +_sym_db.RegisterEnumDescriptor(_DELETEGLOSSARYMETADATA_STATE) + + +_TRANSLATETEXTGLOSSARYCONFIG = _descriptor.Descriptor( + name="TranslateTextGlossaryConfig", + full_name="google.cloud.translation.v3.TranslateTextGlossaryConfig", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="glossary", + full_name="google.cloud.translation.v3.TranslateTextGlossaryConfig.glossary", + index=0, + number=1, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=_b("\340A\002"), + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="ignore_case", + full_name="google.cloud.translation.v3.TranslateTextGlossaryConfig.ignore_case", + index=1, + number=2, + type=8, + cpp_type=7, + label=1, + has_default_value=False, + default_value=False, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=_b("\340A\001"), + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=277, + serialized_end=355, +) + + +_TRANSLATETEXTREQUEST_LABELSENTRY = _descriptor.Descriptor( + name="LabelsEntry", + full_name="google.cloud.translation.v3.TranslateTextRequest.LabelsEntry", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="key", + full_name="google.cloud.translation.v3.TranslateTextRequest.LabelsEntry.key", + index=0, + number=1, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="value", + full_name="google.cloud.translation.v3.TranslateTextRequest.LabelsEntry.value", + index=1, + number=2, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=_b("8\001"), + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=750, + serialized_end=795, +) + +_TRANSLATETEXTREQUEST = _descriptor.Descriptor( + name="TranslateTextRequest", + full_name="google.cloud.translation.v3.TranslateTextRequest", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="contents", + full_name="google.cloud.translation.v3.TranslateTextRequest.contents", + index=0, + number=1, + type=9, + cpp_type=9, + label=3, + has_default_value=False, + default_value=[], + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=_b("\340A\002"), + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="mime_type", + full_name="google.cloud.translation.v3.TranslateTextRequest.mime_type", + index=1, + number=3, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=_b("\340A\001"), + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="source_language_code", + full_name="google.cloud.translation.v3.TranslateTextRequest.source_language_code", + index=2, + number=4, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=_b("\340A\001"), + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="target_language_code", + full_name="google.cloud.translation.v3.TranslateTextRequest.target_language_code", + index=3, + number=5, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=_b("\340A\002"), + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="parent", + full_name="google.cloud.translation.v3.TranslateTextRequest.parent", + index=4, + number=8, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=_b( + "\340A\002\372A#\n!locations.googleapis.com/Location" + ), + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="model", + full_name="google.cloud.translation.v3.TranslateTextRequest.model", + index=5, + number=6, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=_b("\340A\001"), + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="glossary_config", + full_name="google.cloud.translation.v3.TranslateTextRequest.glossary_config", + index=6, + number=7, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=_b("\340A\001"), + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="labels", + full_name="google.cloud.translation.v3.TranslateTextRequest.labels", + index=7, + number=10, + type=11, + cpp_type=10, + label=3, + has_default_value=False, + default_value=[], + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=_b("\340A\001"), + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[_TRANSLATETEXTREQUEST_LABELSENTRY], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=358, + serialized_end=795, +) + + +_TRANSLATETEXTRESPONSE = _descriptor.Descriptor( + name="TranslateTextResponse", + full_name="google.cloud.translation.v3.TranslateTextResponse", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="translations", + full_name="google.cloud.translation.v3.TranslateTextResponse.translations", + index=0, + number=1, + type=11, + cpp_type=10, + label=3, + has_default_value=False, + default_value=[], + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="glossary_translations", + full_name="google.cloud.translation.v3.TranslateTextResponse.glossary_translations", + index=1, + number=3, + type=11, + cpp_type=10, + label=3, + has_default_value=False, + default_value=[], + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=798, + serialized_end=958, +) + + +_TRANSLATION = _descriptor.Descriptor( + name="Translation", + full_name="google.cloud.translation.v3.Translation", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="translated_text", + full_name="google.cloud.translation.v3.Translation.translated_text", + index=0, + number=1, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="model", + full_name="google.cloud.translation.v3.Translation.model", + index=1, + number=2, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="detected_language_code", + full_name="google.cloud.translation.v3.Translation.detected_language_code", + index=2, + number=4, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="glossary_config", + full_name="google.cloud.translation.v3.Translation.glossary_config", + index=3, + number=3, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=961, + serialized_end=1129, +) + + +_DETECTLANGUAGEREQUEST_LABELSENTRY = _descriptor.Descriptor( + name="LabelsEntry", + full_name="google.cloud.translation.v3.DetectLanguageRequest.LabelsEntry", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="key", + full_name="google.cloud.translation.v3.DetectLanguageRequest.LabelsEntry.key", + index=0, + number=1, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="value", + full_name="google.cloud.translation.v3.DetectLanguageRequest.LabelsEntry.value", + index=1, + number=2, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=_b("8\001"), + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=750, + serialized_end=795, +) + +_DETECTLANGUAGEREQUEST = _descriptor.Descriptor( + name="DetectLanguageRequest", + full_name="google.cloud.translation.v3.DetectLanguageRequest", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="parent", + full_name="google.cloud.translation.v3.DetectLanguageRequest.parent", + index=0, + number=5, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=_b( + "\340A\002\372A#\n!locations.googleapis.com/Location" + ), + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="model", + full_name="google.cloud.translation.v3.DetectLanguageRequest.model", + index=1, + number=4, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=_b("\340A\001"), + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="content", + full_name="google.cloud.translation.v3.DetectLanguageRequest.content", + index=2, + number=1, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="mime_type", + full_name="google.cloud.translation.v3.DetectLanguageRequest.mime_type", + index=3, + number=3, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=_b("\340A\001"), + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="labels", + full_name="google.cloud.translation.v3.DetectLanguageRequest.labels", + index=4, + number=6, + type=11, + cpp_type=10, + label=3, + has_default_value=False, + default_value=[], + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=_b("\340A\001"), + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[_DETECTLANGUAGEREQUEST_LABELSENTRY], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[ + _descriptor.OneofDescriptor( + name="source", + full_name="google.cloud.translation.v3.DetectLanguageRequest.source", + index=0, + containing_type=None, + fields=[], + ) + ], + serialized_start=1132, + serialized_end=1419, +) + + +_DETECTEDLANGUAGE = _descriptor.Descriptor( + name="DetectedLanguage", + full_name="google.cloud.translation.v3.DetectedLanguage", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="language_code", + full_name="google.cloud.translation.v3.DetectedLanguage.language_code", + index=0, + number=1, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="confidence", + full_name="google.cloud.translation.v3.DetectedLanguage.confidence", + index=1, + number=2, + type=2, + cpp_type=6, + label=1, + has_default_value=False, + default_value=float(0), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=1421, + serialized_end=1482, +) + + +_DETECTLANGUAGERESPONSE = _descriptor.Descriptor( + name="DetectLanguageResponse", + full_name="google.cloud.translation.v3.DetectLanguageResponse", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="languages", + full_name="google.cloud.translation.v3.DetectLanguageResponse.languages", + index=0, + number=1, + type=11, + cpp_type=10, + label=3, + has_default_value=False, + default_value=[], + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ) + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=1484, + serialized_end=1574, +) + + +_GETSUPPORTEDLANGUAGESREQUEST = _descriptor.Descriptor( + name="GetSupportedLanguagesRequest", + full_name="google.cloud.translation.v3.GetSupportedLanguagesRequest", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="parent", + full_name="google.cloud.translation.v3.GetSupportedLanguagesRequest.parent", + index=0, + number=3, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=_b( + "\340A\002\372A#\n!locations.googleapis.com/Location" + ), + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="display_language_code", + full_name="google.cloud.translation.v3.GetSupportedLanguagesRequest.display_language_code", + index=1, + number=1, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=_b("\340A\001"), + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="model", + full_name="google.cloud.translation.v3.GetSupportedLanguagesRequest.model", + index=2, + number=2, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=_b("\340A\001"), + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=1577, + serialized_end=1722, +) + + +_SUPPORTEDLANGUAGES = _descriptor.Descriptor( + name="SupportedLanguages", + full_name="google.cloud.translation.v3.SupportedLanguages", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="languages", + full_name="google.cloud.translation.v3.SupportedLanguages.languages", + index=0, + number=1, + type=11, + cpp_type=10, + label=3, + has_default_value=False, + default_value=[], + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ) + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=1724, + serialized_end=1811, +) + + +_SUPPORTEDLANGUAGE = _descriptor.Descriptor( + name="SupportedLanguage", + full_name="google.cloud.translation.v3.SupportedLanguage", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="language_code", + full_name="google.cloud.translation.v3.SupportedLanguage.language_code", + index=0, + number=1, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="display_name", + full_name="google.cloud.translation.v3.SupportedLanguage.display_name", + index=1, + number=2, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="support_source", + full_name="google.cloud.translation.v3.SupportedLanguage.support_source", + index=2, + number=3, + type=8, + cpp_type=7, + label=1, + has_default_value=False, + default_value=False, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="support_target", + full_name="google.cloud.translation.v3.SupportedLanguage.support_target", + index=3, + number=4, + type=8, + cpp_type=7, + label=1, + has_default_value=False, + default_value=False, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=1813, + serialized_end=1925, +) + + +_GCSSOURCE = _descriptor.Descriptor( + name="GcsSource", + full_name="google.cloud.translation.v3.GcsSource", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="input_uri", + full_name="google.cloud.translation.v3.GcsSource.input_uri", + index=0, + number=1, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ) + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=1927, + serialized_end=1957, +) + + +_INPUTCONFIG = _descriptor.Descriptor( + name="InputConfig", + full_name="google.cloud.translation.v3.InputConfig", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="mime_type", + full_name="google.cloud.translation.v3.InputConfig.mime_type", + index=0, + number=1, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=_b("\340A\001"), + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="gcs_source", + full_name="google.cloud.translation.v3.InputConfig.gcs_source", + index=1, + number=2, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[ + _descriptor.OneofDescriptor( + name="source", + full_name="google.cloud.translation.v3.InputConfig.source", + index=0, + containing_type=None, + fields=[], + ) + ], + serialized_start=1959, + serialized_end=2068, +) + + +_GCSDESTINATION = _descriptor.Descriptor( + name="GcsDestination", + full_name="google.cloud.translation.v3.GcsDestination", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="output_uri_prefix", + full_name="google.cloud.translation.v3.GcsDestination.output_uri_prefix", + index=0, + number=1, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ) + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=2070, + serialized_end=2113, +) + + +_OUTPUTCONFIG = _descriptor.Descriptor( + name="OutputConfig", + full_name="google.cloud.translation.v3.OutputConfig", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="gcs_destination", + full_name="google.cloud.translation.v3.OutputConfig.gcs_destination", + index=0, + number=1, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ) + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[ + _descriptor.OneofDescriptor( + name="destination", + full_name="google.cloud.translation.v3.OutputConfig.destination", + index=0, + containing_type=None, + fields=[], + ) + ], + serialized_start=2115, + serialized_end=2216, +) + + +_BATCHTRANSLATETEXTREQUEST_MODELSENTRY = _descriptor.Descriptor( + name="ModelsEntry", + full_name="google.cloud.translation.v3.BatchTranslateTextRequest.ModelsEntry", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="key", + full_name="google.cloud.translation.v3.BatchTranslateTextRequest.ModelsEntry.key", + index=0, + number=1, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="value", + full_name="google.cloud.translation.v3.BatchTranslateTextRequest.ModelsEntry.value", + index=1, + number=2, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=_b("8\001"), + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=2794, + serialized_end=2839, +) + +_BATCHTRANSLATETEXTREQUEST_GLOSSARIESENTRY = _descriptor.Descriptor( + name="GlossariesEntry", + full_name="google.cloud.translation.v3.BatchTranslateTextRequest.GlossariesEntry", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="key", + full_name="google.cloud.translation.v3.BatchTranslateTextRequest.GlossariesEntry.key", + index=0, + number=1, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="value", + full_name="google.cloud.translation.v3.BatchTranslateTextRequest.GlossariesEntry.value", + index=1, + number=2, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=_b("8\001"), + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=2841, + serialized_end=2948, +) + +_BATCHTRANSLATETEXTREQUEST_LABELSENTRY = _descriptor.Descriptor( + name="LabelsEntry", + full_name="google.cloud.translation.v3.BatchTranslateTextRequest.LabelsEntry", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="key", + full_name="google.cloud.translation.v3.BatchTranslateTextRequest.LabelsEntry.key", + index=0, + number=1, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="value", + full_name="google.cloud.translation.v3.BatchTranslateTextRequest.LabelsEntry.value", + index=1, + number=2, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=_b("8\001"), + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=750, + serialized_end=795, +) + +_BATCHTRANSLATETEXTREQUEST = _descriptor.Descriptor( + name="BatchTranslateTextRequest", + full_name="google.cloud.translation.v3.BatchTranslateTextRequest", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="parent", + full_name="google.cloud.translation.v3.BatchTranslateTextRequest.parent", + index=0, + number=1, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=_b( + "\340A\002\372A#\n!locations.googleapis.com/Location" + ), + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="source_language_code", + full_name="google.cloud.translation.v3.BatchTranslateTextRequest.source_language_code", + index=1, + number=2, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=_b("\340A\002"), + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="target_language_codes", + full_name="google.cloud.translation.v3.BatchTranslateTextRequest.target_language_codes", + index=2, + number=3, + type=9, + cpp_type=9, + label=3, + has_default_value=False, + default_value=[], + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=_b("\340A\002"), + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="models", + full_name="google.cloud.translation.v3.BatchTranslateTextRequest.models", + index=3, + number=4, + type=11, + cpp_type=10, + label=3, + has_default_value=False, + default_value=[], + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=_b("\340A\001"), + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="input_configs", + full_name="google.cloud.translation.v3.BatchTranslateTextRequest.input_configs", + index=4, + number=5, + type=11, + cpp_type=10, + label=3, + has_default_value=False, + default_value=[], + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=_b("\340A\002"), + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="output_config", + full_name="google.cloud.translation.v3.BatchTranslateTextRequest.output_config", + index=5, + number=6, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=_b("\340A\002"), + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="glossaries", + full_name="google.cloud.translation.v3.BatchTranslateTextRequest.glossaries", + index=6, + number=7, + type=11, + cpp_type=10, + label=3, + has_default_value=False, + default_value=[], + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=_b("\340A\001"), + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="labels", + full_name="google.cloud.translation.v3.BatchTranslateTextRequest.labels", + index=7, + number=9, + type=11, + cpp_type=10, + label=3, + has_default_value=False, + default_value=[], + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=_b("\340A\001"), + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[ + _BATCHTRANSLATETEXTREQUEST_MODELSENTRY, + _BATCHTRANSLATETEXTREQUEST_GLOSSARIESENTRY, + _BATCHTRANSLATETEXTREQUEST_LABELSENTRY, + ], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=2219, + serialized_end=2995, +) + + +_BATCHTRANSLATEMETADATA = _descriptor.Descriptor( + name="BatchTranslateMetadata", + full_name="google.cloud.translation.v3.BatchTranslateMetadata", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="state", + full_name="google.cloud.translation.v3.BatchTranslateMetadata.state", + index=0, + number=1, + type=14, + cpp_type=8, + label=1, + has_default_value=False, + default_value=0, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="translated_characters", + full_name="google.cloud.translation.v3.BatchTranslateMetadata.translated_characters", + index=1, + number=2, + type=3, + cpp_type=2, + label=1, + has_default_value=False, + default_value=0, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="failed_characters", + full_name="google.cloud.translation.v3.BatchTranslateMetadata.failed_characters", + index=2, + number=3, + type=3, + cpp_type=2, + label=1, + has_default_value=False, + default_value=0, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="total_characters", + full_name="google.cloud.translation.v3.BatchTranslateMetadata.total_characters", + index=3, + number=4, + type=3, + cpp_type=2, + label=1, + has_default_value=False, + default_value=0, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="submit_time", + full_name="google.cloud.translation.v3.BatchTranslateMetadata.submit_time", + index=4, + number=5, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[_BATCHTRANSLATEMETADATA_STATE], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=2998, + serialized_end=3332, +) + + +_BATCHTRANSLATERESPONSE = _descriptor.Descriptor( + name="BatchTranslateResponse", + full_name="google.cloud.translation.v3.BatchTranslateResponse", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="total_characters", + full_name="google.cloud.translation.v3.BatchTranslateResponse.total_characters", + index=0, + number=1, + type=3, + cpp_type=2, + label=1, + has_default_value=False, + default_value=0, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="translated_characters", + full_name="google.cloud.translation.v3.BatchTranslateResponse.translated_characters", + index=1, + number=2, + type=3, + cpp_type=2, + label=1, + has_default_value=False, + default_value=0, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="failed_characters", + full_name="google.cloud.translation.v3.BatchTranslateResponse.failed_characters", + index=2, + number=3, + type=3, + cpp_type=2, + label=1, + has_default_value=False, + default_value=0, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="submit_time", + full_name="google.cloud.translation.v3.BatchTranslateResponse.submit_time", + index=3, + number=4, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="end_time", + full_name="google.cloud.translation.v3.BatchTranslateResponse.end_time", + index=4, + number=5, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=3335, + serialized_end=3538, +) + + +_GLOSSARYINPUTCONFIG = _descriptor.Descriptor( + name="GlossaryInputConfig", + full_name="google.cloud.translation.v3.GlossaryInputConfig", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="gcs_source", + full_name="google.cloud.translation.v3.GlossaryInputConfig.gcs_source", + index=0, + number=1, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ) + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[ + _descriptor.OneofDescriptor( + name="source", + full_name="google.cloud.translation.v3.GlossaryInputConfig.source", + index=0, + containing_type=None, + fields=[], + ) + ], + serialized_start=3540, + serialized_end=3633, +) + + +_GLOSSARY_LANGUAGECODEPAIR = _descriptor.Descriptor( + name="LanguageCodePair", + full_name="google.cloud.translation.v3.Glossary.LanguageCodePair", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="source_language_code", + full_name="google.cloud.translation.v3.Glossary.LanguageCodePair.source_language_code", + index=0, + number=1, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="target_language_code", + full_name="google.cloud.translation.v3.Glossary.LanguageCodePair.target_language_code", + index=1, + number=2, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=4032, + serialized_end=4110, +) + +_GLOSSARY_LANGUAGECODESSET = _descriptor.Descriptor( + name="LanguageCodesSet", + full_name="google.cloud.translation.v3.Glossary.LanguageCodesSet", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="language_codes", + full_name="google.cloud.translation.v3.Glossary.LanguageCodesSet.language_codes", + index=0, + number=1, + type=9, + cpp_type=9, + label=3, + has_default_value=False, + default_value=[], + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ) + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=4112, + serialized_end=4154, +) + +_GLOSSARY = _descriptor.Descriptor( + name="Glossary", + full_name="google.cloud.translation.v3.Glossary", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="name", + full_name="google.cloud.translation.v3.Glossary.name", + index=0, + number=1, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="language_pair", + full_name="google.cloud.translation.v3.Glossary.language_pair", + index=1, + number=3, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="language_codes_set", + full_name="google.cloud.translation.v3.Glossary.language_codes_set", + index=2, + number=4, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="input_config", + full_name="google.cloud.translation.v3.Glossary.input_config", + index=3, + number=5, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="entry_count", + full_name="google.cloud.translation.v3.Glossary.entry_count", + index=4, + number=6, + type=5, + cpp_type=1, + label=1, + has_default_value=False, + default_value=0, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=_b("\340A\003"), + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="submit_time", + full_name="google.cloud.translation.v3.Glossary.submit_time", + index=5, + number=7, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=_b("\340A\003"), + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="end_time", + full_name="google.cloud.translation.v3.Glossary.end_time", + index=6, + number=8, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=_b("\340A\003"), + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[_GLOSSARY_LANGUAGECODEPAIR, _GLOSSARY_LANGUAGECODESSET], + enum_types=[], + serialized_options=_b( + "\352Ab\n!translate.googleapis.com/Glossary\022=projects/{project}/locations/{location}/glossaries/{glossary}" + ), + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[ + _descriptor.OneofDescriptor( + name="languages", + full_name="google.cloud.translation.v3.Glossary.languages", + index=0, + containing_type=None, + fields=[], + ) + ], + serialized_start=3636, + serialized_end=4270, +) + + +_CREATEGLOSSARYREQUEST = _descriptor.Descriptor( + name="CreateGlossaryRequest", + full_name="google.cloud.translation.v3.CreateGlossaryRequest", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="parent", + full_name="google.cloud.translation.v3.CreateGlossaryRequest.parent", + index=0, + number=1, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=_b( + "\340A\002\372A#\n!locations.googleapis.com/Location" + ), + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="glossary", + full_name="google.cloud.translation.v3.CreateGlossaryRequest.glossary", + index=1, + number=2, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=_b("\340A\002"), + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=4273, + serialized_end=4417, +) + + +_GETGLOSSARYREQUEST = _descriptor.Descriptor( + name="GetGlossaryRequest", + full_name="google.cloud.translation.v3.GetGlossaryRequest", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="name", + full_name="google.cloud.translation.v3.GetGlossaryRequest.name", + index=0, + number=1, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=_b( + "\340A\002\372A#\n!translate.googleapis.com/Glossary" + ), + file=DESCRIPTOR, + ) + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=4419, + serialized_end=4496, +) + + +_DELETEGLOSSARYREQUEST = _descriptor.Descriptor( + name="DeleteGlossaryRequest", + full_name="google.cloud.translation.v3.DeleteGlossaryRequest", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="name", + full_name="google.cloud.translation.v3.DeleteGlossaryRequest.name", + index=0, + number=1, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=_b( + "\340A\002\372A#\n!translate.googleapis.com/Glossary" + ), + file=DESCRIPTOR, + ) + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=4498, + serialized_end=4578, +) + + +_LISTGLOSSARIESREQUEST = _descriptor.Descriptor( + name="ListGlossariesRequest", + full_name="google.cloud.translation.v3.ListGlossariesRequest", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="parent", + full_name="google.cloud.translation.v3.ListGlossariesRequest.parent", + index=0, + number=1, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=_b( + "\340A\002\372A#\n!locations.googleapis.com/Location" + ), + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="page_size", + full_name="google.cloud.translation.v3.ListGlossariesRequest.page_size", + index=1, + number=2, + type=5, + cpp_type=1, + label=1, + has_default_value=False, + default_value=0, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=_b("\340A\001"), + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="page_token", + full_name="google.cloud.translation.v3.ListGlossariesRequest.page_token", + index=2, + number=3, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=_b("\340A\001"), + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="filter", + full_name="google.cloud.translation.v3.ListGlossariesRequest.filter", + index=3, + number=4, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=_b("\340A\001"), + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=4581, + serialized_end=4733, +) + + +_LISTGLOSSARIESRESPONSE = _descriptor.Descriptor( + name="ListGlossariesResponse", + full_name="google.cloud.translation.v3.ListGlossariesResponse", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="glossaries", + full_name="google.cloud.translation.v3.ListGlossariesResponse.glossaries", + index=0, + number=1, + type=11, + cpp_type=10, + label=3, + has_default_value=False, + default_value=[], + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="next_page_token", + full_name="google.cloud.translation.v3.ListGlossariesResponse.next_page_token", + index=1, + number=2, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=4735, + serialized_end=4843, +) + + +_CREATEGLOSSARYMETADATA = _descriptor.Descriptor( + name="CreateGlossaryMetadata", + full_name="google.cloud.translation.v3.CreateGlossaryMetadata", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="name", + full_name="google.cloud.translation.v3.CreateGlossaryMetadata.name", + index=0, + number=1, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="state", + full_name="google.cloud.translation.v3.CreateGlossaryMetadata.state", + index=1, + number=2, + type=14, + cpp_type=8, + label=1, + has_default_value=False, + default_value=0, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="submit_time", + full_name="google.cloud.translation.v3.CreateGlossaryMetadata.submit_time", + index=2, + number=3, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[_CREATEGLOSSARYMETADATA_STATE], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=4846, + serialized_end=5110, +) + + +_DELETEGLOSSARYMETADATA = _descriptor.Descriptor( + name="DeleteGlossaryMetadata", + full_name="google.cloud.translation.v3.DeleteGlossaryMetadata", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="name", + full_name="google.cloud.translation.v3.DeleteGlossaryMetadata.name", + index=0, + number=1, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="state", + full_name="google.cloud.translation.v3.DeleteGlossaryMetadata.state", + index=1, + number=2, + type=14, + cpp_type=8, + label=1, + has_default_value=False, + default_value=0, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="submit_time", + full_name="google.cloud.translation.v3.DeleteGlossaryMetadata.submit_time", + index=2, + number=3, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[_DELETEGLOSSARYMETADATA_STATE], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=5113, + serialized_end=5377, +) + + +_DELETEGLOSSARYRESPONSE = _descriptor.Descriptor( + name="DeleteGlossaryResponse", + full_name="google.cloud.translation.v3.DeleteGlossaryResponse", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="name", + full_name="google.cloud.translation.v3.DeleteGlossaryResponse.name", + index=0, + number=1, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="submit_time", + full_name="google.cloud.translation.v3.DeleteGlossaryResponse.submit_time", + index=1, + number=2, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="end_time", + full_name="google.cloud.translation.v3.DeleteGlossaryResponse.end_time", + index=2, + number=3, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=5380, + serialized_end=5513, +) + +_TRANSLATETEXTREQUEST_LABELSENTRY.containing_type = _TRANSLATETEXTREQUEST +_TRANSLATETEXTREQUEST.fields_by_name[ + "glossary_config" +].message_type = _TRANSLATETEXTGLOSSARYCONFIG +_TRANSLATETEXTREQUEST.fields_by_name[ + "labels" +].message_type = _TRANSLATETEXTREQUEST_LABELSENTRY +_TRANSLATETEXTRESPONSE.fields_by_name["translations"].message_type = _TRANSLATION +_TRANSLATETEXTRESPONSE.fields_by_name[ + "glossary_translations" +].message_type = _TRANSLATION +_TRANSLATION.fields_by_name[ + "glossary_config" +].message_type = _TRANSLATETEXTGLOSSARYCONFIG +_DETECTLANGUAGEREQUEST_LABELSENTRY.containing_type = _DETECTLANGUAGEREQUEST +_DETECTLANGUAGEREQUEST.fields_by_name[ + "labels" +].message_type = _DETECTLANGUAGEREQUEST_LABELSENTRY +_DETECTLANGUAGEREQUEST.oneofs_by_name["source"].fields.append( + _DETECTLANGUAGEREQUEST.fields_by_name["content"] +) +_DETECTLANGUAGEREQUEST.fields_by_name[ + "content" +].containing_oneof = _DETECTLANGUAGEREQUEST.oneofs_by_name["source"] +_DETECTLANGUAGERESPONSE.fields_by_name["languages"].message_type = _DETECTEDLANGUAGE +_SUPPORTEDLANGUAGES.fields_by_name["languages"].message_type = _SUPPORTEDLANGUAGE +_INPUTCONFIG.fields_by_name["gcs_source"].message_type = _GCSSOURCE +_INPUTCONFIG.oneofs_by_name["source"].fields.append( + _INPUTCONFIG.fields_by_name["gcs_source"] +) +_INPUTCONFIG.fields_by_name[ + "gcs_source" +].containing_oneof = _INPUTCONFIG.oneofs_by_name["source"] +_OUTPUTCONFIG.fields_by_name["gcs_destination"].message_type = _GCSDESTINATION +_OUTPUTCONFIG.oneofs_by_name["destination"].fields.append( + _OUTPUTCONFIG.fields_by_name["gcs_destination"] +) +_OUTPUTCONFIG.fields_by_name[ + "gcs_destination" +].containing_oneof = _OUTPUTCONFIG.oneofs_by_name["destination"] +_BATCHTRANSLATETEXTREQUEST_MODELSENTRY.containing_type = _BATCHTRANSLATETEXTREQUEST +_BATCHTRANSLATETEXTREQUEST_GLOSSARIESENTRY.fields_by_name[ + "value" +].message_type = _TRANSLATETEXTGLOSSARYCONFIG +_BATCHTRANSLATETEXTREQUEST_GLOSSARIESENTRY.containing_type = _BATCHTRANSLATETEXTREQUEST +_BATCHTRANSLATETEXTREQUEST_LABELSENTRY.containing_type = _BATCHTRANSLATETEXTREQUEST +_BATCHTRANSLATETEXTREQUEST.fields_by_name[ + "models" +].message_type = _BATCHTRANSLATETEXTREQUEST_MODELSENTRY +_BATCHTRANSLATETEXTREQUEST.fields_by_name["input_configs"].message_type = _INPUTCONFIG +_BATCHTRANSLATETEXTREQUEST.fields_by_name["output_config"].message_type = _OUTPUTCONFIG +_BATCHTRANSLATETEXTREQUEST.fields_by_name[ + "glossaries" +].message_type = _BATCHTRANSLATETEXTREQUEST_GLOSSARIESENTRY +_BATCHTRANSLATETEXTREQUEST.fields_by_name[ + "labels" +].message_type = _BATCHTRANSLATETEXTREQUEST_LABELSENTRY +_BATCHTRANSLATEMETADATA.fields_by_name[ + "state" +].enum_type = _BATCHTRANSLATEMETADATA_STATE +_BATCHTRANSLATEMETADATA.fields_by_name[ + "submit_time" +].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP +_BATCHTRANSLATEMETADATA_STATE.containing_type = _BATCHTRANSLATEMETADATA +_BATCHTRANSLATERESPONSE.fields_by_name[ + "submit_time" +].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP +_BATCHTRANSLATERESPONSE.fields_by_name[ + "end_time" +].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP +_GLOSSARYINPUTCONFIG.fields_by_name["gcs_source"].message_type = _GCSSOURCE +_GLOSSARYINPUTCONFIG.oneofs_by_name["source"].fields.append( + _GLOSSARYINPUTCONFIG.fields_by_name["gcs_source"] +) +_GLOSSARYINPUTCONFIG.fields_by_name[ + "gcs_source" +].containing_oneof = _GLOSSARYINPUTCONFIG.oneofs_by_name["source"] +_GLOSSARY_LANGUAGECODEPAIR.containing_type = _GLOSSARY +_GLOSSARY_LANGUAGECODESSET.containing_type = _GLOSSARY +_GLOSSARY.fields_by_name["language_pair"].message_type = _GLOSSARY_LANGUAGECODEPAIR +_GLOSSARY.fields_by_name["language_codes_set"].message_type = _GLOSSARY_LANGUAGECODESSET +_GLOSSARY.fields_by_name["input_config"].message_type = _GLOSSARYINPUTCONFIG +_GLOSSARY.fields_by_name[ + "submit_time" +].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP +_GLOSSARY.fields_by_name[ + "end_time" +].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP +_GLOSSARY.oneofs_by_name["languages"].fields.append( + _GLOSSARY.fields_by_name["language_pair"] +) +_GLOSSARY.fields_by_name["language_pair"].containing_oneof = _GLOSSARY.oneofs_by_name[ + "languages" +] +_GLOSSARY.oneofs_by_name["languages"].fields.append( + _GLOSSARY.fields_by_name["language_codes_set"] +) +_GLOSSARY.fields_by_name[ + "language_codes_set" +].containing_oneof = _GLOSSARY.oneofs_by_name["languages"] +_CREATEGLOSSARYREQUEST.fields_by_name["glossary"].message_type = _GLOSSARY +_LISTGLOSSARIESRESPONSE.fields_by_name["glossaries"].message_type = _GLOSSARY +_CREATEGLOSSARYMETADATA.fields_by_name[ + "state" +].enum_type = _CREATEGLOSSARYMETADATA_STATE +_CREATEGLOSSARYMETADATA.fields_by_name[ + "submit_time" +].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP +_CREATEGLOSSARYMETADATA_STATE.containing_type = _CREATEGLOSSARYMETADATA +_DELETEGLOSSARYMETADATA.fields_by_name[ + "state" +].enum_type = _DELETEGLOSSARYMETADATA_STATE +_DELETEGLOSSARYMETADATA.fields_by_name[ + "submit_time" +].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP +_DELETEGLOSSARYMETADATA_STATE.containing_type = _DELETEGLOSSARYMETADATA +_DELETEGLOSSARYRESPONSE.fields_by_name[ + "submit_time" +].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP +_DELETEGLOSSARYRESPONSE.fields_by_name[ + "end_time" +].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP +DESCRIPTOR.message_types_by_name[ + "TranslateTextGlossaryConfig" +] = _TRANSLATETEXTGLOSSARYCONFIG +DESCRIPTOR.message_types_by_name["TranslateTextRequest"] = _TRANSLATETEXTREQUEST +DESCRIPTOR.message_types_by_name["TranslateTextResponse"] = _TRANSLATETEXTRESPONSE +DESCRIPTOR.message_types_by_name["Translation"] = _TRANSLATION +DESCRIPTOR.message_types_by_name["DetectLanguageRequest"] = _DETECTLANGUAGEREQUEST +DESCRIPTOR.message_types_by_name["DetectedLanguage"] = _DETECTEDLANGUAGE +DESCRIPTOR.message_types_by_name["DetectLanguageResponse"] = _DETECTLANGUAGERESPONSE +DESCRIPTOR.message_types_by_name[ + "GetSupportedLanguagesRequest" +] = _GETSUPPORTEDLANGUAGESREQUEST +DESCRIPTOR.message_types_by_name["SupportedLanguages"] = _SUPPORTEDLANGUAGES +DESCRIPTOR.message_types_by_name["SupportedLanguage"] = _SUPPORTEDLANGUAGE +DESCRIPTOR.message_types_by_name["GcsSource"] = _GCSSOURCE +DESCRIPTOR.message_types_by_name["InputConfig"] = _INPUTCONFIG +DESCRIPTOR.message_types_by_name["GcsDestination"] = _GCSDESTINATION +DESCRIPTOR.message_types_by_name["OutputConfig"] = _OUTPUTCONFIG +DESCRIPTOR.message_types_by_name[ + "BatchTranslateTextRequest" +] = _BATCHTRANSLATETEXTREQUEST +DESCRIPTOR.message_types_by_name["BatchTranslateMetadata"] = _BATCHTRANSLATEMETADATA +DESCRIPTOR.message_types_by_name["BatchTranslateResponse"] = _BATCHTRANSLATERESPONSE +DESCRIPTOR.message_types_by_name["GlossaryInputConfig"] = _GLOSSARYINPUTCONFIG +DESCRIPTOR.message_types_by_name["Glossary"] = _GLOSSARY +DESCRIPTOR.message_types_by_name["CreateGlossaryRequest"] = _CREATEGLOSSARYREQUEST +DESCRIPTOR.message_types_by_name["GetGlossaryRequest"] = _GETGLOSSARYREQUEST +DESCRIPTOR.message_types_by_name["DeleteGlossaryRequest"] = _DELETEGLOSSARYREQUEST +DESCRIPTOR.message_types_by_name["ListGlossariesRequest"] = _LISTGLOSSARIESREQUEST +DESCRIPTOR.message_types_by_name["ListGlossariesResponse"] = _LISTGLOSSARIESRESPONSE +DESCRIPTOR.message_types_by_name["CreateGlossaryMetadata"] = _CREATEGLOSSARYMETADATA +DESCRIPTOR.message_types_by_name["DeleteGlossaryMetadata"] = _DELETEGLOSSARYMETADATA +DESCRIPTOR.message_types_by_name["DeleteGlossaryResponse"] = _DELETEGLOSSARYRESPONSE +_sym_db.RegisterFileDescriptor(DESCRIPTOR) + +TranslateTextGlossaryConfig = _reflection.GeneratedProtocolMessageType( + "TranslateTextGlossaryConfig", + (_message.Message,), + dict( + DESCRIPTOR=_TRANSLATETEXTGLOSSARYCONFIG, + __module__="google.cloud.translation_v3.proto.translation_service_pb2", + __doc__="""Configures which glossary should be used for a specific target language, + and defines options for applying that glossary. + + + Attributes: + glossary: + Required. Specifies the glossary used for this translation. + Use this format: projects/\ */locations/*/glossaries/\* + ignore_case: + Optional. Indicates match is case-insensitive. Default value + is false if missing. + """, + # @@protoc_insertion_point(class_scope:google.cloud.translation.v3.TranslateTextGlossaryConfig) + ), +) +_sym_db.RegisterMessage(TranslateTextGlossaryConfig) + +TranslateTextRequest = _reflection.GeneratedProtocolMessageType( + "TranslateTextRequest", + (_message.Message,), + dict( + LabelsEntry=_reflection.GeneratedProtocolMessageType( + "LabelsEntry", + (_message.Message,), + dict( + DESCRIPTOR=_TRANSLATETEXTREQUEST_LABELSENTRY, + __module__="google.cloud.translation_v3.proto.translation_service_pb2" + # @@protoc_insertion_point(class_scope:google.cloud.translation.v3.TranslateTextRequest.LabelsEntry) + ), + ), + DESCRIPTOR=_TRANSLATETEXTREQUEST, + __module__="google.cloud.translation_v3.proto.translation_service_pb2", + __doc__="""The request message for synchronous translation. + + + Attributes: + contents: + Required. The content of the input in string format. We + recommend the total content be less than 30k codepoints. Use + BatchTranslateText for larger text. + mime_type: + Optional. The format of the source text, for example, + "text/html", "text/plain". If left blank, the MIME type + defaults to "text/html". + source_language_code: + Optional. The BCP-47 language code of the input text if known, + for example, "en-US" or "sr-Latn". Supported language codes + are listed in Language Support. If the source language isn't + specified, the API attempts to identify the source language + automatically and returns the source language within the + response. + target_language_code: + Required. The BCP-47 language code to use for translation of + the input text, set to one of the language codes listed in + Language Support. + parent: + Required. Project or location to make a call. Must refer to a + caller's project. Format: ``projects/{project-number-or-id}`` + or ``projects/{project-number-or-id}/locations/{location- + id}``. For global calls, use ``projects/{project-number-or- + id}/locations/global`` or ``projects/{project-number-or-id}``. + Non-global location is required for requests using AutoML + models or custom glossaries. Models and glossaries must be + within the same region (have same location-id), otherwise an + INVALID\_ARGUMENT (400) error is returned. + model: + Optional. The ``model`` type requested for this translation. + The format depends on model type: - AutoML Translation + models: ``projects/{project-number-or- + id}/locations/{location-id}/models/{model-id}`` - General + (built-in) models: ``projects/{project-number-or- + id}/locations/{location-id}/models/general/nmt``, + ``projects/{project-number-or-id}/locations/{location- + id}/models/general/base`` For global (non-regionalized) + requests, use ``location-id`` ``global``. For example, + ``projects/{project-number-or- + id}/locations/global/models/general/nmt``. If missing, the + system decides which google base model to use. + glossary_config: + Optional. Glossary to be applied. The glossary must be within + the same region (have the same location-id) as the model, + otherwise an INVALID\_ARGUMENT (400) error is returned. + labels: + Optional. The labels with user-defined metadata for the + request. Label keys and values can be no longer than 63 + characters (Unicode codepoints), can only contain lowercase + letters, numeric characters, underscores and dashes. + International characters are allowed. Label values are + optional. Label keys must start with a letter. See + https://cloud.google.com/translate/docs/labels for more + information. + """, + # @@protoc_insertion_point(class_scope:google.cloud.translation.v3.TranslateTextRequest) + ), +) +_sym_db.RegisterMessage(TranslateTextRequest) +_sym_db.RegisterMessage(TranslateTextRequest.LabelsEntry) + +TranslateTextResponse = _reflection.GeneratedProtocolMessageType( + "TranslateTextResponse", + (_message.Message,), + dict( + DESCRIPTOR=_TRANSLATETEXTRESPONSE, + __module__="google.cloud.translation_v3.proto.translation_service_pb2", + __doc__=""" + Attributes: + translations: + Text translation responses with no glossary applied. This + field has the same length as [``contents``][google.cloud.trans + lation.v3.TranslateTextRequest.contents]. + glossary_translations: + Text translation responses if a glossary is provided in the + request. This can be the same as [``translations``][google.clo + ud.translation.v3.TranslateTextResponse.translations] if no + terms apply. This field has the same length as [``contents``][ + google.cloud.translation.v3.TranslateTextRequest.contents]. + """, + # @@protoc_insertion_point(class_scope:google.cloud.translation.v3.TranslateTextResponse) + ), +) +_sym_db.RegisterMessage(TranslateTextResponse) + +Translation = _reflection.GeneratedProtocolMessageType( + "Translation", + (_message.Message,), + dict( + DESCRIPTOR=_TRANSLATION, + __module__="google.cloud.translation_v3.proto.translation_service_pb2", + __doc__="""A single translation response. + + + Attributes: + translated_text: + Text translated into the target language. + model: + Only present when ``model`` is present in the request. + ``model`` here is normalized to have project number. For + example: If the ``model`` requested in TranslationTextRequest + is ``projects/{project-id}/locations/{location- + id}/models/general/nmt`` then ``model`` here would be + normalized to ``projects/{project-number}/locations/{location- + id}/models/general/nmt``. + detected_language_code: + The BCP-47 language code of source text in the initial + request, detected automatically, if no source language was + passed within the initial request. If the source language was + passed, auto-detection of the language does not occur and this + field is empty. + glossary_config: + The ``glossary_config`` used for this translation. + """, + # @@protoc_insertion_point(class_scope:google.cloud.translation.v3.Translation) + ), +) +_sym_db.RegisterMessage(Translation) + +DetectLanguageRequest = _reflection.GeneratedProtocolMessageType( + "DetectLanguageRequest", + (_message.Message,), + dict( + LabelsEntry=_reflection.GeneratedProtocolMessageType( + "LabelsEntry", + (_message.Message,), + dict( + DESCRIPTOR=_DETECTLANGUAGEREQUEST_LABELSENTRY, + __module__="google.cloud.translation_v3.proto.translation_service_pb2" + # @@protoc_insertion_point(class_scope:google.cloud.translation.v3.DetectLanguageRequest.LabelsEntry) + ), + ), + DESCRIPTOR=_DETECTLANGUAGEREQUEST, + __module__="google.cloud.translation_v3.proto.translation_service_pb2", + __doc__="""The request message for language detection. + + + Attributes: + parent: + Required. Project or location to make a call. Must refer to a + caller's project. Format: ``projects/{project-number-or- + id}/locations/{location-id}`` or ``projects/{project-number- + or-id}``. For global calls, use ``projects/{project-number- + or-id}/locations/global`` or ``projects/{project-number-or- + id}``. Only models within the same region (has same location- + id) can be used. Otherwise an INVALID\_ARGUMENT (400) error is + returned. + model: + Optional. The language detection model to be used. Format: + ``projects/{project-number-or-id}/locations/{location- + id}/models/language-detection/{model-id}`` Only one language + detection model is currently supported: ``projects/{project- + number-or-id}/locations/{location-id}/models/language- + detection/default``. If not specified, the default model is + used. + source: + Required. The source of the document from which to detect the + language. + content: + The content of the input stored as a string. + mime_type: + Optional. The format of the source text, for example, + "text/html", "text/plain". If left blank, the MIME type + defaults to "text/html". + labels: + Optional. The labels with user-defined metadata for the + request. Label keys and values can be no longer than 63 + characters (Unicode codepoints), can only contain lowercase + letters, numeric characters, underscores and dashes. + International characters are allowed. Label values are + optional. Label keys must start with a letter. See + https://cloud.google.com/translate/docs/labels for more + information. + """, + # @@protoc_insertion_point(class_scope:google.cloud.translation.v3.DetectLanguageRequest) + ), +) +_sym_db.RegisterMessage(DetectLanguageRequest) +_sym_db.RegisterMessage(DetectLanguageRequest.LabelsEntry) + +DetectedLanguage = _reflection.GeneratedProtocolMessageType( + "DetectedLanguage", + (_message.Message,), + dict( + DESCRIPTOR=_DETECTEDLANGUAGE, + __module__="google.cloud.translation_v3.proto.translation_service_pb2", + __doc__="""The response message for language detection. + + + Attributes: + language_code: + The BCP-47 language code of source content in the request, + detected automatically. + confidence: + The confidence of the detection result for this language. + """, + # @@protoc_insertion_point(class_scope:google.cloud.translation.v3.DetectedLanguage) + ), +) +_sym_db.RegisterMessage(DetectedLanguage) + +DetectLanguageResponse = _reflection.GeneratedProtocolMessageType( + "DetectLanguageResponse", + (_message.Message,), + dict( + DESCRIPTOR=_DETECTLANGUAGERESPONSE, + __module__="google.cloud.translation_v3.proto.translation_service_pb2", + __doc__="""The response message for language detection. + + + Attributes: + languages: + A list of detected languages sorted by detection confidence in + descending order. The most probable language first. + """, + # @@protoc_insertion_point(class_scope:google.cloud.translation.v3.DetectLanguageResponse) + ), +) +_sym_db.RegisterMessage(DetectLanguageResponse) + +GetSupportedLanguagesRequest = _reflection.GeneratedProtocolMessageType( + "GetSupportedLanguagesRequest", + (_message.Message,), + dict( + DESCRIPTOR=_GETSUPPORTEDLANGUAGESREQUEST, + __module__="google.cloud.translation_v3.proto.translation_service_pb2", + __doc__="""The request message for discovering supported languages. + + + Attributes: + parent: + Required. Project or location to make a call. Must refer to a + caller's project. Format: ``projects/{project-number-or-id}`` + or ``projects/{project-number-or-id}/locations/{location- + id}``. For global calls, use ``projects/{project-number-or- + id}/locations/global`` or ``projects/{project-number-or-id}``. + Non-global location is required for AutoML models. Only + models within the same region (have same location-id) can be + used, otherwise an INVALID\_ARGUMENT (400) error is returned. + display_language_code: + Optional. The language to use to return localized, human + readable names of supported languages. If missing, then + display names are not returned in a response. + model: + Optional. Get supported languages of this model. The format + depends on model type: - AutoML Translation models: + ``projects/{project-number-or-id}/locations/{location- + id}/models/{model-id}`` - General (built-in) models: + ``projects/{project-number-or-id}/locations/{location- + id}/models/general/nmt``, ``projects/{project-number-or- + id}/locations/{location-id}/models/general/base`` Returns + languages supported by the specified model. If missing, we get + supported languages of Google general base (PBMT) model. + """, + # @@protoc_insertion_point(class_scope:google.cloud.translation.v3.GetSupportedLanguagesRequest) + ), +) +_sym_db.RegisterMessage(GetSupportedLanguagesRequest) + +SupportedLanguages = _reflection.GeneratedProtocolMessageType( + "SupportedLanguages", + (_message.Message,), + dict( + DESCRIPTOR=_SUPPORTEDLANGUAGES, + __module__="google.cloud.translation_v3.proto.translation_service_pb2", + __doc__="""The response message for discovering supported languages. + + + Attributes: + languages: + A list of supported language responses. This list contains an + entry for each language the Translation API supports. + """, + # @@protoc_insertion_point(class_scope:google.cloud.translation.v3.SupportedLanguages) + ), +) +_sym_db.RegisterMessage(SupportedLanguages) + +SupportedLanguage = _reflection.GeneratedProtocolMessageType( + "SupportedLanguage", + (_message.Message,), + dict( + DESCRIPTOR=_SUPPORTEDLANGUAGE, + __module__="google.cloud.translation_v3.proto.translation_service_pb2", + __doc__="""A single supported language response corresponds to information related + to one supported language. + + + Attributes: + language_code: + Supported language code, generally consisting of its ISO 639-1 + identifier, for example, 'en', 'ja'. In certain cases, BCP-47 + codes including language and region identifiers are returned + (for example, 'zh-TW' and 'zh-CN') + display_name: + Human readable name of the language localized in the display + language specified in the request. + support_source: + Can be used as source language. + support_target: + Can be used as target language. + """, + # @@protoc_insertion_point(class_scope:google.cloud.translation.v3.SupportedLanguage) + ), +) +_sym_db.RegisterMessage(SupportedLanguage) + +GcsSource = _reflection.GeneratedProtocolMessageType( + "GcsSource", + (_message.Message,), + dict( + DESCRIPTOR=_GCSSOURCE, + __module__="google.cloud.translation_v3.proto.translation_service_pb2", + __doc__="""The Google Cloud Storage location for the input content. + + + Attributes: + input_uri: + Required. Source data URI. For example, + ``gs://my_bucket/my_object``. + """, + # @@protoc_insertion_point(class_scope:google.cloud.translation.v3.GcsSource) + ), +) +_sym_db.RegisterMessage(GcsSource) + +InputConfig = _reflection.GeneratedProtocolMessageType( + "InputConfig", + (_message.Message,), + dict( + DESCRIPTOR=_INPUTCONFIG, + __module__="google.cloud.translation_v3.proto.translation_service_pb2", + __doc__="""Input configuration for BatchTranslateText request. + + + Attributes: + mime_type: + Optional. Can be "text/plain" or "text/html". For ``.tsv``, + "text/html" is used if mime\_type is missing. For ``.html``, + this field must be "text/html" or empty. For ``.txt``, this + field must be "text/plain" or empty. + source: + Required. Specify the input. + gcs_source: + Required. Google Cloud Storage location for the source input. + This can be a single file (for example, ``gs://translation- + test/input.tsv``) or a wildcard (for example, + ``gs://translation-test/*``). If a file extension is ``.tsv``, + it can contain either one or two columns. The first column + (optional) is the id of the text request. If the first column + is missing, we use the row number (0-based) from the input + file as the ID in the output file. The second column is the + actual text to be translated. We recommend each row be <= 10K + Unicode codepoints, otherwise an error might be returned. Note + that the input tsv must be RFC 4180 compliant. You could use + https://github.com/Clever/csvlint to check potential + formatting errors in your tsv file. csvlint --delimiter=':raw- + latex:`\t`' your\_input\_file.tsv The other supported file + extensions are ``.txt`` or ``.html``, which is treated as a + single large chunk of text. + """, + # @@protoc_insertion_point(class_scope:google.cloud.translation.v3.InputConfig) + ), +) +_sym_db.RegisterMessage(InputConfig) + +GcsDestination = _reflection.GeneratedProtocolMessageType( + "GcsDestination", + (_message.Message,), + dict( + DESCRIPTOR=_GCSDESTINATION, + __module__="google.cloud.translation_v3.proto.translation_service_pb2", + __doc__="""The Google Cloud Storage location for the output content. + + + Attributes: + output_uri_prefix: + Required. There must be no files under 'output\_uri\_prefix'. + 'output\_uri\_prefix' must end with "/" and start with + "gs://", otherwise an INVALID\_ARGUMENT (400) error is + returned. + """, + # @@protoc_insertion_point(class_scope:google.cloud.translation.v3.GcsDestination) + ), +) +_sym_db.RegisterMessage(GcsDestination) + +OutputConfig = _reflection.GeneratedProtocolMessageType( + "OutputConfig", + (_message.Message,), + dict( + DESCRIPTOR=_OUTPUTCONFIG, + __module__="google.cloud.translation_v3.proto.translation_service_pb2", + __doc__="""Output configuration for BatchTranslateText request. + + + Attributes: + destination: + Required. The destination of output. + gcs_destination: + Google Cloud Storage destination for output content. For every + single input file (for example, gs://a/b/c.[extension]), we + generate at most 2 \* n output files. (n is the # of + target\_language\_codes in the BatchTranslateTextRequest). + Output files (tsv) generated are compliant with RFC 4180 + except that record delimiters are ``\\\\n`` instead of + ``\\\\r\\\\n``. We don't provide any way to + change record delimiters. While the input files are being + processed, we write/update an index file 'index.csv' under + 'output\_uri\_prefix' (for example, gs://translation- + test/index.csv) The index file is generated/updated as new + files are being translated. The format is: input\_file,target + \_language\_code,translations\_file,errors\_file, + glossary\_translations\_file,glossary\_errors\_file + input\_file is one file we matched using + gcs\_source.input\_uri. target\_language\_code is provided in + the request. translations\_file contains the translations. + (details provided below) errors\_file contains the errors + during processing of the file. (details below). Both + translations\_file and errors\_file could be empty strings if + we have no content to output. glossary\_translations\_file and + glossary\_errors\_file are always empty strings if the + input\_file is tsv. They could also be empty if we have no + content to output. Once a row is present in index.csv, the + input/output matching never changes. Callers should also + expect all the content in input\_file are processed and ready + to be consumed (that is, no partial output file is written). + The format of translations\_file (for target language code + 'trg') is: gs://translation\_test/a\_b\_c\_'trg'\_translations + .[extension] If the input file extension is tsv, the output + has the following columns: Column 1: ID of the request + provided in the input, if it's not provided in the input, then + the input row number is used (0-based). Column 2: source + sentence. Column 3: translation without applying a glossary. + Empty string if there is an error. Column 4 (only present if a + glossary is provided in the request): translation after + applying the glossary. Empty string if there is an error + applying the glossary. Could be same string as column 3 if + there is no glossary applied. If input file extension is a + txt or html, the translation is directly written to the output + file. If glossary is requested, a separate + glossary\_translations\_file has format of gs://translation\_t + est/a\_b\_c\_'trg'\_glossary\_translations.[extension] The + format of errors file (for target language code 'trg') is: + gs://translation\_test/a\_b\_c\_'trg'\_errors.[extension] If + the input file extension is tsv, errors\_file contains the + following: Column 1: ID of the request provided in the input, + if it's not provided in the input, then the input row number + is used (0-based). Column 2: source sentence. Column 3: Error + detail for the translation. Could be empty. Column 4 (only + present if a glossary is provided in the request): Error when + applying the glossary. If the input file extension is txt or + html, glossary\_error\_file will be generated that contains + error details. glossary\_error\_file has format of gs://transl + ation\_test/a\_b\_c\_'trg'\_glossary\_errors.[extension] + """, + # @@protoc_insertion_point(class_scope:google.cloud.translation.v3.OutputConfig) + ), +) +_sym_db.RegisterMessage(OutputConfig) + +BatchTranslateTextRequest = _reflection.GeneratedProtocolMessageType( + "BatchTranslateTextRequest", + (_message.Message,), + dict( + ModelsEntry=_reflection.GeneratedProtocolMessageType( + "ModelsEntry", + (_message.Message,), + dict( + DESCRIPTOR=_BATCHTRANSLATETEXTREQUEST_MODELSENTRY, + __module__="google.cloud.translation_v3.proto.translation_service_pb2" + # @@protoc_insertion_point(class_scope:google.cloud.translation.v3.BatchTranslateTextRequest.ModelsEntry) + ), + ), + GlossariesEntry=_reflection.GeneratedProtocolMessageType( + "GlossariesEntry", + (_message.Message,), + dict( + DESCRIPTOR=_BATCHTRANSLATETEXTREQUEST_GLOSSARIESENTRY, + __module__="google.cloud.translation_v3.proto.translation_service_pb2" + # @@protoc_insertion_point(class_scope:google.cloud.translation.v3.BatchTranslateTextRequest.GlossariesEntry) + ), + ), + LabelsEntry=_reflection.GeneratedProtocolMessageType( + "LabelsEntry", + (_message.Message,), + dict( + DESCRIPTOR=_BATCHTRANSLATETEXTREQUEST_LABELSENTRY, + __module__="google.cloud.translation_v3.proto.translation_service_pb2" + # @@protoc_insertion_point(class_scope:google.cloud.translation.v3.BatchTranslateTextRequest.LabelsEntry) + ), + ), + DESCRIPTOR=_BATCHTRANSLATETEXTREQUEST, + __module__="google.cloud.translation_v3.proto.translation_service_pb2", + __doc__="""The batch translation request. + + + Attributes: + parent: + Required. Location to make a call. Must refer to a caller's + project. Format: ``projects/{project-number-or- + id}/locations/{location-id}``. The ``global`` location is not + supported for batch translation. Only AutoML Translation + models or glossaries within the same region (have the same + location-id) can be used, otherwise an INVALID\_ARGUMENT (400) + error is returned. + source_language_code: + Required. Source language code. + target_language_codes: + Required. Specify up to 10 language codes here. + models: + Optional. The models to use for translation. Map's key is + target language code. Map's value is model name. Value can be + a built-in general model, or an AutoML Translation model. The + value format depends on model type: - AutoML Translation + models: ``projects/{project-number-or- + id}/locations/{location-id}/models/{model-id}`` - General + (built-in) models: ``projects/{project-number-or- + id}/locations/{location-id}/models/general/nmt``, + ``projects/{project-number-or-id}/locations/{location- + id}/models/general/base`` If the map is empty or a specific + model is not requested for a language pair, then default + google model (nmt) is used. + input_configs: + Required. Input configurations. The total number of files + matched should be <= 1000. The total content size should be <= + 100M Unicode codepoints. The files must use UTF-8 encoding. + output_config: + Required. Output configuration. If 2 input configs match to + the same file (that is, same input path), we don't generate + output for duplicate inputs. + glossaries: + Optional. Glossaries to be applied for translation. It's keyed + by target language code. + labels: + Optional. The labels with user-defined metadata for the + request. Label keys and values can be no longer than 63 + characters (Unicode codepoints), can only contain lowercase + letters, numeric characters, underscores and dashes. + International characters are allowed. Label values are + optional. Label keys must start with a letter. See + https://cloud.google.com/translate/docs/labels for more + information. + """, + # @@protoc_insertion_point(class_scope:google.cloud.translation.v3.BatchTranslateTextRequest) + ), +) +_sym_db.RegisterMessage(BatchTranslateTextRequest) +_sym_db.RegisterMessage(BatchTranslateTextRequest.ModelsEntry) +_sym_db.RegisterMessage(BatchTranslateTextRequest.GlossariesEntry) +_sym_db.RegisterMessage(BatchTranslateTextRequest.LabelsEntry) + +BatchTranslateMetadata = _reflection.GeneratedProtocolMessageType( + "BatchTranslateMetadata", + (_message.Message,), + dict( + DESCRIPTOR=_BATCHTRANSLATEMETADATA, + __module__="google.cloud.translation_v3.proto.translation_service_pb2", + __doc__="""State metadata for the batch translation operation. + + + Attributes: + state: + The state of the operation. + translated_characters: + Number of successfully translated characters so far (Unicode + codepoints). + failed_characters: + Number of characters that have failed to process so far + (Unicode codepoints). + total_characters: + Total number of characters (Unicode codepoints). This is the + total number of codepoints from input files times the number + of target languages and appears here shortly after the call is + submitted. + submit_time: + Time when the operation was submitted. + """, + # @@protoc_insertion_point(class_scope:google.cloud.translation.v3.BatchTranslateMetadata) + ), +) +_sym_db.RegisterMessage(BatchTranslateMetadata) + +BatchTranslateResponse = _reflection.GeneratedProtocolMessageType( + "BatchTranslateResponse", + (_message.Message,), + dict( + DESCRIPTOR=_BATCHTRANSLATERESPONSE, + __module__="google.cloud.translation_v3.proto.translation_service_pb2", + __doc__="""Stored in the + [google.longrunning.Operation.response][google.longrunning.Operation.response] + field returned by BatchTranslateText if at least one sentence is + translated successfully. + + + Attributes: + total_characters: + Total number of characters (Unicode codepoints). + translated_characters: + Number of successfully translated characters (Unicode + codepoints). + failed_characters: + Number of characters that have failed to process (Unicode + codepoints). + submit_time: + Time when the operation was submitted. + end_time: + The time when the operation is finished and [google.longrunnin + g.Operation.done][google.longrunning.Operation.done] is set to + true. + """, + # @@protoc_insertion_point(class_scope:google.cloud.translation.v3.BatchTranslateResponse) + ), +) +_sym_db.RegisterMessage(BatchTranslateResponse) + +GlossaryInputConfig = _reflection.GeneratedProtocolMessageType( + "GlossaryInputConfig", + (_message.Message,), + dict( + DESCRIPTOR=_GLOSSARYINPUTCONFIG, + __module__="google.cloud.translation_v3.proto.translation_service_pb2", + __doc__="""Input configuration for glossaries. + + + Attributes: + source: + Required. Specify the input. + gcs_source: + Required. Google Cloud Storage location of glossary data. File + format is determined based on the filename extension. API + returns [google.rpc.Code.INVALID\_ARGUMENT] for unsupported + URI-s and file formats. Wildcards are not allowed. This must + be a single file in one of the following formats: For + unidirectional glossaries: - TSV/CSV (``.tsv``/``.csv``): 2 + column file, tab- or comma-separated. The first column is + source text. The second column is target text. The file + must not contain headers. That is, the first row is data, + not column names. - TMX (``.tmx``): TMX file with parallel + data defining source/target term pairs. For equivalent + term sets glossaries: - CSV (``.csv``): Multi-column CSV + file defining equivalent glossary terms in multiple + languages. The format is defined for Google Translation + Toolkit and documented in `Use a glossary `__. + """, + # @@protoc_insertion_point(class_scope:google.cloud.translation.v3.GlossaryInputConfig) + ), +) +_sym_db.RegisterMessage(GlossaryInputConfig) + +Glossary = _reflection.GeneratedProtocolMessageType( + "Glossary", + (_message.Message,), + dict( + LanguageCodePair=_reflection.GeneratedProtocolMessageType( + "LanguageCodePair", + (_message.Message,), + dict( + DESCRIPTOR=_GLOSSARY_LANGUAGECODEPAIR, + __module__="google.cloud.translation_v3.proto.translation_service_pb2", + __doc__="""Used with unidirectional glossaries. + + + Attributes: + source_language_code: + Required. The BCP-47 language code of the input text, for + example, "en-US". Expected to be an exact match for + GlossaryTerm.language\_code. + target_language_code: + Required. The BCP-47 language code for translation output, for + example, "zh-CN". Expected to be an exact match for + GlossaryTerm.language\_code. + """, + # @@protoc_insertion_point(class_scope:google.cloud.translation.v3.Glossary.LanguageCodePair) + ), + ), + LanguageCodesSet=_reflection.GeneratedProtocolMessageType( + "LanguageCodesSet", + (_message.Message,), + dict( + DESCRIPTOR=_GLOSSARY_LANGUAGECODESSET, + __module__="google.cloud.translation_v3.proto.translation_service_pb2", + __doc__="""Used with equivalent term set glossaries. + + + Attributes: + language_codes: + The BCP-47 language code(s) for terms defined in the glossary. + All entries are unique. The list contains at least two + entries. Expected to be an exact match for + GlossaryTerm.language\_code. + """, + # @@protoc_insertion_point(class_scope:google.cloud.translation.v3.Glossary.LanguageCodesSet) + ), + ), + DESCRIPTOR=_GLOSSARY, + __module__="google.cloud.translation_v3.proto.translation_service_pb2", + __doc__="""Represents a glossary built from user provided data. + + + Attributes: + name: + Required. The resource name of the glossary. Glossary names + have the form ``projects/{project-number-or- + id}/locations/{location-id}/glossaries/{glossary-id}``. + languages: + Languages supported by the glossary. + language_pair: + Used with unidirectional glossaries. + language_codes_set: + Used with equivalent term set glossaries. + input_config: + Required. Provides examples to build the glossary from. Total + glossary must not exceed 10M Unicode codepoints. + entry_count: + Output only. The number of entries defined in the glossary. + submit_time: + Output only. When CreateGlossary was called. + end_time: + Output only. When the glossary creation was finished. + """, + # @@protoc_insertion_point(class_scope:google.cloud.translation.v3.Glossary) + ), +) +_sym_db.RegisterMessage(Glossary) +_sym_db.RegisterMessage(Glossary.LanguageCodePair) +_sym_db.RegisterMessage(Glossary.LanguageCodesSet) + +CreateGlossaryRequest = _reflection.GeneratedProtocolMessageType( + "CreateGlossaryRequest", + (_message.Message,), + dict( + DESCRIPTOR=_CREATEGLOSSARYREQUEST, + __module__="google.cloud.translation_v3.proto.translation_service_pb2", + __doc__="""Request message for CreateGlossary. + + + Attributes: + parent: + Required. The project name. + glossary: + Required. The glossary to create. + """, + # @@protoc_insertion_point(class_scope:google.cloud.translation.v3.CreateGlossaryRequest) + ), +) +_sym_db.RegisterMessage(CreateGlossaryRequest) + +GetGlossaryRequest = _reflection.GeneratedProtocolMessageType( + "GetGlossaryRequest", + (_message.Message,), + dict( + DESCRIPTOR=_GETGLOSSARYREQUEST, + __module__="google.cloud.translation_v3.proto.translation_service_pb2", + __doc__="""Request message for GetGlossary. + + + Attributes: + name: + Required. The name of the glossary to retrieve. + """, + # @@protoc_insertion_point(class_scope:google.cloud.translation.v3.GetGlossaryRequest) + ), +) +_sym_db.RegisterMessage(GetGlossaryRequest) + +DeleteGlossaryRequest = _reflection.GeneratedProtocolMessageType( + "DeleteGlossaryRequest", + (_message.Message,), + dict( + DESCRIPTOR=_DELETEGLOSSARYREQUEST, + __module__="google.cloud.translation_v3.proto.translation_service_pb2", + __doc__="""Request message for DeleteGlossary. + + + Attributes: + name: + Required. The name of the glossary to delete. + """, + # @@protoc_insertion_point(class_scope:google.cloud.translation.v3.DeleteGlossaryRequest) + ), +) +_sym_db.RegisterMessage(DeleteGlossaryRequest) + +ListGlossariesRequest = _reflection.GeneratedProtocolMessageType( + "ListGlossariesRequest", + (_message.Message,), + dict( + DESCRIPTOR=_LISTGLOSSARIESREQUEST, + __module__="google.cloud.translation_v3.proto.translation_service_pb2", + __doc__="""Request message for ListGlossaries. + + + Attributes: + parent: + Required. The name of the project from which to list all of + the glossaries. + page_size: + Optional. Requested page size. The server may return fewer + glossaries than requested. If unspecified, the server picks an + appropriate default. + page_token: + Optional. A token identifying a page of results the server + should return. Typically, this is the value of + [ListGlossariesResponse.next\_page\_token] returned from the + previous call to ``ListGlossaries`` method. The first page is + returned if ``page_token``\ is empty or missing. + filter: + Optional. Filter specifying constraints of a list operation. + Filtering is not supported yet, and the parameter currently + has no effect. If missing, no filtering is performed. + """, + # @@protoc_insertion_point(class_scope:google.cloud.translation.v3.ListGlossariesRequest) + ), +) +_sym_db.RegisterMessage(ListGlossariesRequest) + +ListGlossariesResponse = _reflection.GeneratedProtocolMessageType( + "ListGlossariesResponse", + (_message.Message,), + dict( + DESCRIPTOR=_LISTGLOSSARIESRESPONSE, + __module__="google.cloud.translation_v3.proto.translation_service_pb2", + __doc__="""Response message for ListGlossaries. + + + Attributes: + glossaries: + The list of glossaries for a project. + next_page_token: + A token to retrieve a page of results. Pass this value in the + [ListGlossariesRequest.page\_token] field in the subsequent + call to ``ListGlossaries`` method to retrieve the next page of + results. + """, + # @@protoc_insertion_point(class_scope:google.cloud.translation.v3.ListGlossariesResponse) + ), +) +_sym_db.RegisterMessage(ListGlossariesResponse) + +CreateGlossaryMetadata = _reflection.GeneratedProtocolMessageType( + "CreateGlossaryMetadata", + (_message.Message,), + dict( + DESCRIPTOR=_CREATEGLOSSARYMETADATA, + __module__="google.cloud.translation_v3.proto.translation_service_pb2", + __doc__="""Stored in the + [google.longrunning.Operation.metadata][google.longrunning.Operation.metadata] + field returned by CreateGlossary. + + + Attributes: + name: + The name of the glossary that is being created. + state: + The current state of the glossary creation operation. + submit_time: + The time when the operation was submitted to the server. + """, + # @@protoc_insertion_point(class_scope:google.cloud.translation.v3.CreateGlossaryMetadata) + ), +) +_sym_db.RegisterMessage(CreateGlossaryMetadata) + +DeleteGlossaryMetadata = _reflection.GeneratedProtocolMessageType( + "DeleteGlossaryMetadata", + (_message.Message,), + dict( + DESCRIPTOR=_DELETEGLOSSARYMETADATA, + __module__="google.cloud.translation_v3.proto.translation_service_pb2", + __doc__="""Stored in the + [google.longrunning.Operation.metadata][google.longrunning.Operation.metadata] + field returned by DeleteGlossary. + + + Attributes: + name: + The name of the glossary that is being deleted. + state: + The current state of the glossary deletion operation. + submit_time: + The time when the operation was submitted to the server. + """, + # @@protoc_insertion_point(class_scope:google.cloud.translation.v3.DeleteGlossaryMetadata) + ), +) +_sym_db.RegisterMessage(DeleteGlossaryMetadata) + +DeleteGlossaryResponse = _reflection.GeneratedProtocolMessageType( + "DeleteGlossaryResponse", + (_message.Message,), + dict( + DESCRIPTOR=_DELETEGLOSSARYRESPONSE, + __module__="google.cloud.translation_v3.proto.translation_service_pb2", + __doc__="""Stored in the + [google.longrunning.Operation.response][google.longrunning.Operation.response] + field returned by DeleteGlossary. + + + Attributes: + name: + The name of the deleted glossary. + submit_time: + The time when the operation was submitted to the server. + end_time: + The time when the glossary deletion is finished and [google.lo + ngrunning.Operation.done][google.longrunning.Operation.done] + is set to true. + """, + # @@protoc_insertion_point(class_scope:google.cloud.translation.v3.DeleteGlossaryResponse) + ), +) +_sym_db.RegisterMessage(DeleteGlossaryResponse) + + +DESCRIPTOR._options = None +_TRANSLATETEXTGLOSSARYCONFIG.fields_by_name["glossary"]._options = None +_TRANSLATETEXTGLOSSARYCONFIG.fields_by_name["ignore_case"]._options = None +_TRANSLATETEXTREQUEST_LABELSENTRY._options = None +_TRANSLATETEXTREQUEST.fields_by_name["contents"]._options = None +_TRANSLATETEXTREQUEST.fields_by_name["mime_type"]._options = None +_TRANSLATETEXTREQUEST.fields_by_name["source_language_code"]._options = None +_TRANSLATETEXTREQUEST.fields_by_name["target_language_code"]._options = None +_TRANSLATETEXTREQUEST.fields_by_name["parent"]._options = None +_TRANSLATETEXTREQUEST.fields_by_name["model"]._options = None +_TRANSLATETEXTREQUEST.fields_by_name["glossary_config"]._options = None +_TRANSLATETEXTREQUEST.fields_by_name["labels"]._options = None +_DETECTLANGUAGEREQUEST_LABELSENTRY._options = None +_DETECTLANGUAGEREQUEST.fields_by_name["parent"]._options = None +_DETECTLANGUAGEREQUEST.fields_by_name["model"]._options = None +_DETECTLANGUAGEREQUEST.fields_by_name["mime_type"]._options = None +_DETECTLANGUAGEREQUEST.fields_by_name["labels"]._options = None +_GETSUPPORTEDLANGUAGESREQUEST.fields_by_name["parent"]._options = None +_GETSUPPORTEDLANGUAGESREQUEST.fields_by_name["display_language_code"]._options = None +_GETSUPPORTEDLANGUAGESREQUEST.fields_by_name["model"]._options = None +_INPUTCONFIG.fields_by_name["mime_type"]._options = None +_BATCHTRANSLATETEXTREQUEST_MODELSENTRY._options = None +_BATCHTRANSLATETEXTREQUEST_GLOSSARIESENTRY._options = None +_BATCHTRANSLATETEXTREQUEST_LABELSENTRY._options = None +_BATCHTRANSLATETEXTREQUEST.fields_by_name["parent"]._options = None +_BATCHTRANSLATETEXTREQUEST.fields_by_name["source_language_code"]._options = None +_BATCHTRANSLATETEXTREQUEST.fields_by_name["target_language_codes"]._options = None +_BATCHTRANSLATETEXTREQUEST.fields_by_name["models"]._options = None +_BATCHTRANSLATETEXTREQUEST.fields_by_name["input_configs"]._options = None +_BATCHTRANSLATETEXTREQUEST.fields_by_name["output_config"]._options = None +_BATCHTRANSLATETEXTREQUEST.fields_by_name["glossaries"]._options = None +_BATCHTRANSLATETEXTREQUEST.fields_by_name["labels"]._options = None +_GLOSSARY.fields_by_name["entry_count"]._options = None +_GLOSSARY.fields_by_name["submit_time"]._options = None +_GLOSSARY.fields_by_name["end_time"]._options = None +_GLOSSARY._options = None +_CREATEGLOSSARYREQUEST.fields_by_name["parent"]._options = None +_CREATEGLOSSARYREQUEST.fields_by_name["glossary"]._options = None +_GETGLOSSARYREQUEST.fields_by_name["name"]._options = None +_DELETEGLOSSARYREQUEST.fields_by_name["name"]._options = None +_LISTGLOSSARIESREQUEST.fields_by_name["parent"]._options = None +_LISTGLOSSARIESREQUEST.fields_by_name["page_size"]._options = None +_LISTGLOSSARIESREQUEST.fields_by_name["page_token"]._options = None +_LISTGLOSSARIESREQUEST.fields_by_name["filter"]._options = None + +_TRANSLATIONSERVICE = _descriptor.ServiceDescriptor( + name="TranslationService", + full_name="google.cloud.translation.v3.TranslationService", + file=DESCRIPTOR, + index=0, + serialized_options=_b( + "\312A\030translate.googleapis.com\322A`https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/cloud-translation" + ), + serialized_start=5516, + serialized_end=7578, + methods=[ + _descriptor.MethodDescriptor( + name="TranslateText", + full_name="google.cloud.translation.v3.TranslationService.TranslateText", + index=0, + containing_service=None, + input_type=_TRANSLATETEXTREQUEST, + output_type=_TRANSLATETEXTRESPONSE, + serialized_options=_b( + '\202\323\344\223\002b"1/v3/{parent=projects/*/locations/*}:translateText:\001*Z*"%/v3/{parent=projects/*}:translateText:\001*\332A$parent,target_language_code,contents\332AIparent,model,mime_type,source_language_code,target_language_code,contents' + ), + ), + _descriptor.MethodDescriptor( + name="DetectLanguage", + full_name="google.cloud.translation.v3.TranslationService.DetectLanguage", + index=1, + containing_service=None, + input_type=_DETECTLANGUAGEREQUEST, + output_type=_DETECTLANGUAGERESPONSE, + serialized_options=_b( + '\202\323\344\223\002d"2/v3/{parent=projects/*/locations/*}:detectLanguage:\001*Z+"&/v3/{parent=projects/*}:detectLanguage:\001*\332A\036parent,model,mime_type,content' + ), + ), + _descriptor.MethodDescriptor( + name="GetSupportedLanguages", + full_name="google.cloud.translation.v3.TranslationService.GetSupportedLanguages", + index=2, + containing_service=None, + input_type=_GETSUPPORTEDLANGUAGESREQUEST, + output_type=_SUPPORTEDLANGUAGES, + serialized_options=_b( + '\202\323\344\223\002f\0226/v3/{parent=projects/*/locations/*}/supportedLanguagesZ,\022*/v3/{parent=projects/*}/supportedLanguages\332A"parent,model,display_language_code' + ), + ), + _descriptor.MethodDescriptor( + name="BatchTranslateText", + full_name="google.cloud.translation.v3.TranslationService.BatchTranslateText", + index=3, + containing_service=None, + input_type=_BATCHTRANSLATETEXTREQUEST, + output_type=google_dot_longrunning_dot_operations__pb2._OPERATION, + serialized_options=_b( + '\202\323\344\223\002;"6/v3/{parent=projects/*/locations/*}:batchTranslateText:\001*\312A0\n\026BatchTranslateResponse\022\026BatchTranslateMetadata' + ), + ), + _descriptor.MethodDescriptor( + name="CreateGlossary", + full_name="google.cloud.translation.v3.TranslationService.CreateGlossary", + index=4, + containing_service=None, + input_type=_CREATEGLOSSARYREQUEST, + output_type=google_dot_longrunning_dot_operations__pb2._OPERATION, + serialized_options=_b( + '\202\323\344\223\002:"./v3/{parent=projects/*/locations/*}/glossaries:\010glossary\332A\017parent,glossary\312A"\n\010Glossary\022\026CreateGlossaryMetadata' + ), + ), + _descriptor.MethodDescriptor( + name="ListGlossaries", + full_name="google.cloud.translation.v3.TranslationService.ListGlossaries", + index=5, + containing_service=None, + input_type=_LISTGLOSSARIESREQUEST, + output_type=_LISTGLOSSARIESRESPONSE, + serialized_options=_b( + "\202\323\344\223\0020\022./v3/{parent=projects/*/locations/*}/glossaries\332A\006parent" + ), + ), + _descriptor.MethodDescriptor( + name="GetGlossary", + full_name="google.cloud.translation.v3.TranslationService.GetGlossary", + index=6, + containing_service=None, + input_type=_GETGLOSSARYREQUEST, + output_type=_GLOSSARY, + serialized_options=_b( + "\202\323\344\223\0020\022./v3/{name=projects/*/locations/*/glossaries/*}\332A\004name" + ), + ), + _descriptor.MethodDescriptor( + name="DeleteGlossary", + full_name="google.cloud.translation.v3.TranslationService.DeleteGlossary", + index=7, + containing_service=None, + input_type=_DELETEGLOSSARYREQUEST, + output_type=google_dot_longrunning_dot_operations__pb2._OPERATION, + serialized_options=_b( + "\202\323\344\223\0020*./v3/{name=projects/*/locations/*/glossaries/*}\332A\004name\312A0\n\026DeleteGlossaryResponse\022\026DeleteGlossaryMetadata" + ), + ), + ], +) +_sym_db.RegisterServiceDescriptor(_TRANSLATIONSERVICE) + +DESCRIPTOR.services_by_name["TranslationService"] = _TRANSLATIONSERVICE + +# @@protoc_insertion_point(module_scope) diff --git a/google/cloud/translate_v3/proto/translation_service_pb2_grpc.py b/google/cloud/translate_v3/proto/translation_service_pb2_grpc.py new file mode 100644 index 00000000..5f7f9813 --- /dev/null +++ b/google/cloud/translate_v3/proto/translation_service_pb2_grpc.py @@ -0,0 +1,186 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +import grpc + +from google.cloud.translate_v3.proto import ( + translation_service_pb2 as google_dot_cloud_dot_translation__v3_dot_proto_dot_translation__service__pb2, +) +from google.longrunning import ( + operations_pb2 as google_dot_longrunning_dot_operations__pb2, +) + + +class TranslationServiceStub(object): + """Proto file for the Cloud Translation API (v3 GA). + + Provides natural language translation operations. + """ + + def __init__(self, channel): + """Constructor. + + Args: + channel: A grpc.Channel. + """ + self.TranslateText = channel.unary_unary( + "/google.cloud.translation.v3.TranslationService/TranslateText", + request_serializer=google_dot_cloud_dot_translation__v3_dot_proto_dot_translation__service__pb2.TranslateTextRequest.SerializeToString, + response_deserializer=google_dot_cloud_dot_translation__v3_dot_proto_dot_translation__service__pb2.TranslateTextResponse.FromString, + ) + self.DetectLanguage = channel.unary_unary( + "/google.cloud.translation.v3.TranslationService/DetectLanguage", + request_serializer=google_dot_cloud_dot_translation__v3_dot_proto_dot_translation__service__pb2.DetectLanguageRequest.SerializeToString, + response_deserializer=google_dot_cloud_dot_translation__v3_dot_proto_dot_translation__service__pb2.DetectLanguageResponse.FromString, + ) + self.GetSupportedLanguages = channel.unary_unary( + "/google.cloud.translation.v3.TranslationService/GetSupportedLanguages", + request_serializer=google_dot_cloud_dot_translation__v3_dot_proto_dot_translation__service__pb2.GetSupportedLanguagesRequest.SerializeToString, + response_deserializer=google_dot_cloud_dot_translation__v3_dot_proto_dot_translation__service__pb2.SupportedLanguages.FromString, + ) + self.BatchTranslateText = channel.unary_unary( + "/google.cloud.translation.v3.TranslationService/BatchTranslateText", + request_serializer=google_dot_cloud_dot_translation__v3_dot_proto_dot_translation__service__pb2.BatchTranslateTextRequest.SerializeToString, + response_deserializer=google_dot_longrunning_dot_operations__pb2.Operation.FromString, + ) + self.CreateGlossary = channel.unary_unary( + "/google.cloud.translation.v3.TranslationService/CreateGlossary", + request_serializer=google_dot_cloud_dot_translation__v3_dot_proto_dot_translation__service__pb2.CreateGlossaryRequest.SerializeToString, + response_deserializer=google_dot_longrunning_dot_operations__pb2.Operation.FromString, + ) + self.ListGlossaries = channel.unary_unary( + "/google.cloud.translation.v3.TranslationService/ListGlossaries", + request_serializer=google_dot_cloud_dot_translation__v3_dot_proto_dot_translation__service__pb2.ListGlossariesRequest.SerializeToString, + response_deserializer=google_dot_cloud_dot_translation__v3_dot_proto_dot_translation__service__pb2.ListGlossariesResponse.FromString, + ) + self.GetGlossary = channel.unary_unary( + "/google.cloud.translation.v3.TranslationService/GetGlossary", + request_serializer=google_dot_cloud_dot_translation__v3_dot_proto_dot_translation__service__pb2.GetGlossaryRequest.SerializeToString, + response_deserializer=google_dot_cloud_dot_translation__v3_dot_proto_dot_translation__service__pb2.Glossary.FromString, + ) + self.DeleteGlossary = channel.unary_unary( + "/google.cloud.translation.v3.TranslationService/DeleteGlossary", + request_serializer=google_dot_cloud_dot_translation__v3_dot_proto_dot_translation__service__pb2.DeleteGlossaryRequest.SerializeToString, + response_deserializer=google_dot_longrunning_dot_operations__pb2.Operation.FromString, + ) + + +class TranslationServiceServicer(object): + """Proto file for the Cloud Translation API (v3 GA). + + Provides natural language translation operations. + """ + + def TranslateText(self, request, context): + """Translates input text and returns translated text. + """ + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details("Method not implemented!") + raise NotImplementedError("Method not implemented!") + + def DetectLanguage(self, request, context): + """Detects the language of text within a request. + """ + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details("Method not implemented!") + raise NotImplementedError("Method not implemented!") + + def GetSupportedLanguages(self, request, context): + """Returns a list of supported languages for translation. + """ + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details("Method not implemented!") + raise NotImplementedError("Method not implemented!") + + def BatchTranslateText(self, request, context): + """Translates a large volume of text in asynchronous batch mode. + This function provides real-time output as the inputs are being processed. + If caller cancels a request, the partial results (for an input file, it's + all or nothing) may still be available on the specified output location. + + This call returns immediately and you can + use google.longrunning.Operation.name to poll the status of the call. + """ + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details("Method not implemented!") + raise NotImplementedError("Method not implemented!") + + def CreateGlossary(self, request, context): + """Creates a glossary and returns the long-running operation. Returns + NOT_FOUND, if the project doesn't exist. + """ + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details("Method not implemented!") + raise NotImplementedError("Method not implemented!") + + def ListGlossaries(self, request, context): + """Lists glossaries in a project. Returns NOT_FOUND, if the project doesn't + exist. + """ + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details("Method not implemented!") + raise NotImplementedError("Method not implemented!") + + def GetGlossary(self, request, context): + """Gets a glossary. Returns NOT_FOUND, if the glossary doesn't + exist. + """ + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details("Method not implemented!") + raise NotImplementedError("Method not implemented!") + + def DeleteGlossary(self, request, context): + """Deletes a glossary, or cancels glossary construction + if the glossary isn't created yet. + Returns NOT_FOUND, if the glossary doesn't exist. + """ + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details("Method not implemented!") + raise NotImplementedError("Method not implemented!") + + +def add_TranslationServiceServicer_to_server(servicer, server): + rpc_method_handlers = { + "TranslateText": grpc.unary_unary_rpc_method_handler( + servicer.TranslateText, + request_deserializer=google_dot_cloud_dot_translation__v3_dot_proto_dot_translation__service__pb2.TranslateTextRequest.FromString, + response_serializer=google_dot_cloud_dot_translation__v3_dot_proto_dot_translation__service__pb2.TranslateTextResponse.SerializeToString, + ), + "DetectLanguage": grpc.unary_unary_rpc_method_handler( + servicer.DetectLanguage, + request_deserializer=google_dot_cloud_dot_translation__v3_dot_proto_dot_translation__service__pb2.DetectLanguageRequest.FromString, + response_serializer=google_dot_cloud_dot_translation__v3_dot_proto_dot_translation__service__pb2.DetectLanguageResponse.SerializeToString, + ), + "GetSupportedLanguages": grpc.unary_unary_rpc_method_handler( + servicer.GetSupportedLanguages, + request_deserializer=google_dot_cloud_dot_translation__v3_dot_proto_dot_translation__service__pb2.GetSupportedLanguagesRequest.FromString, + response_serializer=google_dot_cloud_dot_translation__v3_dot_proto_dot_translation__service__pb2.SupportedLanguages.SerializeToString, + ), + "BatchTranslateText": grpc.unary_unary_rpc_method_handler( + servicer.BatchTranslateText, + request_deserializer=google_dot_cloud_dot_translation__v3_dot_proto_dot_translation__service__pb2.BatchTranslateTextRequest.FromString, + response_serializer=google_dot_longrunning_dot_operations__pb2.Operation.SerializeToString, + ), + "CreateGlossary": grpc.unary_unary_rpc_method_handler( + servicer.CreateGlossary, + request_deserializer=google_dot_cloud_dot_translation__v3_dot_proto_dot_translation__service__pb2.CreateGlossaryRequest.FromString, + response_serializer=google_dot_longrunning_dot_operations__pb2.Operation.SerializeToString, + ), + "ListGlossaries": grpc.unary_unary_rpc_method_handler( + servicer.ListGlossaries, + request_deserializer=google_dot_cloud_dot_translation__v3_dot_proto_dot_translation__service__pb2.ListGlossariesRequest.FromString, + response_serializer=google_dot_cloud_dot_translation__v3_dot_proto_dot_translation__service__pb2.ListGlossariesResponse.SerializeToString, + ), + "GetGlossary": grpc.unary_unary_rpc_method_handler( + servicer.GetGlossary, + request_deserializer=google_dot_cloud_dot_translation__v3_dot_proto_dot_translation__service__pb2.GetGlossaryRequest.FromString, + response_serializer=google_dot_cloud_dot_translation__v3_dot_proto_dot_translation__service__pb2.Glossary.SerializeToString, + ), + "DeleteGlossary": grpc.unary_unary_rpc_method_handler( + servicer.DeleteGlossary, + request_deserializer=google_dot_cloud_dot_translation__v3_dot_proto_dot_translation__service__pb2.DeleteGlossaryRequest.FromString, + response_serializer=google_dot_longrunning_dot_operations__pb2.Operation.SerializeToString, + ), + } + generic_handler = grpc.method_handlers_generic_handler( + "google.cloud.translation.v3.TranslationService", rpc_method_handlers + ) + server.add_generic_rpc_handlers((generic_handler,)) diff --git a/google/cloud/translate_v3/types.py b/google/cloud/translate_v3/types.py new file mode 100644 index 00000000..14c494ad --- /dev/null +++ b/google/cloud/translate_v3/types.py @@ -0,0 +1,47 @@ +# -*- coding: utf-8 -*- +# +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +from __future__ import absolute_import +import sys + +from google.api_core.protobuf_helpers import get_messages + +from google.cloud.translate_v3.proto import translation_service_pb2 +from google.longrunning import operations_pb2 +from google.protobuf import any_pb2 +from google.protobuf import timestamp_pb2 +from google.rpc import status_pb2 + + +_shared_modules = [operations_pb2, any_pb2, timestamp_pb2, status_pb2] + +_local_modules = [translation_service_pb2] + +names = [] + +for module in _shared_modules: # pragma: NO COVER + for name, message in get_messages(module).items(): + setattr(sys.modules[__name__], name, message) + names.append(name) +for module in _local_modules: + for name, message in get_messages(module).items(): + message.__module__ = "google.cloud.translate_v3.types" + setattr(sys.modules[__name__], name, message) + names.append(name) + + +__all__ = tuple(sorted(names)) diff --git a/google/cloud/translate_v3beta1/gapic/translation_service_client.py b/google/cloud/translate_v3beta1/gapic/translation_service_client.py index 54848598..c62bacfd 100644 --- a/google/cloud/translate_v3beta1/gapic/translation_service_client.py +++ b/google/cloud/translate_v3beta1/gapic/translation_service_client.py @@ -214,11 +214,12 @@ def translate_text( self, contents, target_language_code, + parent, mime_type=None, source_language_code=None, - parent=None, model=None, glossary_config=None, + labels=None, retry=google.api_core.gapic_v1.method.DEFAULT, timeout=google.api_core.gapic_v1.method.DEFAULT, metadata=None, @@ -236,8 +237,9 @@ def translate_text( >>> >>> # TODO: Initialize `target_language_code`: >>> target_language_code = '' + >>> parent = client.location_path('[PROJECT]', '[LOCATION]') >>> - >>> response = client.translate_text(contents, target_language_code) + >>> response = client.translate_text(contents, target_language_code, parent) Args: contents (list[str]): Required. The content of the input in string format. @@ -245,6 +247,20 @@ def translate_text( Use BatchTranslateText for larger text. target_language_code (str): Required. The BCP-47 language code to use for translation of the input text, set to one of the language codes listed in Language Support. + parent (str): Required. Project or location to make a call. Must refer to a caller's + project. + + Format: ``projects/{project-id}`` or + ``projects/{project-id}/locations/{location-id}``. + + For global calls, use ``projects/{project-id}/locations/global`` or + ``projects/{project-id}``. + + Non-global location is required for requests using AutoML models or + custom glossaries. + + Models and glossaries must be within the same region (have same + location-id), otherwise an INVALID\_ARGUMENT (400) error is returned. mime_type (str): Optional. The format of the source text, for example, "text/html", "text/plain". If left blank, the MIME type defaults to "text/html". source_language_code (str): Optional. The BCP-47 language code of the input text if @@ -252,14 +268,6 @@ def translate_text( listed in Language Support. If the source language isn't specified, the API attempts to identify the source language automatically and returns the source language within the response. - parent (str): Required. Location to make a regional or global call. - - Format: ``projects/{project-id}/locations/{location-id}``. - - For global calls, use ``projects/{project-id}/locations/global``. - - Models and glossaries must be within the same region (have same - location-id), otherwise an INVALID\_ARGUMENT (400) error is returned. model (str): Optional. The ``model`` type requested for this translation. The format depends on model type: @@ -282,9 +290,17 @@ def translate_text( If a dict is provided, it must be of the same form as the protobuf message :class:`~google.cloud.translate_v3beta1.types.TranslateTextGlossaryConfig` + labels (dict[str -> str]): Optional. The labels with user-defined metadata for the request. + + Label keys and values can be no longer than 63 characters + (Unicode codepoints), can only contain lowercase letters, numeric + characters, underscores and dashes. International characters are allowed. + Label values are optional. Label keys must start with a letter. + + See https://cloud.google.com/translate/docs/labels for more information. retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will not - be retried. + to retry requests. If ``None`` is specified, requests will + be retried using a default configuration. timeout (Optional[float]): The amount of time, in seconds, to wait for the request to complete. Note that if ``retry`` is specified, the timeout applies to each individual attempt. @@ -315,11 +331,12 @@ def translate_text( request = translation_service_pb2.TranslateTextRequest( contents=contents, target_language_code=target_language_code, + parent=parent, mime_type=mime_type, source_language_code=source_language_code, - parent=parent, model=model, glossary_config=glossary_config, + labels=labels, ) if metadata is None: metadata = [] @@ -340,10 +357,11 @@ def translate_text( def detect_language( self, - parent=None, + parent, model=None, content=None, mime_type=None, + labels=None, retry=google.api_core.gapic_v1.method.DEFAULT, timeout=google.api_core.gapic_v1.method.DEFAULT, metadata=None, @@ -356,14 +374,19 @@ def detect_language( >>> >>> client = translate_v3beta1.TranslationServiceClient() >>> - >>> response = client.detect_language() + >>> parent = client.location_path('[PROJECT]', '[LOCATION]') + >>> + >>> response = client.detect_language(parent) Args: - parent (str): Required. Location to make a regional or global call. + parent (str): Required. Project or location to make a call. Must refer to a caller's + project. - Format: ``projects/{project-id}/locations/{location-id}``. + Format: ``projects/{project-id}/locations/{location-id}`` or + ``projects/{project-id}``. - For global calls, use ``projects/{project-id}/locations/global``. + For global calls, use ``projects/{project-id}/locations/global`` or + ``projects/{project-id}``. Only models within the same region (has same location-id) can be used. Otherwise an INVALID\_ARGUMENT (400) error is returned. @@ -379,9 +402,17 @@ def detect_language( content (str): The content of the input stored as a string. mime_type (str): Optional. The format of the source text, for example, "text/html", "text/plain". If left blank, the MIME type defaults to "text/html". + labels (dict[str -> str]): Optional. The labels with user-defined metadata for the request. + + Label keys and values can be no longer than 63 characters + (Unicode codepoints), can only contain lowercase letters, numeric + characters, underscores and dashes. International characters are allowed. + Label values are optional. Label keys must start with a letter. + + See https://cloud.google.com/translate/docs/labels for more information. retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will not - be retried. + to retry requests. If ``None`` is specified, requests will + be retried using a default configuration. timeout (Optional[float]): The amount of time, in seconds, to wait for the request to complete. Note that if ``retry`` is specified, the timeout applies to each individual attempt. @@ -414,7 +445,11 @@ def detect_language( google.api_core.protobuf_helpers.check_oneof(content=content) request = translation_service_pb2.DetectLanguageRequest( - parent=parent, model=model, content=content, mime_type=mime_type + parent=parent, + model=model, + content=content, + mime_type=mime_type, + labels=labels, ) if metadata is None: metadata = [] @@ -435,7 +470,7 @@ def detect_language( def get_supported_languages( self, - parent=None, + parent, display_language_code=None, model=None, retry=google.api_core.gapic_v1.method.DEFAULT, @@ -450,14 +485,21 @@ def get_supported_languages( >>> >>> client = translate_v3beta1.TranslationServiceClient() >>> - >>> response = client.get_supported_languages() + >>> parent = client.location_path('[PROJECT]', '[LOCATION]') + >>> + >>> response = client.get_supported_languages(parent) Args: - parent (str): Required. Location to make a regional or global call. + parent (str): Required. Project or location to make a call. Must refer to a caller's + project. - Format: ``projects/{project-id}/locations/{location-id}``. + Format: ``projects/{project-id}`` or + ``projects/{project-id}/locations/{location-id}``. - For global calls, use ``projects/{project-id}/locations/global``. + For global calls, use ``projects/{project-id}/locations/global`` or + ``projects/{project-id}``. + + Non-global location is required for AutoML models. Only models within the same region (have same location-id) can be used, otherwise an INVALID\_ARGUMENT (400) error is returned. @@ -478,8 +520,8 @@ def get_supported_languages( Returns languages supported by the specified model. If missing, we get supported languages of Google general base (PBMT) model. retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will not - be retried. + to retry requests. If ``None`` is specified, requests will + be retried using a default configuration. timeout (Optional[float]): The amount of time, in seconds, to wait for the request to complete. Note that if ``retry`` is specified, the timeout applies to each individual attempt. @@ -529,13 +571,14 @@ def get_supported_languages( def batch_translate_text( self, + parent, source_language_code, target_language_codes, input_configs, output_config, - parent=None, models=None, glossaries=None, + labels=None, retry=google.api_core.gapic_v1.method.DEFAULT, timeout=google.api_core.gapic_v1.method.DEFAULT, metadata=None, @@ -554,6 +597,8 @@ def batch_translate_text( >>> >>> client = translate_v3beta1.TranslationServiceClient() >>> + >>> parent = client.location_path('[PROJECT]', '[LOCATION]') + >>> >>> # TODO: Initialize `source_language_code`: >>> source_language_code = '' >>> @@ -566,7 +611,7 @@ def batch_translate_text( >>> # TODO: Initialize `output_config`: >>> output_config = {} >>> - >>> response = client.batch_translate_text(source_language_code, target_language_codes, input_configs, output_config) + >>> response = client.batch_translate_text(parent, source_language_code, target_language_codes, input_configs, output_config) >>> >>> def callback(operation_future): ... # Handle result. @@ -578,6 +623,15 @@ def batch_translate_text( >>> metadata = response.metadata() Args: + parent (str): Required. Location to make a call. Must refer to a caller's project. + + Format: ``projects/{project-id}/locations/{location-id}``. + + The ``global`` location is not supported for batch translation. + + Only AutoML Translation models or glossaries within the same region + (have the same location-id) can be used, otherwise an INVALID\_ARGUMENT + (400) error is returned. source_language_code (str): Required. Source language code. target_language_codes (list[str]): Required. Specify up to 10 language codes here. input_configs (list[Union[dict, ~google.cloud.translate_v3beta1.types.InputConfig]]): Required. Input configurations. @@ -593,15 +647,6 @@ def batch_translate_text( If a dict is provided, it must be of the same form as the protobuf message :class:`~google.cloud.translate_v3beta1.types.OutputConfig` - parent (str): Required. Location to make a regional call. - - Format: ``projects/{project-id}/locations/{location-id}``. - - The ``global`` location is not supported for batch translation. - - Only AutoML Translation models or glossaries within the same region - (have the same location-id) can be used, otherwise an INVALID\_ARGUMENT - (400) error is returned. models (dict[str -> str]): Optional. The models to use for translation. Map's key is target language code. Map's value is model name. Value can be a built-in general model, or an AutoML Translation model. @@ -622,9 +667,17 @@ def batch_translate_text( If a dict is provided, it must be of the same form as the protobuf message :class:`~google.cloud.translate_v3beta1.types.TranslateTextGlossaryConfig` + labels (dict[str -> str]): Optional. The labels with user-defined metadata for the request. + + Label keys and values can be no longer than 63 characters + (Unicode codepoints), can only contain lowercase letters, numeric + characters, underscores and dashes. International characters are allowed. + Label values are optional. Label keys must start with a letter. + + See https://cloud.google.com/translate/docs/labels for more information. retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will not - be retried. + to retry requests. If ``None`` is specified, requests will + be retried using a default configuration. timeout (Optional[float]): The amount of time, in seconds, to wait for the request to complete. Note that if ``retry`` is specified, the timeout applies to each individual attempt. @@ -653,13 +706,14 @@ def batch_translate_text( ) request = translation_service_pb2.BatchTranslateTextRequest( + parent=parent, source_language_code=source_language_code, target_language_codes=target_language_codes, input_configs=input_configs, output_config=output_config, - parent=parent, models=models, glossaries=glossaries, + labels=labels, ) if metadata is None: metadata = [] @@ -724,8 +778,8 @@ def create_glossary( If a dict is provided, it must be of the same form as the protobuf message :class:`~google.cloud.translate_v3beta1.types.Glossary` retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will not - be retried. + to retry requests. If ``None`` is specified, requests will + be retried using a default configuration. timeout (Optional[float]): The amount of time, in seconds, to wait for the request to complete. Note that if ``retry`` is specified, the timeout applies to each individual attempt. @@ -781,7 +835,7 @@ def create_glossary( def list_glossaries( self, - parent=None, + parent, page_size=None, filter_=None, retry=google.api_core.gapic_v1.method.DEFAULT, @@ -797,8 +851,10 @@ def list_glossaries( >>> >>> client = translate_v3beta1.TranslationServiceClient() >>> + >>> parent = client.location_path('[PROJECT]', '[LOCATION]') + >>> >>> # Iterate over all results - >>> for element in client.list_glossaries(): + >>> for element in client.list_glossaries(parent): ... # process element ... pass >>> @@ -806,7 +862,7 @@ def list_glossaries( >>> # Alternatively: >>> >>> # Iterate over results one page at a time - >>> for page in client.list_glossaries().pages: + >>> for page in client.list_glossaries(parent).pages: ... for element in page: ... # process element ... pass @@ -822,8 +878,8 @@ def list_glossaries( Filtering is not supported yet, and the parameter currently has no effect. If missing, no filtering is performed. retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will not - be retried. + to retry requests. If ``None`` is specified, requests will + be retried using a default configuration. timeout (Optional[float]): The amount of time, in seconds, to wait for the request to complete. Note that if ``retry`` is specified, the timeout applies to each individual attempt. @@ -907,8 +963,8 @@ def get_glossary( Args: name (str): Required. The name of the glossary to retrieve. retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will not - be retried. + to retry requests. If ``None`` is specified, requests will + be retried using a default configuration. timeout (Optional[float]): The amount of time, in seconds, to wait for the request to complete. Note that if ``retry`` is specified, the timeout applies to each individual attempt. @@ -986,8 +1042,8 @@ def delete_glossary( Args: name (str): Required. The name of the glossary to delete. retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will not - be retried. + to retry requests. If ``None`` is specified, requests will + be retried using a default configuration. timeout (Optional[float]): The amount of time, in seconds, to wait for the request to complete. Note that if ``retry`` is specified, the timeout applies to each individual attempt. diff --git a/google/cloud/translate_v3beta1/gapic/translation_service_client_config.py b/google/cloud/translate_v3beta1/gapic/translation_service_client_config.py index 21b78721..af45b10d 100644 --- a/google/cloud/translate_v3beta1/gapic/translation_service_client_config.py +++ b/google/cloud/translate_v3beta1/gapic/translation_service_client_config.py @@ -54,7 +54,7 @@ }, "DeleteGlossary": { "timeout_millis": 60000, - "retry_codes_name": "idempotent", + "retry_codes_name": "non_idempotent", "retry_params_name": "default", }, }, diff --git a/google/cloud/translate_v3beta1/gapic/transports/translation_service_grpc_transport.py b/google/cloud/translate_v3beta1/gapic/transports/translation_service_grpc_transport.py index 21a335b2..46f9c525 100644 --- a/google/cloud/translate_v3beta1/gapic/transports/translation_service_grpc_transport.py +++ b/google/cloud/translate_v3beta1/gapic/transports/translation_service_grpc_transport.py @@ -62,7 +62,14 @@ def __init__( # Create the channel. if channel is None: - channel = self.create_channel(address=address, credentials=credentials) + channel = self.create_channel( + address=address, + credentials=credentials, + options={ + "grpc.max_send_message_length": -1, + "grpc.max_receive_message_length": -1, + }.items(), + ) self._channel = channel diff --git a/google/cloud/translate_v3beta1/proto/translation_service.proto b/google/cloud/translate_v3beta1/proto/translation_service.proto index fa20f016..e62a5088 100644 --- a/google/cloud/translate_v3beta1/proto/translation_service.proto +++ b/google/cloud/translate_v3beta1/proto/translation_service.proto @@ -18,10 +18,11 @@ syntax = "proto3"; package google.cloud.translation.v3beta1; import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; import "google/api/resource.proto"; import "google/longrunning/operations.proto"; import "google/protobuf/timestamp.proto"; -import "google/api/client.proto"; option cc_enable_arenas = true; option csharp_namespace = "Google.Cloud.Translate.V3Beta1"; @@ -36,7 +37,10 @@ option ruby_package = "Google::Cloud::Translate::V3beta1"; // Provides natural language translation operations. service TranslationService { - option (google.api.default_host) = "translation.googleapis.com"; + option (google.api.default_host) = "translate.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/cloud-translation"; // Translates input text and returns translated text. rpc TranslateText(TranslateTextRequest) returns (TranslateTextResponse) { @@ -60,6 +64,7 @@ service TranslationService { body: "*" } }; + option (google.api.method_signature) = "parent,model,mime_type"; } // Returns a list of supported languages for translation. @@ -70,6 +75,7 @@ service TranslationService { get: "/v3beta1/{parent=projects/*}/supportedLanguages" } }; + option (google.api.method_signature) = "parent,display_language_code,model"; } // Translates a large volume of text in asynchronous batch mode. @@ -84,6 +90,10 @@ service TranslationService { post: "/v3beta1/{parent=projects/*/locations/*}:batchTranslateText" body: "*" }; + option (google.longrunning.operation_info) = { + response_type: "BatchTranslateResponse" + metadata_type: "BatchTranslateMetadata" + }; } // Creates a glossary and returns the long-running operation. Returns @@ -93,6 +103,11 @@ service TranslationService { post: "/v3beta1/{parent=projects/*/locations/*}/glossaries" body: "glossary" }; + option (google.api.method_signature) = "parent,glossary"; + option (google.longrunning.operation_info) = { + response_type: "Glossary" + metadata_type: "CreateGlossaryMetadata" + }; } // Lists glossaries in a project. Returns NOT_FOUND, if the project doesn't @@ -101,6 +116,8 @@ service TranslationService { option (google.api.http) = { get: "/v3beta1/{parent=projects/*/locations/*}/glossaries" }; + option (google.api.method_signature) = "parent"; + option (google.api.method_signature) = "parent,filter"; } // Gets a glossary. Returns NOT_FOUND, if the glossary doesn't @@ -109,6 +126,7 @@ service TranslationService { option (google.api.http) = { get: "/v3beta1/{name=projects/*/locations/*/glossaries/*}" }; + option (google.api.method_signature) = "name"; } // Deletes a glossary, or cancels glossary construction @@ -118,6 +136,11 @@ service TranslationService { option (google.api.http) = { delete: "/v3beta1/{name=projects/*/locations/*/glossaries/*}" }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "DeleteGlossaryResponse" + metadata_type: "DeleteGlossaryMetadata" + }; } } @@ -126,11 +149,11 @@ service TranslationService { message TranslateTextGlossaryConfig { // Required. Specifies the glossary used for this translation. Use // this format: projects/*/locations/*/glossaries/* - string glossary = 1; + string glossary = 1 [(google.api.field_behavior) = REQUIRED]; // Optional. Indicates match is case-insensitive. // Default value is false if missing. - bool ignore_case = 2; + bool ignore_case = 2 [(google.api.field_behavior) = OPTIONAL]; } // The request message for synchronous translation. @@ -138,32 +161,43 @@ message TranslateTextRequest { // Required. The content of the input in string format. // We recommend the total content be less than 30k codepoints. // Use BatchTranslateText for larger text. - repeated string contents = 1; + repeated string contents = 1 [(google.api.field_behavior) = REQUIRED]; // Optional. The format of the source text, for example, "text/html", // "text/plain". If left blank, the MIME type defaults to "text/html". - string mime_type = 3; + string mime_type = 3 [(google.api.field_behavior) = OPTIONAL]; // Optional. The BCP-47 language code of the input text if // known, for example, "en-US" or "sr-Latn". Supported language codes are // listed in Language Support. If the source language isn't specified, the API // attempts to identify the source language automatically and returns the // source language within the response. - string source_language_code = 4; + string source_language_code = 4 [(google.api.field_behavior) = OPTIONAL]; // Required. The BCP-47 language code to use for translation of the input // text, set to one of the language codes listed in Language Support. - string target_language_code = 5; + string target_language_code = 5 [(google.api.field_behavior) = REQUIRED]; - // Required. Location to make a regional or global call. + // Required. Project or location to make a call. Must refer to a caller's + // project. // - // Format: `projects/{project-id}/locations/{location-id}`. + // Format: `projects/{project-id}` or + // `projects/{project-id}/locations/{location-id}`. // - // For global calls, use `projects/{project-id}/locations/global`. + // For global calls, use `projects/{project-id}/locations/global` or + // `projects/{project-id}`. + // + // Non-global location is required for requests using AutoML models or + // custom glossaries. // // Models and glossaries must be within the same region (have same // location-id), otherwise an INVALID_ARGUMENT (400) error is returned. - string parent = 8; + string parent = 8 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; // Optional. The `model` type requested for this translation. // @@ -182,12 +216,22 @@ message TranslateTextRequest { // `projects/{project-id}/locations/global/models/general/nmt`. // // If missing, the system decides which google base model to use. - string model = 6; + string model = 6 [(google.api.field_behavior) = OPTIONAL]; // Optional. Glossary to be applied. The glossary must be // within the same region (have the same location-id) as the model, otherwise // an INVALID_ARGUMENT (400) error is returned. - TranslateTextGlossaryConfig glossary_config = 7; + TranslateTextGlossaryConfig glossary_config = 7 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The labels with user-defined metadata for the request. + // + // Label keys and values can be no longer than 63 characters + // (Unicode codepoints), can only contain lowercase letters, numeric + // characters, underscores and dashes. International characters are allowed. + // Label values are optional. Label keys must start with a letter. + // + // See https://cloud.google.com/translate/docs/labels for more information. + map labels = 10 [(google.api.field_behavior) = OPTIONAL]; } message TranslateTextResponse { @@ -225,15 +269,23 @@ message Translation { // The request message for language detection. message DetectLanguageRequest { - // Required. Location to make a regional or global call. + // Required. Project or location to make a call. Must refer to a caller's + // project. // - // Format: `projects/{project-id}/locations/{location-id}`. + // Format: `projects/{project-id}/locations/{location-id}` or + // `projects/{project-id}`. // - // For global calls, use `projects/{project-id}/locations/global`. + // For global calls, use `projects/{project-id}/locations/global` or + // `projects/{project-id}`. // // Only models within the same region (has same location-id) can be used. // Otherwise an INVALID_ARGUMENT (400) error is returned. - string parent = 5; + string parent = 5 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; // Optional. The language detection model to be used. // @@ -244,7 +296,7 @@ message DetectLanguageRequest { // `projects/{project-id}/locations/{location-id}/models/language-detection/default`. // // If not specified, the default model is used. - string model = 4; + string model = 4 [(google.api.field_behavior) = OPTIONAL]; // Required. The source of the document from which to detect the language. oneof source { @@ -254,7 +306,17 @@ message DetectLanguageRequest { // Optional. The format of the source text, for example, "text/html", // "text/plain". If left blank, the MIME type defaults to "text/html". - string mime_type = 3; + string mime_type = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The labels with user-defined metadata for the request. + // + // Label keys and values can be no longer than 63 characters + // (Unicode codepoints), can only contain lowercase letters, numeric + // characters, underscores and dashes. International characters are allowed. + // Label values are optional. Label keys must start with a letter. + // + // See https://cloud.google.com/translate/docs/labels for more information. + map labels = 6; } // The response message for language detection. @@ -276,20 +338,30 @@ message DetectLanguageResponse { // The request message for discovering supported languages. message GetSupportedLanguagesRequest { - // Required. Location to make a regional or global call. + // Required. Project or location to make a call. Must refer to a caller's + // project. // - // Format: `projects/{project-id}/locations/{location-id}`. + // Format: `projects/{project-id}` or + // `projects/{project-id}/locations/{location-id}`. // - // For global calls, use `projects/{project-id}/locations/global`. + // For global calls, use `projects/{project-id}/locations/global` or + // `projects/{project-id}`. + // + // Non-global location is required for AutoML models. // // Only models within the same region (have same location-id) can be used, // otherwise an INVALID_ARGUMENT (400) error is returned. - string parent = 3; + string parent = 3 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; // Optional. The language to use to return localized, human readable names // of supported languages. If missing, then display names are not returned // in a response. - string display_language_code = 1; + string display_language_code = 1 [(google.api.field_behavior) = OPTIONAL]; // Optional. Get supported languages of this model. // @@ -305,7 +377,7 @@ message GetSupportedLanguagesRequest { // // Returns languages supported by the specified model. // If missing, we get supported languages of Google general base (PBMT) model. - string model = 2; + string model = 2 [(google.api.field_behavior) = OPTIONAL]; } // The response message for discovering supported languages. @@ -338,7 +410,7 @@ message SupportedLanguage { // The Google Cloud Storage location for the input content. message GcsSource { // Required. Source data URI. For example, `gs://my_bucket/my_object`. - string input_uri = 1; + string input_uri = 1 [(google.api.field_behavior) = REQUIRED]; } // Input configuration for BatchTranslateText request. @@ -347,7 +419,7 @@ message InputConfig { // For `.tsv`, "text/html" is used if mime_type is missing. // For `.html`, this field must be "text/html" or empty. // For `.txt`, this field must be "text/plain" or empty. - string mime_type = 1; + string mime_type = 1 [(google.api.field_behavior) = OPTIONAL]; // Required. Specify the input. oneof source { @@ -373,12 +445,12 @@ message InputConfig { } } -// The Google Cloud Storage location for the output content +// The Google Cloud Storage location for the output content. message GcsDestination { // Required. There must be no files under 'output_uri_prefix'. - // 'output_uri_prefix' must end with "/", otherwise an INVALID_ARGUMENT (400) - // error is returned.. - string output_uri_prefix = 1; + // 'output_uri_prefix' must end with "/" and start with "gs://", otherwise an + // INVALID_ARGUMENT (400) error is returned. + string output_uri_prefix = 1 [(google.api.field_behavior) = REQUIRED]; } // Output configuration for BatchTranslateText request. @@ -457,7 +529,7 @@ message OutputConfig { // The batch translation request. message BatchTranslateTextRequest { - // Required. Location to make a regional call. + // Required. Location to make a call. Must refer to a caller's project. // // Format: `projects/{project-id}/locations/{location-id}`. // @@ -466,13 +538,18 @@ message BatchTranslateTextRequest { // Only AutoML Translation models or glossaries within the same region (have // the same location-id) can be used, otherwise an INVALID_ARGUMENT (400) // error is returned. - string parent = 1; + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; // Required. Source language code. - string source_language_code = 2; + string source_language_code = 2 [(google.api.field_behavior) = REQUIRED]; // Required. Specify up to 10 language codes here. - repeated string target_language_codes = 3; + repeated string target_language_codes = 3 [(google.api.field_behavior) = REQUIRED]; // Optional. The models to use for translation. Map's key is target language // code. Map's value is model name. Value can be a built-in general model, @@ -490,22 +567,32 @@ message BatchTranslateTextRequest { // // If the map is empty or a specific model is // not requested for a language pair, then default google model (nmt) is used. - map models = 4; + map models = 4 [(google.api.field_behavior) = OPTIONAL]; // Required. Input configurations. // The total number of files matched should be <= 1000. // The total content size should be <= 100M Unicode codepoints. // The files must use UTF-8 encoding. - repeated InputConfig input_configs = 5; + repeated InputConfig input_configs = 5 [(google.api.field_behavior) = REQUIRED]; // Required. Output configuration. // If 2 input configs match to the same file (that is, same input path), // we don't generate output for duplicate inputs. - OutputConfig output_config = 6; + OutputConfig output_config = 6 [(google.api.field_behavior) = REQUIRED]; // Optional. Glossaries to be applied for translation. // It's keyed by target language code. - map glossaries = 7; + map glossaries = 7 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The labels with user-defined metadata for the request. + // + // Label keys and values can be no longer than 63 characters + // (Unicode codepoints), can only contain lowercase letters, numeric + // characters, underscores and dashes. International characters are allowed. + // Label values are optional. Label keys must start with a letter. + // + // See https://cloud.google.com/translate/docs/labels for more information. + map labels = 9 [(google.api.field_behavior) = OPTIONAL]; } // State metadata for the batch translation operation. @@ -606,6 +693,11 @@ message GlossaryInputConfig { // Represents a glossary built from user provided data. message Glossary { + option (google.api.resource) = { + type: "translate.googleapis.com/Glossary" + pattern: "projects/{project}/locations/{location}/glossaries/{glossary}" + }; + // Used with unidirectional glossaries. message LanguageCodePair { // Required. The BCP-47 language code of the input text, for example, @@ -627,7 +719,7 @@ message Glossary { // Required. The resource name of the glossary. Glossary names have the form // `projects/{project-id}/locations/{location-id}/glossaries/{glossary-id}`. - string name = 1; + string name = 1 [(google.api.field_behavior) = REQUIRED]; // Languages supported by the glossary. oneof languages { @@ -643,55 +735,75 @@ message Glossary { GlossaryInputConfig input_config = 5; // Output only. The number of entries defined in the glossary. - int32 entry_count = 6; + int32 entry_count = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; // Output only. When CreateGlossary was called. - google.protobuf.Timestamp submit_time = 7; + google.protobuf.Timestamp submit_time = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; // Output only. When the glossary creation was finished. - google.protobuf.Timestamp end_time = 8; + google.protobuf.Timestamp end_time = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; } // Request message for CreateGlossary. message CreateGlossaryRequest { // Required. The project name. - string parent = 1; + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; // Required. The glossary to create. - Glossary glossary = 2; + Glossary glossary = 2 [(google.api.field_behavior) = REQUIRED]; } // Request message for GetGlossary. message GetGlossaryRequest { // Required. The name of the glossary to retrieve. - string name = 1; + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "translate.googleapis.com/Glossary" + } + ]; } // Request message for DeleteGlossary. message DeleteGlossaryRequest { // Required. The name of the glossary to delete. - string name = 1; + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "translate.googleapis.com/Glossary" + } + ]; } // Request message for ListGlossaries. message ListGlossariesRequest { // Required. The name of the project from which to list all of the glossaries. - string parent = 1; + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; // Optional. Requested page size. The server may return fewer glossaries than // requested. If unspecified, the server picks an appropriate default. - int32 page_size = 2; + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; // Optional. A token identifying a page of results the server should return. // Typically, this is the value of [ListGlossariesResponse.next_page_token] // returned from the previous call to `ListGlossaries` method. // The first page is returned if `page_token`is empty or missing. - string page_token = 3; + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; // Optional. Filter specifying constraints of a list operation. // Filtering is not supported yet, and the parameter currently has no effect. // If missing, no filtering is performed. - string filter = 4; + string filter = 4 [(google.api.field_behavior) = OPTIONAL]; } // Response message for ListGlossaries. diff --git a/google/cloud/translate_v3beta1/proto/translation_service_pb2.py b/google/cloud/translate_v3beta1/proto/translation_service_pb2.py index 60dfc368..8a423d69 100644 --- a/google/cloud/translate_v3beta1/proto/translation_service_pb2.py +++ b/google/cloud/translate_v3beta1/proto/translation_service_pb2.py @@ -16,12 +16,13 @@ from google.api import annotations_pb2 as google_dot_api_dot_annotations__pb2 +from google.api import client_pb2 as google_dot_api_dot_client__pb2 +from google.api import field_behavior_pb2 as google_dot_api_dot_field__behavior__pb2 from google.api import resource_pb2 as google_dot_api_dot_resource__pb2 from google.longrunning import ( operations_pb2 as google_dot_longrunning_dot_operations__pb2, ) from google.protobuf import timestamp_pb2 as google_dot_protobuf_dot_timestamp__pb2 -from google.api import client_pb2 as google_dot_api_dot_client__pb2 DESCRIPTOR = _descriptor.FileDescriptor( @@ -32,14 +33,15 @@ '\n"com.google.cloud.translate.v3beta1B\027TranslationServiceProtoP\001ZGgoogle.golang.org/genproto/googleapis/cloud/translate/v3beta1;translate\370\001\001\252\002\036Google.Cloud.Translate.V3Beta1\312\002\036Google\\Cloud\\Translate\\V3beta1\352\002!Google::Cloud::Translate::V3beta1' ), serialized_pb=_b( - '\n@google/cloud/translation_v3beta1/proto/translation_service.proto\x12 google.cloud.translation.v3beta1\x1a\x1cgoogle/api/annotations.proto\x1a\x19google/api/resource.proto\x1a#google/longrunning/operations.proto\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x17google/api/client.proto"D\n\x1bTranslateTextGlossaryConfig\x12\x10\n\x08glossary\x18\x01 \x01(\t\x12\x13\n\x0bignore_case\x18\x02 \x01(\x08"\xee\x01\n\x14TranslateTextRequest\x12\x10\n\x08\x63ontents\x18\x01 \x03(\t\x12\x11\n\tmime_type\x18\x03 \x01(\t\x12\x1c\n\x14source_language_code\x18\x04 \x01(\t\x12\x1c\n\x14target_language_code\x18\x05 \x01(\t\x12\x0e\n\x06parent\x18\x08 \x01(\t\x12\r\n\x05model\x18\x06 \x01(\t\x12V\n\x0fglossary_config\x18\x07 \x01(\x0b\x32=.google.cloud.translation.v3beta1.TranslateTextGlossaryConfig"\xaa\x01\n\x15TranslateTextResponse\x12\x43\n\x0ctranslations\x18\x01 \x03(\x0b\x32-.google.cloud.translation.v3beta1.Translation\x12L\n\x15glossary_translations\x18\x03 \x03(\x0b\x32-.google.cloud.translation.v3beta1.Translation"\xad\x01\n\x0bTranslation\x12\x17\n\x0ftranslated_text\x18\x01 \x01(\t\x12\r\n\x05model\x18\x02 \x01(\t\x12\x1e\n\x16\x64\x65tected_language_code\x18\x04 \x01(\t\x12V\n\x0fglossary_config\x18\x03 \x01(\x0b\x32=.google.cloud.translation.v3beta1.TranslateTextGlossaryConfig"f\n\x15\x44\x65tectLanguageRequest\x12\x0e\n\x06parent\x18\x05 \x01(\t\x12\r\n\x05model\x18\x04 \x01(\t\x12\x11\n\x07\x63ontent\x18\x01 \x01(\tH\x00\x12\x11\n\tmime_type\x18\x03 \x01(\tB\x08\n\x06source"=\n\x10\x44\x65tectedLanguage\x12\x15\n\rlanguage_code\x18\x01 \x01(\t\x12\x12\n\nconfidence\x18\x02 \x01(\x02"_\n\x16\x44\x65tectLanguageResponse\x12\x45\n\tlanguages\x18\x01 \x03(\x0b\x32\x32.google.cloud.translation.v3beta1.DetectedLanguage"\\\n\x1cGetSupportedLanguagesRequest\x12\x0e\n\x06parent\x18\x03 \x01(\t\x12\x1d\n\x15\x64isplay_language_code\x18\x01 \x01(\t\x12\r\n\x05model\x18\x02 \x01(\t"\\\n\x12SupportedLanguages\x12\x46\n\tlanguages\x18\x01 \x03(\x0b\x32\x33.google.cloud.translation.v3beta1.SupportedLanguage"p\n\x11SupportedLanguage\x12\x15\n\rlanguage_code\x18\x01 \x01(\t\x12\x14\n\x0c\x64isplay_name\x18\x02 \x01(\t\x12\x16\n\x0esupport_source\x18\x03 \x01(\x08\x12\x16\n\x0esupport_target\x18\x04 \x01(\x08"\x1e\n\tGcsSource\x12\x11\n\tinput_uri\x18\x01 \x01(\t"m\n\x0bInputConfig\x12\x11\n\tmime_type\x18\x01 \x01(\t\x12\x41\n\ngcs_source\x18\x02 \x01(\x0b\x32+.google.cloud.translation.v3beta1.GcsSourceH\x00\x42\x08\n\x06source"+\n\x0eGcsDestination\x12\x19\n\x11output_uri_prefix\x18\x01 \x01(\t"j\n\x0cOutputConfig\x12K\n\x0fgcs_destination\x18\x01 \x01(\x0b\x32\x30.google.cloud.translation.v3beta1.GcsDestinationH\x00\x42\r\n\x0b\x64\x65stination"\xd0\x04\n\x19\x42\x61tchTranslateTextRequest\x12\x0e\n\x06parent\x18\x01 \x01(\t\x12\x1c\n\x14source_language_code\x18\x02 \x01(\t\x12\x1d\n\x15target_language_codes\x18\x03 \x03(\t\x12W\n\x06models\x18\x04 \x03(\x0b\x32G.google.cloud.translation.v3beta1.BatchTranslateTextRequest.ModelsEntry\x12\x44\n\rinput_configs\x18\x05 \x03(\x0b\x32-.google.cloud.translation.v3beta1.InputConfig\x12\x45\n\routput_config\x18\x06 \x01(\x0b\x32..google.cloud.translation.v3beta1.OutputConfig\x12_\n\nglossaries\x18\x07 \x03(\x0b\x32K.google.cloud.translation.v3beta1.BatchTranslateTextRequest.GlossariesEntry\x1a-\n\x0bModelsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\x1ap\n\x0fGlossariesEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12L\n\x05value\x18\x02 \x01(\x0b\x32=.google.cloud.translation.v3beta1.TranslateTextGlossaryConfig:\x02\x38\x01"\xd3\x02\n\x16\x42\x61tchTranslateMetadata\x12M\n\x05state\x18\x01 \x01(\x0e\x32>.google.cloud.translation.v3beta1.BatchTranslateMetadata.State\x12\x1d\n\x15translated_characters\x18\x02 \x01(\x03\x12\x19\n\x11\x66\x61iled_characters\x18\x03 \x01(\x03\x12\x18\n\x10total_characters\x18\x04 \x01(\x03\x12/\n\x0bsubmit_time\x18\x05 \x01(\x0b\x32\x1a.google.protobuf.Timestamp"e\n\x05State\x12\x15\n\x11STATE_UNSPECIFIED\x10\x00\x12\x0b\n\x07RUNNING\x10\x01\x12\r\n\tSUCCEEDED\x10\x02\x12\n\n\x06\x46\x41ILED\x10\x03\x12\x0e\n\nCANCELLING\x10\x04\x12\r\n\tCANCELLED\x10\x05"\xcb\x01\n\x16\x42\x61tchTranslateResponse\x12\x18\n\x10total_characters\x18\x01 \x01(\x03\x12\x1d\n\x15translated_characters\x18\x02 \x01(\x03\x12\x19\n\x11\x66\x61iled_characters\x18\x03 \x01(\x03\x12/\n\x0bsubmit_time\x18\x04 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12,\n\x08\x65nd_time\x18\x05 \x01(\x0b\x32\x1a.google.protobuf.Timestamp"b\n\x13GlossaryInputConfig\x12\x41\n\ngcs_source\x18\x01 \x01(\x0b\x32+.google.cloud.translation.v3beta1.GcsSourceH\x00\x42\x08\n\x06source"\x93\x04\n\x08Glossary\x12\x0c\n\x04name\x18\x01 \x01(\t\x12T\n\rlanguage_pair\x18\x03 \x01(\x0b\x32;.google.cloud.translation.v3beta1.Glossary.LanguageCodePairH\x00\x12Y\n\x12language_codes_set\x18\x04 \x01(\x0b\x32;.google.cloud.translation.v3beta1.Glossary.LanguageCodesSetH\x00\x12K\n\x0cinput_config\x18\x05 \x01(\x0b\x32\x35.google.cloud.translation.v3beta1.GlossaryInputConfig\x12\x13\n\x0b\x65ntry_count\x18\x06 \x01(\x05\x12/\n\x0bsubmit_time\x18\x07 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12,\n\x08\x65nd_time\x18\x08 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x1aN\n\x10LanguageCodePair\x12\x1c\n\x14source_language_code\x18\x01 \x01(\t\x12\x1c\n\x14target_language_code\x18\x02 \x01(\t\x1a*\n\x10LanguageCodesSet\x12\x16\n\x0elanguage_codes\x18\x01 \x03(\tB\x0b\n\tlanguages"e\n\x15\x43reateGlossaryRequest\x12\x0e\n\x06parent\x18\x01 \x01(\t\x12<\n\x08glossary\x18\x02 \x01(\x0b\x32*.google.cloud.translation.v3beta1.Glossary""\n\x12GetGlossaryRequest\x12\x0c\n\x04name\x18\x01 \x01(\t"%\n\x15\x44\x65leteGlossaryRequest\x12\x0c\n\x04name\x18\x01 \x01(\t"^\n\x15ListGlossariesRequest\x12\x0e\n\x06parent\x18\x01 \x01(\t\x12\x11\n\tpage_size\x18\x02 \x01(\x05\x12\x12\n\npage_token\x18\x03 \x01(\t\x12\x0e\n\x06\x66ilter\x18\x04 \x01(\t"q\n\x16ListGlossariesResponse\x12>\n\nglossaries\x18\x01 \x03(\x0b\x32*.google.cloud.translation.v3beta1.Glossary\x12\x17\n\x0fnext_page_token\x18\x02 \x01(\t"\x8d\x02\n\x16\x43reateGlossaryMetadata\x12\x0c\n\x04name\x18\x01 \x01(\t\x12M\n\x05state\x18\x02 \x01(\x0e\x32>.google.cloud.translation.v3beta1.CreateGlossaryMetadata.State\x12/\n\x0bsubmit_time\x18\x03 \x01(\x0b\x32\x1a.google.protobuf.Timestamp"e\n\x05State\x12\x15\n\x11STATE_UNSPECIFIED\x10\x00\x12\x0b\n\x07RUNNING\x10\x01\x12\r\n\tSUCCEEDED\x10\x02\x12\n\n\x06\x46\x41ILED\x10\x03\x12\x0e\n\nCANCELLING\x10\x04\x12\r\n\tCANCELLED\x10\x05"\x8d\x02\n\x16\x44\x65leteGlossaryMetadata\x12\x0c\n\x04name\x18\x01 \x01(\t\x12M\n\x05state\x18\x02 \x01(\x0e\x32>.google.cloud.translation.v3beta1.DeleteGlossaryMetadata.State\x12/\n\x0bsubmit_time\x18\x03 \x01(\x0b\x32\x1a.google.protobuf.Timestamp"e\n\x05State\x12\x15\n\x11STATE_UNSPECIFIED\x10\x00\x12\x0b\n\x07RUNNING\x10\x01\x12\r\n\tSUCCEEDED\x10\x02\x12\n\n\x06\x46\x41ILED\x10\x03\x12\x0e\n\nCANCELLING\x10\x04\x12\r\n\tCANCELLED\x10\x05"\x85\x01\n\x16\x44\x65leteGlossaryResponse\x12\x0c\n\x04name\x18\x01 \x01(\t\x12/\n\x0bsubmit_time\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12,\n\x08\x65nd_time\x18\x03 \x01(\x0b\x32\x1a.google.protobuf.Timestamp2\xb5\r\n\x12TranslationService\x12\xf4\x01\n\rTranslateText\x12\x36.google.cloud.translation.v3beta1.TranslateTextRequest\x1a\x37.google.cloud.translation.v3beta1.TranslateTextResponse"r\x82\xd3\xe4\x93\x02l"6/v3beta1/{parent=projects/*/locations/*}:translateText:\x01*Z/"*/v3beta1/{parent=projects/*}:translateText:\x01*\x12\xf9\x01\n\x0e\x44\x65tectLanguage\x12\x37.google.cloud.translation.v3beta1.DetectLanguageRequest\x1a\x38.google.cloud.translation.v3beta1.DetectLanguageResponse"t\x82\xd3\xe4\x93\x02n"7/v3beta1/{parent=projects/*/locations/*}:detectLanguage:\x01*Z0"+/v3beta1/{parent=projects/*}:detectLanguage:\x01*\x12\x85\x02\n\x15GetSupportedLanguages\x12>.google.cloud.translation.v3beta1.GetSupportedLanguagesRequest\x1a\x34.google.cloud.translation.v3beta1.SupportedLanguages"v\x82\xd3\xe4\x93\x02p\x12;/v3beta1/{parent=projects/*/locations/*}/supportedLanguagesZ1\x12//v3beta1/{parent=projects/*}/supportedLanguages\x12\xb8\x01\n\x12\x42\x61tchTranslateText\x12;.google.cloud.translation.v3beta1.BatchTranslateTextRequest\x1a\x1d.google.longrunning.Operation"F\x82\xd3\xe4\x93\x02@";/v3beta1/{parent=projects/*/locations/*}:batchTranslateText:\x01*\x12\xaf\x01\n\x0e\x43reateGlossary\x12\x37.google.cloud.translation.v3beta1.CreateGlossaryRequest\x1a\x1d.google.longrunning.Operation"E\x82\xd3\xe4\x93\x02?"3/v3beta1/{parent=projects/*/locations/*}/glossaries:\x08glossary\x12\xc0\x01\n\x0eListGlossaries\x12\x37.google.cloud.translation.v3beta1.ListGlossariesRequest\x1a\x38.google.cloud.translation.v3beta1.ListGlossariesResponse";\x82\xd3\xe4\x93\x02\x35\x12\x33/v3beta1/{parent=projects/*/locations/*}/glossaries\x12\xac\x01\n\x0bGetGlossary\x12\x34.google.cloud.translation.v3beta1.GetGlossaryRequest\x1a*.google.cloud.translation.v3beta1.Glossary";\x82\xd3\xe4\x93\x02\x35\x12\x33/v3beta1/{name=projects/*/locations/*/glossaries/*}\x12\xa5\x01\n\x0e\x44\x65leteGlossary\x12\x37.google.cloud.translation.v3beta1.DeleteGlossaryRequest\x1a\x1d.google.longrunning.Operation";\x82\xd3\xe4\x93\x02\x35*3/v3beta1/{name=projects/*/locations/*/glossaries/*}\x1a\x1d\xca\x41\x1atranslation.googleapis.comB\xf1\x01\n"com.google.cloud.translate.v3beta1B\x17TranslationServiceProtoP\x01ZGgoogle.golang.org/genproto/googleapis/cloud/translate/v3beta1;translate\xf8\x01\x01\xaa\x02\x1eGoogle.Cloud.Translate.V3Beta1\xca\x02\x1eGoogle\\Cloud\\Translate\\V3beta1\xea\x02!Google::Cloud::Translate::V3beta1b\x06proto3' + '\n@google/cloud/translation_v3beta1/proto/translation_service.proto\x12 google.cloud.translation.v3beta1\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a#google/longrunning/operations.proto\x1a\x1fgoogle/protobuf/timestamp.proto"N\n\x1bTranslateTextGlossaryConfig\x12\x15\n\x08glossary\x18\x01 \x01(\tB\x03\xe0\x41\x02\x12\x18\n\x0bignore_case\x18\x02 \x01(\x08\x42\x03\xe0\x41\x01"\xbf\x03\n\x14TranslateTextRequest\x12\x15\n\x08\x63ontents\x18\x01 \x03(\tB\x03\xe0\x41\x02\x12\x16\n\tmime_type\x18\x03 \x01(\tB\x03\xe0\x41\x01\x12!\n\x14source_language_code\x18\x04 \x01(\tB\x03\xe0\x41\x01\x12!\n\x14target_language_code\x18\x05 \x01(\tB\x03\xe0\x41\x02\x12\x39\n\x06parent\x18\x08 \x01(\tB)\xe0\x41\x02\xfa\x41#\n!locations.googleapis.com/Location\x12\x12\n\x05model\x18\x06 \x01(\tB\x03\xe0\x41\x01\x12[\n\x0fglossary_config\x18\x07 \x01(\x0b\x32=.google.cloud.translation.v3beta1.TranslateTextGlossaryConfigB\x03\xe0\x41\x01\x12W\n\x06labels\x18\n \x03(\x0b\x32\x42.google.cloud.translation.v3beta1.TranslateTextRequest.LabelsEntryB\x03\xe0\x41\x01\x1a-\n\x0bLabelsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01"\xaa\x01\n\x15TranslateTextResponse\x12\x43\n\x0ctranslations\x18\x01 \x03(\x0b\x32-.google.cloud.translation.v3beta1.Translation\x12L\n\x15glossary_translations\x18\x03 \x03(\x0b\x32-.google.cloud.translation.v3beta1.Translation"\xad\x01\n\x0bTranslation\x12\x17\n\x0ftranslated_text\x18\x01 \x01(\t\x12\r\n\x05model\x18\x02 \x01(\t\x12\x1e\n\x16\x64\x65tected_language_code\x18\x04 \x01(\t\x12V\n\x0fglossary_config\x18\x03 \x01(\x0b\x32=.google.cloud.translation.v3beta1.TranslateTextGlossaryConfig"\x9f\x02\n\x15\x44\x65tectLanguageRequest\x12\x39\n\x06parent\x18\x05 \x01(\tB)\xe0\x41\x02\xfa\x41#\n!locations.googleapis.com/Location\x12\x12\n\x05model\x18\x04 \x01(\tB\x03\xe0\x41\x01\x12\x11\n\x07\x63ontent\x18\x01 \x01(\tH\x00\x12\x16\n\tmime_type\x18\x03 \x01(\tB\x03\xe0\x41\x01\x12S\n\x06labels\x18\x06 \x03(\x0b\x32\x43.google.cloud.translation.v3beta1.DetectLanguageRequest.LabelsEntry\x1a-\n\x0bLabelsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\x42\x08\n\x06source"=\n\x10\x44\x65tectedLanguage\x12\x15\n\rlanguage_code\x18\x01 \x01(\t\x12\x12\n\nconfidence\x18\x02 \x01(\x02"_\n\x16\x44\x65tectLanguageResponse\x12\x45\n\tlanguages\x18\x01 \x03(\x0b\x32\x32.google.cloud.translation.v3beta1.DetectedLanguage"\x91\x01\n\x1cGetSupportedLanguagesRequest\x12\x39\n\x06parent\x18\x03 \x01(\tB)\xe0\x41\x02\xfa\x41#\n!locations.googleapis.com/Location\x12"\n\x15\x64isplay_language_code\x18\x01 \x01(\tB\x03\xe0\x41\x01\x12\x12\n\x05model\x18\x02 \x01(\tB\x03\xe0\x41\x01"\\\n\x12SupportedLanguages\x12\x46\n\tlanguages\x18\x01 \x03(\x0b\x32\x33.google.cloud.translation.v3beta1.SupportedLanguage"p\n\x11SupportedLanguage\x12\x15\n\rlanguage_code\x18\x01 \x01(\t\x12\x14\n\x0c\x64isplay_name\x18\x02 \x01(\t\x12\x16\n\x0esupport_source\x18\x03 \x01(\x08\x12\x16\n\x0esupport_target\x18\x04 \x01(\x08"#\n\tGcsSource\x12\x16\n\tinput_uri\x18\x01 \x01(\tB\x03\xe0\x41\x02"r\n\x0bInputConfig\x12\x16\n\tmime_type\x18\x01 \x01(\tB\x03\xe0\x41\x01\x12\x41\n\ngcs_source\x18\x02 \x01(\x0b\x32+.google.cloud.translation.v3beta1.GcsSourceH\x00\x42\x08\n\x06source"0\n\x0eGcsDestination\x12\x1e\n\x11output_uri_prefix\x18\x01 \x01(\tB\x03\xe0\x41\x02"j\n\x0cOutputConfig\x12K\n\x0fgcs_destination\x18\x01 \x01(\x0b\x32\x30.google.cloud.translation.v3beta1.GcsDestinationH\x00\x42\r\n\x0b\x64\x65stination"\xa6\x06\n\x19\x42\x61tchTranslateTextRequest\x12\x39\n\x06parent\x18\x01 \x01(\tB)\xe0\x41\x02\xfa\x41#\n!locations.googleapis.com/Location\x12!\n\x14source_language_code\x18\x02 \x01(\tB\x03\xe0\x41\x02\x12"\n\x15target_language_codes\x18\x03 \x03(\tB\x03\xe0\x41\x02\x12\\\n\x06models\x18\x04 \x03(\x0b\x32G.google.cloud.translation.v3beta1.BatchTranslateTextRequest.ModelsEntryB\x03\xe0\x41\x01\x12I\n\rinput_configs\x18\x05 \x03(\x0b\x32-.google.cloud.translation.v3beta1.InputConfigB\x03\xe0\x41\x02\x12J\n\routput_config\x18\x06 \x01(\x0b\x32..google.cloud.translation.v3beta1.OutputConfigB\x03\xe0\x41\x02\x12\x64\n\nglossaries\x18\x07 \x03(\x0b\x32K.google.cloud.translation.v3beta1.BatchTranslateTextRequest.GlossariesEntryB\x03\xe0\x41\x01\x12\\\n\x06labels\x18\t \x03(\x0b\x32G.google.cloud.translation.v3beta1.BatchTranslateTextRequest.LabelsEntryB\x03\xe0\x41\x01\x1a-\n\x0bModelsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\x1ap\n\x0fGlossariesEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12L\n\x05value\x18\x02 \x01(\x0b\x32=.google.cloud.translation.v3beta1.TranslateTextGlossaryConfig:\x02\x38\x01\x1a-\n\x0bLabelsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01"\xd3\x02\n\x16\x42\x61tchTranslateMetadata\x12M\n\x05state\x18\x01 \x01(\x0e\x32>.google.cloud.translation.v3beta1.BatchTranslateMetadata.State\x12\x1d\n\x15translated_characters\x18\x02 \x01(\x03\x12\x19\n\x11\x66\x61iled_characters\x18\x03 \x01(\x03\x12\x18\n\x10total_characters\x18\x04 \x01(\x03\x12/\n\x0bsubmit_time\x18\x05 \x01(\x0b\x32\x1a.google.protobuf.Timestamp"e\n\x05State\x12\x15\n\x11STATE_UNSPECIFIED\x10\x00\x12\x0b\n\x07RUNNING\x10\x01\x12\r\n\tSUCCEEDED\x10\x02\x12\n\n\x06\x46\x41ILED\x10\x03\x12\x0e\n\nCANCELLING\x10\x04\x12\r\n\tCANCELLED\x10\x05"\xcb\x01\n\x16\x42\x61tchTranslateResponse\x12\x18\n\x10total_characters\x18\x01 \x01(\x03\x12\x1d\n\x15translated_characters\x18\x02 \x01(\x03\x12\x19\n\x11\x66\x61iled_characters\x18\x03 \x01(\x03\x12/\n\x0bsubmit_time\x18\x04 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12,\n\x08\x65nd_time\x18\x05 \x01(\x0b\x32\x1a.google.protobuf.Timestamp"b\n\x13GlossaryInputConfig\x12\x41\n\ngcs_source\x18\x01 \x01(\x0b\x32+.google.cloud.translation.v3beta1.GcsSourceH\x00\x42\x08\n\x06source"\x8e\x05\n\x08Glossary\x12\x11\n\x04name\x18\x01 \x01(\tB\x03\xe0\x41\x02\x12T\n\rlanguage_pair\x18\x03 \x01(\x0b\x32;.google.cloud.translation.v3beta1.Glossary.LanguageCodePairH\x00\x12Y\n\x12language_codes_set\x18\x04 \x01(\x0b\x32;.google.cloud.translation.v3beta1.Glossary.LanguageCodesSetH\x00\x12K\n\x0cinput_config\x18\x05 \x01(\x0b\x32\x35.google.cloud.translation.v3beta1.GlossaryInputConfig\x12\x18\n\x0b\x65ntry_count\x18\x06 \x01(\x05\x42\x03\xe0\x41\x03\x12\x34\n\x0bsubmit_time\x18\x07 \x01(\x0b\x32\x1a.google.protobuf.TimestampB\x03\xe0\x41\x03\x12\x31\n\x08\x65nd_time\x18\x08 \x01(\x0b\x32\x1a.google.protobuf.TimestampB\x03\xe0\x41\x03\x1aN\n\x10LanguageCodePair\x12\x1c\n\x14source_language_code\x18\x01 \x01(\t\x12\x1c\n\x14target_language_code\x18\x02 \x01(\t\x1a*\n\x10LanguageCodesSet\x12\x16\n\x0elanguage_codes\x18\x01 \x03(\t:e\xea\x41\x62\n!translate.googleapis.com/Glossary\x12=projects/{project}/locations/{location}/glossaries/{glossary}B\x0b\n\tlanguages"\x95\x01\n\x15\x43reateGlossaryRequest\x12\x39\n\x06parent\x18\x01 \x01(\tB)\xe0\x41\x02\xfa\x41#\n!locations.googleapis.com/Location\x12\x41\n\x08glossary\x18\x02 \x01(\x0b\x32*.google.cloud.translation.v3beta1.GlossaryB\x03\xe0\x41\x02"M\n\x12GetGlossaryRequest\x12\x37\n\x04name\x18\x01 \x01(\tB)\xe0\x41\x02\xfa\x41#\n!translate.googleapis.com/Glossary"P\n\x15\x44\x65leteGlossaryRequest\x12\x37\n\x04name\x18\x01 \x01(\tB)\xe0\x41\x02\xfa\x41#\n!translate.googleapis.com/Glossary"\x98\x01\n\x15ListGlossariesRequest\x12\x39\n\x06parent\x18\x01 \x01(\tB)\xe0\x41\x02\xfa\x41#\n!locations.googleapis.com/Location\x12\x16\n\tpage_size\x18\x02 \x01(\x05\x42\x03\xe0\x41\x01\x12\x17\n\npage_token\x18\x03 \x01(\tB\x03\xe0\x41\x01\x12\x13\n\x06\x66ilter\x18\x04 \x01(\tB\x03\xe0\x41\x01"q\n\x16ListGlossariesResponse\x12>\n\nglossaries\x18\x01 \x03(\x0b\x32*.google.cloud.translation.v3beta1.Glossary\x12\x17\n\x0fnext_page_token\x18\x02 \x01(\t"\x8d\x02\n\x16\x43reateGlossaryMetadata\x12\x0c\n\x04name\x18\x01 \x01(\t\x12M\n\x05state\x18\x02 \x01(\x0e\x32>.google.cloud.translation.v3beta1.CreateGlossaryMetadata.State\x12/\n\x0bsubmit_time\x18\x03 \x01(\x0b\x32\x1a.google.protobuf.Timestamp"e\n\x05State\x12\x15\n\x11STATE_UNSPECIFIED\x10\x00\x12\x0b\n\x07RUNNING\x10\x01\x12\r\n\tSUCCEEDED\x10\x02\x12\n\n\x06\x46\x41ILED\x10\x03\x12\x0e\n\nCANCELLING\x10\x04\x12\r\n\tCANCELLED\x10\x05"\x8d\x02\n\x16\x44\x65leteGlossaryMetadata\x12\x0c\n\x04name\x18\x01 \x01(\t\x12M\n\x05state\x18\x02 \x01(\x0e\x32>.google.cloud.translation.v3beta1.DeleteGlossaryMetadata.State\x12/\n\x0bsubmit_time\x18\x03 \x01(\x0b\x32\x1a.google.protobuf.Timestamp"e\n\x05State\x12\x15\n\x11STATE_UNSPECIFIED\x10\x00\x12\x0b\n\x07RUNNING\x10\x01\x12\r\n\tSUCCEEDED\x10\x02\x12\n\n\x06\x46\x41ILED\x10\x03\x12\x0e\n\nCANCELLING\x10\x04\x12\r\n\tCANCELLED\x10\x05"\x85\x01\n\x16\x44\x65leteGlossaryResponse\x12\x0c\n\x04name\x18\x01 \x01(\t\x12/\n\x0bsubmit_time\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12,\n\x08\x65nd_time\x18\x03 \x01(\x0b\x32\x1a.google.protobuf.Timestamp2\x9a\x10\n\x12TranslationService\x12\xf4\x01\n\rTranslateText\x12\x36.google.cloud.translation.v3beta1.TranslateTextRequest\x1a\x37.google.cloud.translation.v3beta1.TranslateTextResponse"r\x82\xd3\xe4\x93\x02l"6/v3beta1/{parent=projects/*/locations/*}:translateText:\x01*Z/"*/v3beta1/{parent=projects/*}:translateText:\x01*\x12\x93\x02\n\x0e\x44\x65tectLanguage\x12\x37.google.cloud.translation.v3beta1.DetectLanguageRequest\x1a\x38.google.cloud.translation.v3beta1.DetectLanguageResponse"\x8d\x01\x82\xd3\xe4\x93\x02n"7/v3beta1/{parent=projects/*/locations/*}:detectLanguage:\x01*Z0"+/v3beta1/{parent=projects/*}:detectLanguage:\x01*\xda\x41\x16parent,model,mime_type\x12\xab\x02\n\x15GetSupportedLanguages\x12>.google.cloud.translation.v3beta1.GetSupportedLanguagesRequest\x1a\x34.google.cloud.translation.v3beta1.SupportedLanguages"\x9b\x01\x82\xd3\xe4\x93\x02p\x12;/v3beta1/{parent=projects/*/locations/*}/supportedLanguagesZ1\x12//v3beta1/{parent=projects/*}/supportedLanguages\xda\x41"parent,display_language_code,model\x12\xeb\x01\n\x12\x42\x61tchTranslateText\x12;.google.cloud.translation.v3beta1.BatchTranslateTextRequest\x1a\x1d.google.longrunning.Operation"y\x82\xd3\xe4\x93\x02@";/v3beta1/{parent=projects/*/locations/*}:batchTranslateText:\x01*\xca\x41\x30\n\x16\x42\x61tchTranslateResponse\x12\x16\x42\x61tchTranslateMetadata\x12\xe6\x01\n\x0e\x43reateGlossary\x12\x37.google.cloud.translation.v3beta1.CreateGlossaryRequest\x1a\x1d.google.longrunning.Operation"|\x82\xd3\xe4\x93\x02?"3/v3beta1/{parent=projects/*/locations/*}/glossaries:\x08glossary\xda\x41\x0fparent,glossary\xca\x41"\n\x08Glossary\x12\x16\x43reateGlossaryMetadata\x12\xd9\x01\n\x0eListGlossaries\x12\x37.google.cloud.translation.v3beta1.ListGlossariesRequest\x1a\x38.google.cloud.translation.v3beta1.ListGlossariesResponse"T\x82\xd3\xe4\x93\x02\x35\x12\x33/v3beta1/{parent=projects/*/locations/*}/glossaries\xda\x41\x06parent\xda\x41\rparent,filter\x12\xb3\x01\n\x0bGetGlossary\x12\x34.google.cloud.translation.v3beta1.GetGlossaryRequest\x1a*.google.cloud.translation.v3beta1.Glossary"B\x82\xd3\xe4\x93\x02\x35\x12\x33/v3beta1/{name=projects/*/locations/*/glossaries/*}\xda\x41\x04name\x12\xdf\x01\n\x0e\x44\x65leteGlossary\x12\x37.google.cloud.translation.v3beta1.DeleteGlossaryRequest\x1a\x1d.google.longrunning.Operation"u\x82\xd3\xe4\x93\x02\x35*3/v3beta1/{name=projects/*/locations/*/glossaries/*}\xda\x41\x04name\xca\x41\x30\n\x16\x44\x65leteGlossaryResponse\x12\x16\x44\x65leteGlossaryMetadata\x1a~\xca\x41\x18translate.googleapis.com\xd2\x41`https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/cloud-translationB\xf1\x01\n"com.google.cloud.translate.v3beta1B\x17TranslationServiceProtoP\x01ZGgoogle.golang.org/genproto/googleapis/cloud/translate/v3beta1;translate\xf8\x01\x01\xaa\x02\x1eGoogle.Cloud.Translate.V3Beta1\xca\x02\x1eGoogle\\Cloud\\Translate\\V3beta1\xea\x02!Google::Cloud::Translate::V3beta1b\x06proto3' ), dependencies=[ google_dot_api_dot_annotations__pb2.DESCRIPTOR, + google_dot_api_dot_client__pb2.DESCRIPTOR, + google_dot_api_dot_field__behavior__pb2.DESCRIPTOR, google_dot_api_dot_resource__pb2.DESCRIPTOR, google_dot_longrunning_dot_operations__pb2.DESCRIPTOR, google_dot_protobuf_dot_timestamp__pb2.DESCRIPTOR, - google_dot_api_dot_client__pb2.DESCRIPTOR, ], ) @@ -75,8 +77,8 @@ ], containing_type=None, serialized_options=None, - serialized_start=2610, - serialized_end=2711, + serialized_start=3331, + serialized_end=3432, ) _sym_db.RegisterEnumDescriptor(_BATCHTRANSLATEMETADATA_STATE) @@ -111,8 +113,8 @@ ], containing_type=None, serialized_options=None, - serialized_start=2610, - serialized_end=2711, + serialized_start=3331, + serialized_end=3432, ) _sym_db.RegisterEnumDescriptor(_CREATEGLOSSARYMETADATA_STATE) @@ -147,8 +149,8 @@ ], containing_type=None, serialized_options=None, - serialized_start=2610, - serialized_end=2711, + serialized_start=3331, + serialized_end=3432, ) _sym_db.RegisterEnumDescriptor(_DELETEGLOSSARYMETADATA_STATE) @@ -175,7 +177,7 @@ containing_type=None, is_extension=False, extension_scope=None, - serialized_options=None, + serialized_options=_b("\340A\002"), file=DESCRIPTOR, ), _descriptor.FieldDescriptor( @@ -193,7 +195,7 @@ containing_type=None, is_extension=False, extension_scope=None, - serialized_options=None, + serialized_options=_b("\340A\001"), file=DESCRIPTOR, ), ], @@ -205,11 +207,67 @@ syntax="proto3", extension_ranges=[], oneofs=[], - serialized_start=254, - serialized_end=322, + serialized_start=287, + serialized_end=365, ) +_TRANSLATETEXTREQUEST_LABELSENTRY = _descriptor.Descriptor( + name="LabelsEntry", + full_name="google.cloud.translation.v3beta1.TranslateTextRequest.LabelsEntry", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="key", + full_name="google.cloud.translation.v3beta1.TranslateTextRequest.LabelsEntry.key", + index=0, + number=1, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="value", + full_name="google.cloud.translation.v3beta1.TranslateTextRequest.LabelsEntry.value", + index=1, + number=2, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=_b("8\001"), + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=770, + serialized_end=815, +) + _TRANSLATETEXTREQUEST = _descriptor.Descriptor( name="TranslateTextRequest", full_name="google.cloud.translation.v3beta1.TranslateTextRequest", @@ -232,7 +290,7 @@ containing_type=None, is_extension=False, extension_scope=None, - serialized_options=None, + serialized_options=_b("\340A\002"), file=DESCRIPTOR, ), _descriptor.FieldDescriptor( @@ -250,7 +308,7 @@ containing_type=None, is_extension=False, extension_scope=None, - serialized_options=None, + serialized_options=_b("\340A\001"), file=DESCRIPTOR, ), _descriptor.FieldDescriptor( @@ -268,7 +326,7 @@ containing_type=None, is_extension=False, extension_scope=None, - serialized_options=None, + serialized_options=_b("\340A\001"), file=DESCRIPTOR, ), _descriptor.FieldDescriptor( @@ -286,7 +344,7 @@ containing_type=None, is_extension=False, extension_scope=None, - serialized_options=None, + serialized_options=_b("\340A\002"), file=DESCRIPTOR, ), _descriptor.FieldDescriptor( @@ -304,7 +362,9 @@ containing_type=None, is_extension=False, extension_scope=None, - serialized_options=None, + serialized_options=_b( + "\340A\002\372A#\n!locations.googleapis.com/Location" + ), file=DESCRIPTOR, ), _descriptor.FieldDescriptor( @@ -322,7 +382,7 @@ containing_type=None, is_extension=False, extension_scope=None, - serialized_options=None, + serialized_options=_b("\340A\001"), file=DESCRIPTOR, ), _descriptor.FieldDescriptor( @@ -340,20 +400,38 @@ containing_type=None, is_extension=False, extension_scope=None, - serialized_options=None, + serialized_options=_b("\340A\001"), + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="labels", + full_name="google.cloud.translation.v3beta1.TranslateTextRequest.labels", + index=7, + number=10, + type=11, + cpp_type=10, + label=3, + has_default_value=False, + default_value=[], + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=_b("\340A\001"), file=DESCRIPTOR, ), ], extensions=[], - nested_types=[], + nested_types=[_TRANSLATETEXTREQUEST_LABELSENTRY], enum_types=[], serialized_options=None, is_extendable=False, syntax="proto3", extension_ranges=[], oneofs=[], - serialized_start=325, - serialized_end=563, + serialized_start=368, + serialized_end=815, ) @@ -409,8 +487,8 @@ syntax="proto3", extension_ranges=[], oneofs=[], - serialized_start=566, - serialized_end=736, + serialized_start=818, + serialized_end=988, ) @@ -502,11 +580,67 @@ syntax="proto3", extension_ranges=[], oneofs=[], - serialized_start=739, - serialized_end=912, + serialized_start=991, + serialized_end=1164, ) +_DETECTLANGUAGEREQUEST_LABELSENTRY = _descriptor.Descriptor( + name="LabelsEntry", + full_name="google.cloud.translation.v3beta1.DetectLanguageRequest.LabelsEntry", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="key", + full_name="google.cloud.translation.v3beta1.DetectLanguageRequest.LabelsEntry.key", + index=0, + number=1, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="value", + full_name="google.cloud.translation.v3beta1.DetectLanguageRequest.LabelsEntry.value", + index=1, + number=2, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=_b("8\001"), + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=770, + serialized_end=815, +) + _DETECTLANGUAGEREQUEST = _descriptor.Descriptor( name="DetectLanguageRequest", full_name="google.cloud.translation.v3beta1.DetectLanguageRequest", @@ -529,7 +663,9 @@ containing_type=None, is_extension=False, extension_scope=None, - serialized_options=None, + serialized_options=_b( + "\340A\002\372A#\n!locations.googleapis.com/Location" + ), file=DESCRIPTOR, ), _descriptor.FieldDescriptor( @@ -547,7 +683,7 @@ containing_type=None, is_extension=False, extension_scope=None, - serialized_options=None, + serialized_options=_b("\340A\001"), file=DESCRIPTOR, ), _descriptor.FieldDescriptor( @@ -583,12 +719,30 @@ containing_type=None, is_extension=False, extension_scope=None, + serialized_options=_b("\340A\001"), + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="labels", + full_name="google.cloud.translation.v3beta1.DetectLanguageRequest.labels", + index=4, + number=6, + type=11, + cpp_type=10, + label=3, + has_default_value=False, + default_value=[], + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, serialized_options=None, file=DESCRIPTOR, ), ], extensions=[], - nested_types=[], + nested_types=[_DETECTLANGUAGEREQUEST_LABELSENTRY], enum_types=[], serialized_options=None, is_extendable=False, @@ -603,8 +757,8 @@ fields=[], ) ], - serialized_start=914, - serialized_end=1016, + serialized_start=1167, + serialized_end=1454, ) @@ -660,8 +814,8 @@ syntax="proto3", extension_ranges=[], oneofs=[], - serialized_start=1018, - serialized_end=1079, + serialized_start=1456, + serialized_end=1517, ) @@ -699,8 +853,8 @@ syntax="proto3", extension_ranges=[], oneofs=[], - serialized_start=1081, - serialized_end=1176, + serialized_start=1519, + serialized_end=1614, ) @@ -726,7 +880,9 @@ containing_type=None, is_extension=False, extension_scope=None, - serialized_options=None, + serialized_options=_b( + "\340A\002\372A#\n!locations.googleapis.com/Location" + ), file=DESCRIPTOR, ), _descriptor.FieldDescriptor( @@ -744,7 +900,7 @@ containing_type=None, is_extension=False, extension_scope=None, - serialized_options=None, + serialized_options=_b("\340A\001"), file=DESCRIPTOR, ), _descriptor.FieldDescriptor( @@ -762,7 +918,7 @@ containing_type=None, is_extension=False, extension_scope=None, - serialized_options=None, + serialized_options=_b("\340A\001"), file=DESCRIPTOR, ), ], @@ -774,8 +930,8 @@ syntax="proto3", extension_ranges=[], oneofs=[], - serialized_start=1178, - serialized_end=1270, + serialized_start=1617, + serialized_end=1762, ) @@ -813,8 +969,8 @@ syntax="proto3", extension_ranges=[], oneofs=[], - serialized_start=1272, - serialized_end=1364, + serialized_start=1764, + serialized_end=1856, ) @@ -906,8 +1062,8 @@ syntax="proto3", extension_ranges=[], oneofs=[], - serialized_start=1366, - serialized_end=1478, + serialized_start=1858, + serialized_end=1970, ) @@ -933,7 +1089,7 @@ containing_type=None, is_extension=False, extension_scope=None, - serialized_options=None, + serialized_options=_b("\340A\002"), file=DESCRIPTOR, ) ], @@ -945,8 +1101,8 @@ syntax="proto3", extension_ranges=[], oneofs=[], - serialized_start=1480, - serialized_end=1510, + serialized_start=1972, + serialized_end=2007, ) @@ -972,7 +1128,7 @@ containing_type=None, is_extension=False, extension_scope=None, - serialized_options=None, + serialized_options=_b("\340A\001"), file=DESCRIPTOR, ), _descriptor.FieldDescriptor( @@ -1010,8 +1166,8 @@ fields=[], ) ], - serialized_start=1512, - serialized_end=1621, + serialized_start=2009, + serialized_end=2123, ) @@ -1037,7 +1193,7 @@ containing_type=None, is_extension=False, extension_scope=None, - serialized_options=None, + serialized_options=_b("\340A\002"), file=DESCRIPTOR, ) ], @@ -1049,8 +1205,8 @@ syntax="proto3", extension_ranges=[], oneofs=[], - serialized_start=1623, - serialized_end=1666, + serialized_start=2125, + serialized_end=2173, ) @@ -1096,8 +1252,8 @@ fields=[], ) ], - serialized_start=1668, - serialized_end=1774, + serialized_start=2175, + serialized_end=2281, ) @@ -1153,8 +1309,8 @@ syntax="proto3", extension_ranges=[], oneofs=[], - serialized_start=2210, - serialized_end=2255, + serialized_start=2884, + serialized_end=2929, ) _BATCHTRANSLATETEXTREQUEST_GLOSSARIESENTRY = _descriptor.Descriptor( @@ -1209,8 +1365,64 @@ syntax="proto3", extension_ranges=[], oneofs=[], - serialized_start=2257, - serialized_end=2369, + serialized_start=2931, + serialized_end=3043, +) + +_BATCHTRANSLATETEXTREQUEST_LABELSENTRY = _descriptor.Descriptor( + name="LabelsEntry", + full_name="google.cloud.translation.v3beta1.BatchTranslateTextRequest.LabelsEntry", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="key", + full_name="google.cloud.translation.v3beta1.BatchTranslateTextRequest.LabelsEntry.key", + index=0, + number=1, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="value", + full_name="google.cloud.translation.v3beta1.BatchTranslateTextRequest.LabelsEntry.value", + index=1, + number=2, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=_b("8\001"), + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=770, + serialized_end=815, ) _BATCHTRANSLATETEXTREQUEST = _descriptor.Descriptor( @@ -1235,7 +1447,9 @@ containing_type=None, is_extension=False, extension_scope=None, - serialized_options=None, + serialized_options=_b( + "\340A\002\372A#\n!locations.googleapis.com/Location" + ), file=DESCRIPTOR, ), _descriptor.FieldDescriptor( @@ -1253,7 +1467,7 @@ containing_type=None, is_extension=False, extension_scope=None, - serialized_options=None, + serialized_options=_b("\340A\002"), file=DESCRIPTOR, ), _descriptor.FieldDescriptor( @@ -1271,7 +1485,7 @@ containing_type=None, is_extension=False, extension_scope=None, - serialized_options=None, + serialized_options=_b("\340A\002"), file=DESCRIPTOR, ), _descriptor.FieldDescriptor( @@ -1289,7 +1503,7 @@ containing_type=None, is_extension=False, extension_scope=None, - serialized_options=None, + serialized_options=_b("\340A\001"), file=DESCRIPTOR, ), _descriptor.FieldDescriptor( @@ -1307,7 +1521,7 @@ containing_type=None, is_extension=False, extension_scope=None, - serialized_options=None, + serialized_options=_b("\340A\002"), file=DESCRIPTOR, ), _descriptor.FieldDescriptor( @@ -1325,7 +1539,7 @@ containing_type=None, is_extension=False, extension_scope=None, - serialized_options=None, + serialized_options=_b("\340A\002"), file=DESCRIPTOR, ), _descriptor.FieldDescriptor( @@ -1343,7 +1557,25 @@ containing_type=None, is_extension=False, extension_scope=None, - serialized_options=None, + serialized_options=_b("\340A\001"), + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="labels", + full_name="google.cloud.translation.v3beta1.BatchTranslateTextRequest.labels", + index=7, + number=9, + type=11, + cpp_type=10, + label=3, + has_default_value=False, + default_value=[], + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=_b("\340A\001"), file=DESCRIPTOR, ), ], @@ -1351,6 +1583,7 @@ nested_types=[ _BATCHTRANSLATETEXTREQUEST_MODELSENTRY, _BATCHTRANSLATETEXTREQUEST_GLOSSARIESENTRY, + _BATCHTRANSLATETEXTREQUEST_LABELSENTRY, ], enum_types=[], serialized_options=None, @@ -1358,8 +1591,8 @@ syntax="proto3", extension_ranges=[], oneofs=[], - serialized_start=1777, - serialized_end=2369, + serialized_start=2284, + serialized_end=3090, ) @@ -1469,8 +1702,8 @@ syntax="proto3", extension_ranges=[], oneofs=[], - serialized_start=2372, - serialized_end=2711, + serialized_start=3093, + serialized_end=3432, ) @@ -1580,8 +1813,8 @@ syntax="proto3", extension_ranges=[], oneofs=[], - serialized_start=2714, - serialized_end=2917, + serialized_start=3435, + serialized_end=3638, ) @@ -1627,8 +1860,8 @@ fields=[], ) ], - serialized_start=2919, - serialized_end=3017, + serialized_start=3640, + serialized_end=3738, ) @@ -1684,8 +1917,8 @@ syntax="proto3", extension_ranges=[], oneofs=[], - serialized_start=3416, - serialized_end=3494, + serialized_start=4157, + serialized_end=4235, ) _GLOSSARY_LANGUAGECODESSET = _descriptor.Descriptor( @@ -1722,8 +1955,8 @@ syntax="proto3", extension_ranges=[], oneofs=[], - serialized_start=3496, - serialized_end=3538, + serialized_start=4237, + serialized_end=4279, ) _GLOSSARY = _descriptor.Descriptor( @@ -1748,7 +1981,7 @@ containing_type=None, is_extension=False, extension_scope=None, - serialized_options=None, + serialized_options=_b("\340A\002"), file=DESCRIPTOR, ), _descriptor.FieldDescriptor( @@ -1820,7 +2053,7 @@ containing_type=None, is_extension=False, extension_scope=None, - serialized_options=None, + serialized_options=_b("\340A\003"), file=DESCRIPTOR, ), _descriptor.FieldDescriptor( @@ -1838,7 +2071,7 @@ containing_type=None, is_extension=False, extension_scope=None, - serialized_options=None, + serialized_options=_b("\340A\003"), file=DESCRIPTOR, ), _descriptor.FieldDescriptor( @@ -1856,14 +2089,16 @@ containing_type=None, is_extension=False, extension_scope=None, - serialized_options=None, + serialized_options=_b("\340A\003"), file=DESCRIPTOR, ), ], extensions=[], nested_types=[_GLOSSARY_LANGUAGECODEPAIR, _GLOSSARY_LANGUAGECODESSET], enum_types=[], - serialized_options=None, + serialized_options=_b( + "\352Ab\n!translate.googleapis.com/Glossary\022=projects/{project}/locations/{location}/glossaries/{glossary}" + ), is_extendable=False, syntax="proto3", extension_ranges=[], @@ -1876,8 +2111,8 @@ fields=[], ) ], - serialized_start=3020, - serialized_end=3551, + serialized_start=3741, + serialized_end=4395, ) @@ -1903,7 +2138,9 @@ containing_type=None, is_extension=False, extension_scope=None, - serialized_options=None, + serialized_options=_b( + "\340A\002\372A#\n!locations.googleapis.com/Location" + ), file=DESCRIPTOR, ), _descriptor.FieldDescriptor( @@ -1921,7 +2158,7 @@ containing_type=None, is_extension=False, extension_scope=None, - serialized_options=None, + serialized_options=_b("\340A\002"), file=DESCRIPTOR, ), ], @@ -1933,8 +2170,8 @@ syntax="proto3", extension_ranges=[], oneofs=[], - serialized_start=3553, - serialized_end=3654, + serialized_start=4398, + serialized_end=4547, ) @@ -1960,7 +2197,9 @@ containing_type=None, is_extension=False, extension_scope=None, - serialized_options=None, + serialized_options=_b( + "\340A\002\372A#\n!translate.googleapis.com/Glossary" + ), file=DESCRIPTOR, ) ], @@ -1972,8 +2211,8 @@ syntax="proto3", extension_ranges=[], oneofs=[], - serialized_start=3656, - serialized_end=3690, + serialized_start=4549, + serialized_end=4626, ) @@ -1999,7 +2238,9 @@ containing_type=None, is_extension=False, extension_scope=None, - serialized_options=None, + serialized_options=_b( + "\340A\002\372A#\n!translate.googleapis.com/Glossary" + ), file=DESCRIPTOR, ) ], @@ -2011,8 +2252,8 @@ syntax="proto3", extension_ranges=[], oneofs=[], - serialized_start=3692, - serialized_end=3729, + serialized_start=4628, + serialized_end=4708, ) @@ -2038,7 +2279,9 @@ containing_type=None, is_extension=False, extension_scope=None, - serialized_options=None, + serialized_options=_b( + "\340A\002\372A#\n!locations.googleapis.com/Location" + ), file=DESCRIPTOR, ), _descriptor.FieldDescriptor( @@ -2056,7 +2299,7 @@ containing_type=None, is_extension=False, extension_scope=None, - serialized_options=None, + serialized_options=_b("\340A\001"), file=DESCRIPTOR, ), _descriptor.FieldDescriptor( @@ -2074,7 +2317,7 @@ containing_type=None, is_extension=False, extension_scope=None, - serialized_options=None, + serialized_options=_b("\340A\001"), file=DESCRIPTOR, ), _descriptor.FieldDescriptor( @@ -2092,7 +2335,7 @@ containing_type=None, is_extension=False, extension_scope=None, - serialized_options=None, + serialized_options=_b("\340A\001"), file=DESCRIPTOR, ), ], @@ -2104,8 +2347,8 @@ syntax="proto3", extension_ranges=[], oneofs=[], - serialized_start=3731, - serialized_end=3825, + serialized_start=4711, + serialized_end=4863, ) @@ -2161,8 +2404,8 @@ syntax="proto3", extension_ranges=[], oneofs=[], - serialized_start=3827, - serialized_end=3940, + serialized_start=4865, + serialized_end=4978, ) @@ -2236,8 +2479,8 @@ syntax="proto3", extension_ranges=[], oneofs=[], - serialized_start=3943, - serialized_end=4212, + serialized_start=4981, + serialized_end=5250, ) @@ -2311,8 +2554,8 @@ syntax="proto3", extension_ranges=[], oneofs=[], - serialized_start=4215, - serialized_end=4484, + serialized_start=5253, + serialized_end=5522, ) @@ -2386,13 +2629,17 @@ syntax="proto3", extension_ranges=[], oneofs=[], - serialized_start=4487, - serialized_end=4620, + serialized_start=5525, + serialized_end=5658, ) +_TRANSLATETEXTREQUEST_LABELSENTRY.containing_type = _TRANSLATETEXTREQUEST _TRANSLATETEXTREQUEST.fields_by_name[ "glossary_config" ].message_type = _TRANSLATETEXTGLOSSARYCONFIG +_TRANSLATETEXTREQUEST.fields_by_name[ + "labels" +].message_type = _TRANSLATETEXTREQUEST_LABELSENTRY _TRANSLATETEXTRESPONSE.fields_by_name["translations"].message_type = _TRANSLATION _TRANSLATETEXTRESPONSE.fields_by_name[ "glossary_translations" @@ -2400,6 +2647,10 @@ _TRANSLATION.fields_by_name[ "glossary_config" ].message_type = _TRANSLATETEXTGLOSSARYCONFIG +_DETECTLANGUAGEREQUEST_LABELSENTRY.containing_type = _DETECTLANGUAGEREQUEST +_DETECTLANGUAGEREQUEST.fields_by_name[ + "labels" +].message_type = _DETECTLANGUAGEREQUEST_LABELSENTRY _DETECTLANGUAGEREQUEST.oneofs_by_name["source"].fields.append( _DETECTLANGUAGEREQUEST.fields_by_name["content"] ) @@ -2427,6 +2678,7 @@ "value" ].message_type = _TRANSLATETEXTGLOSSARYCONFIG _BATCHTRANSLATETEXTREQUEST_GLOSSARIESENTRY.containing_type = _BATCHTRANSLATETEXTREQUEST +_BATCHTRANSLATETEXTREQUEST_LABELSENTRY.containing_type = _BATCHTRANSLATETEXTREQUEST _BATCHTRANSLATETEXTREQUEST.fields_by_name[ "models" ].message_type = _BATCHTRANSLATETEXTREQUEST_MODELSENTRY @@ -2435,6 +2687,9 @@ _BATCHTRANSLATETEXTREQUEST.fields_by_name[ "glossaries" ].message_type = _BATCHTRANSLATETEXTREQUEST_GLOSSARIESENTRY +_BATCHTRANSLATETEXTREQUEST.fields_by_name[ + "labels" +].message_type = _BATCHTRANSLATETEXTREQUEST_LABELSENTRY _BATCHTRANSLATEMETADATA.fields_by_name[ "state" ].enum_type = _BATCHTRANSLATEMETADATA_STATE @@ -2562,6 +2817,15 @@ "TranslateTextRequest", (_message.Message,), dict( + LabelsEntry=_reflection.GeneratedProtocolMessageType( + "LabelsEntry", + (_message.Message,), + dict( + DESCRIPTOR=_TRANSLATETEXTREQUEST_LABELSENTRY, + __module__="google.cloud.translation_v3beta1.proto.translation_service_pb2" + # @@protoc_insertion_point(class_scope:google.cloud.translation.v3beta1.TranslateTextRequest.LabelsEntry) + ), + ), DESCRIPTOR=_TRANSLATETEXTREQUEST, __module__="google.cloud.translation_v3beta1.proto.translation_service_pb2", __doc__="""The request message for synchronous translation. @@ -2588,9 +2852,12 @@ the input text, set to one of the language codes listed in Language Support. parent: - Required. Location to make a regional or global call. Format: + Required. Project or location to make a call. Must refer to a + caller's project. Format: ``projects/{project-id}`` or ``projects/{project-id}/locations/{location-id}``. For global - calls, use ``projects/{project-id}/locations/global``. Models + calls, use ``projects/{project-id}/locations/global`` or + ``projects/{project-id}``. Non-global location is required + for requests using AutoML models or custom glossaries. Models and glossaries must be within the same region (have same location-id), otherwise an INVALID\_ARGUMENT (400) error is returned. @@ -2610,11 +2877,21 @@ Optional. Glossary to be applied. The glossary must be within the same region (have the same location-id) as the model, otherwise an INVALID\_ARGUMENT (400) error is returned. + labels: + Optional. The labels with user-defined metadata for the + request. Label keys and values can be no longer than 63 + characters (Unicode codepoints), can only contain lowercase + letters, numeric characters, underscores and dashes. + International characters are allowed. Label values are + optional. Label keys must start with a letter. See + https://cloud.google.com/translate/docs/labels for more + information. """, # @@protoc_insertion_point(class_scope:google.cloud.translation.v3beta1.TranslateTextRequest) ), ) _sym_db.RegisterMessage(TranslateTextRequest) +_sym_db.RegisterMessage(TranslateTextRequest.LabelsEntry) TranslateTextResponse = _reflection.GeneratedProtocolMessageType( "TranslateTextResponse", @@ -2672,6 +2949,15 @@ "DetectLanguageRequest", (_message.Message,), dict( + LabelsEntry=_reflection.GeneratedProtocolMessageType( + "LabelsEntry", + (_message.Message,), + dict( + DESCRIPTOR=_DETECTLANGUAGEREQUEST_LABELSENTRY, + __module__="google.cloud.translation_v3beta1.proto.translation_service_pb2" + # @@protoc_insertion_point(class_scope:google.cloud.translation.v3beta1.DetectLanguageRequest.LabelsEntry) + ), + ), DESCRIPTOR=_DETECTLANGUAGEREQUEST, __module__="google.cloud.translation_v3beta1.proto.translation_service_pb2", __doc__="""The request message for language detection. @@ -2679,9 +2965,11 @@ Attributes: parent: - Required. Location to make a regional or global call. Format: - ``projects/{project-id}/locations/{location-id}``. For global - calls, use ``projects/{project-id}/locations/global``. Only + Required. Project or location to make a call. Must refer to a + caller's project. Format: ``projects/{project- + id}/locations/{location-id}`` or ``projects/{project-id}``. + For global calls, use ``projects/{project- + id}/locations/global`` or ``projects/{project-id}``. Only models within the same region (has same location-id) can be used. Otherwise an INVALID\_ARGUMENT (400) error is returned. model: @@ -2701,11 +2989,21 @@ Optional. The format of the source text, for example, "text/html", "text/plain". If left blank, the MIME type defaults to "text/html". + labels: + Optional. The labels with user-defined metadata for the + request. Label keys and values can be no longer than 63 + characters (Unicode codepoints), can only contain lowercase + letters, numeric characters, underscores and dashes. + International characters are allowed. Label values are + optional. Label keys must start with a letter. See + https://cloud.google.com/translate/docs/labels for more + information. """, # @@protoc_insertion_point(class_scope:google.cloud.translation.v3beta1.DetectLanguageRequest) ), ) _sym_db.RegisterMessage(DetectLanguageRequest) +_sym_db.RegisterMessage(DetectLanguageRequest.LabelsEntry) DetectedLanguage = _reflection.GeneratedProtocolMessageType( "DetectedLanguage", @@ -2758,11 +3056,14 @@ Attributes: parent: - Required. Location to make a regional or global call. Format: + Required. Project or location to make a call. Must refer to a + caller's project. Format: ``projects/{project-id}`` or ``projects/{project-id}/locations/{location-id}``. For global - calls, use ``projects/{project-id}/locations/global``. Only - models within the same region (have same location-id) can be - used, otherwise an INVALID\_ARGUMENT (400) error is returned. + calls, use ``projects/{project-id}/locations/global`` or + ``projects/{project-id}``. Non-global location is required + for AutoML models. Only models within the same region (have + same location-id) can be used, otherwise an INVALID\_ARGUMENT + (400) error is returned. display_language_code: Optional. The language to use to return localized, human readable names of supported languages. If missing, then @@ -2896,14 +3197,15 @@ dict( DESCRIPTOR=_GCSDESTINATION, __module__="google.cloud.translation_v3beta1.proto.translation_service_pb2", - __doc__="""The Google Cloud Storage location for the output content + __doc__="""The Google Cloud Storage location for the output content. Attributes: output_uri_prefix: Required. There must be no files under 'output\_uri\_prefix'. - 'output\_uri\_prefix' must end with "/", otherwise an - INVALID\_ARGUMENT (400) error is returned.. + 'output\_uri\_prefix' must end with "/" and start with + "gs://", otherwise an INVALID\_ARGUMENT (400) error is + returned. """, # @@protoc_insertion_point(class_scope:google.cloud.translation.v3beta1.GcsDestination) ), @@ -3006,6 +3308,15 @@ # @@protoc_insertion_point(class_scope:google.cloud.translation.v3beta1.BatchTranslateTextRequest.GlossariesEntry) ), ), + LabelsEntry=_reflection.GeneratedProtocolMessageType( + "LabelsEntry", + (_message.Message,), + dict( + DESCRIPTOR=_BATCHTRANSLATETEXTREQUEST_LABELSENTRY, + __module__="google.cloud.translation_v3beta1.proto.translation_service_pb2" + # @@protoc_insertion_point(class_scope:google.cloud.translation.v3beta1.BatchTranslateTextRequest.LabelsEntry) + ), + ), DESCRIPTOR=_BATCHTRANSLATETEXTREQUEST, __module__="google.cloud.translation_v3beta1.proto.translation_service_pb2", __doc__="""The batch translation request. @@ -3013,12 +3324,12 @@ Attributes: parent: - Required. Location to make a regional call. Format: - ``projects/{project-id}/locations/{location-id}``. The - ``global`` location is not supported for batch translation. - Only AutoML Translation models or glossaries within the same - region (have the same location-id) can be used, otherwise an - INVALID\_ARGUMENT (400) error is returned. + Required. Location to make a call. Must refer to a caller's + project. Format: ``projects/{project-id}/locations/{location- + id}``. The ``global`` location is not supported for batch + translation. Only AutoML Translation models or glossaries + within the same region (have the same location-id) can be + used, otherwise an INVALID\_ARGUMENT (400) error is returned. source_language_code: Required. Source language code. target_language_codes: @@ -3046,6 +3357,15 @@ glossaries: Optional. Glossaries to be applied for translation. It's keyed by target language code. + labels: + Optional. The labels with user-defined metadata for the + request. Label keys and values can be no longer than 63 + characters (Unicode codepoints), can only contain lowercase + letters, numeric characters, underscores and dashes. + International characters are allowed. Label values are + optional. Label keys must start with a letter. See + https://cloud.google.com/translate/docs/labels for more + information. """, # @@protoc_insertion_point(class_scope:google.cloud.translation.v3beta1.BatchTranslateTextRequest) ), @@ -3053,6 +3373,7 @@ _sym_db.RegisterMessage(BatchTranslateTextRequest) _sym_db.RegisterMessage(BatchTranslateTextRequest.ModelsEntry) _sym_db.RegisterMessage(BatchTranslateTextRequest.GlossariesEntry) +_sym_db.RegisterMessage(BatchTranslateTextRequest.LabelsEntry) BatchTranslateMetadata = _reflection.GeneratedProtocolMessageType( "BatchTranslateMetadata", @@ -3419,17 +3740,62 @@ DESCRIPTOR._options = None +_TRANSLATETEXTGLOSSARYCONFIG.fields_by_name["glossary"]._options = None +_TRANSLATETEXTGLOSSARYCONFIG.fields_by_name["ignore_case"]._options = None +_TRANSLATETEXTREQUEST_LABELSENTRY._options = None +_TRANSLATETEXTREQUEST.fields_by_name["contents"]._options = None +_TRANSLATETEXTREQUEST.fields_by_name["mime_type"]._options = None +_TRANSLATETEXTREQUEST.fields_by_name["source_language_code"]._options = None +_TRANSLATETEXTREQUEST.fields_by_name["target_language_code"]._options = None +_TRANSLATETEXTREQUEST.fields_by_name["parent"]._options = None +_TRANSLATETEXTREQUEST.fields_by_name["model"]._options = None +_TRANSLATETEXTREQUEST.fields_by_name["glossary_config"]._options = None +_TRANSLATETEXTREQUEST.fields_by_name["labels"]._options = None +_DETECTLANGUAGEREQUEST_LABELSENTRY._options = None +_DETECTLANGUAGEREQUEST.fields_by_name["parent"]._options = None +_DETECTLANGUAGEREQUEST.fields_by_name["model"]._options = None +_DETECTLANGUAGEREQUEST.fields_by_name["mime_type"]._options = None +_GETSUPPORTEDLANGUAGESREQUEST.fields_by_name["parent"]._options = None +_GETSUPPORTEDLANGUAGESREQUEST.fields_by_name["display_language_code"]._options = None +_GETSUPPORTEDLANGUAGESREQUEST.fields_by_name["model"]._options = None +_GCSSOURCE.fields_by_name["input_uri"]._options = None +_INPUTCONFIG.fields_by_name["mime_type"]._options = None +_GCSDESTINATION.fields_by_name["output_uri_prefix"]._options = None _BATCHTRANSLATETEXTREQUEST_MODELSENTRY._options = None _BATCHTRANSLATETEXTREQUEST_GLOSSARIESENTRY._options = None +_BATCHTRANSLATETEXTREQUEST_LABELSENTRY._options = None +_BATCHTRANSLATETEXTREQUEST.fields_by_name["parent"]._options = None +_BATCHTRANSLATETEXTREQUEST.fields_by_name["source_language_code"]._options = None +_BATCHTRANSLATETEXTREQUEST.fields_by_name["target_language_codes"]._options = None +_BATCHTRANSLATETEXTREQUEST.fields_by_name["models"]._options = None +_BATCHTRANSLATETEXTREQUEST.fields_by_name["input_configs"]._options = None +_BATCHTRANSLATETEXTREQUEST.fields_by_name["output_config"]._options = None +_BATCHTRANSLATETEXTREQUEST.fields_by_name["glossaries"]._options = None +_BATCHTRANSLATETEXTREQUEST.fields_by_name["labels"]._options = None +_GLOSSARY.fields_by_name["name"]._options = None +_GLOSSARY.fields_by_name["entry_count"]._options = None +_GLOSSARY.fields_by_name["submit_time"]._options = None +_GLOSSARY.fields_by_name["end_time"]._options = None +_GLOSSARY._options = None +_CREATEGLOSSARYREQUEST.fields_by_name["parent"]._options = None +_CREATEGLOSSARYREQUEST.fields_by_name["glossary"]._options = None +_GETGLOSSARYREQUEST.fields_by_name["name"]._options = None +_DELETEGLOSSARYREQUEST.fields_by_name["name"]._options = None +_LISTGLOSSARIESREQUEST.fields_by_name["parent"]._options = None +_LISTGLOSSARIESREQUEST.fields_by_name["page_size"]._options = None +_LISTGLOSSARIESREQUEST.fields_by_name["page_token"]._options = None +_LISTGLOSSARIESREQUEST.fields_by_name["filter"]._options = None _TRANSLATIONSERVICE = _descriptor.ServiceDescriptor( name="TranslationService", full_name="google.cloud.translation.v3beta1.TranslationService", file=DESCRIPTOR, index=0, - serialized_options=_b("\312A\032translation.googleapis.com"), - serialized_start=4623, - serialized_end=6340, + serialized_options=_b( + "\312A\030translate.googleapis.com\322A`https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/cloud-translation" + ), + serialized_start=5661, + serialized_end=7735, methods=[ _descriptor.MethodDescriptor( name="TranslateText", @@ -3450,7 +3816,7 @@ input_type=_DETECTLANGUAGEREQUEST, output_type=_DETECTLANGUAGERESPONSE, serialized_options=_b( - '\202\323\344\223\002n"7/v3beta1/{parent=projects/*/locations/*}:detectLanguage:\001*Z0"+/v3beta1/{parent=projects/*}:detectLanguage:\001*' + '\202\323\344\223\002n"7/v3beta1/{parent=projects/*/locations/*}:detectLanguage:\001*Z0"+/v3beta1/{parent=projects/*}:detectLanguage:\001*\332A\026parent,model,mime_type' ), ), _descriptor.MethodDescriptor( @@ -3461,7 +3827,7 @@ input_type=_GETSUPPORTEDLANGUAGESREQUEST, output_type=_SUPPORTEDLANGUAGES, serialized_options=_b( - "\202\323\344\223\002p\022;/v3beta1/{parent=projects/*/locations/*}/supportedLanguagesZ1\022//v3beta1/{parent=projects/*}/supportedLanguages" + '\202\323\344\223\002p\022;/v3beta1/{parent=projects/*/locations/*}/supportedLanguagesZ1\022//v3beta1/{parent=projects/*}/supportedLanguages\332A"parent,display_language_code,model' ), ), _descriptor.MethodDescriptor( @@ -3472,7 +3838,7 @@ input_type=_BATCHTRANSLATETEXTREQUEST, output_type=google_dot_longrunning_dot_operations__pb2._OPERATION, serialized_options=_b( - '\202\323\344\223\002@";/v3beta1/{parent=projects/*/locations/*}:batchTranslateText:\001*' + '\202\323\344\223\002@";/v3beta1/{parent=projects/*/locations/*}:batchTranslateText:\001*\312A0\n\026BatchTranslateResponse\022\026BatchTranslateMetadata' ), ), _descriptor.MethodDescriptor( @@ -3483,7 +3849,7 @@ input_type=_CREATEGLOSSARYREQUEST, output_type=google_dot_longrunning_dot_operations__pb2._OPERATION, serialized_options=_b( - '\202\323\344\223\002?"3/v3beta1/{parent=projects/*/locations/*}/glossaries:\010glossary' + '\202\323\344\223\002?"3/v3beta1/{parent=projects/*/locations/*}/glossaries:\010glossary\332A\017parent,glossary\312A"\n\010Glossary\022\026CreateGlossaryMetadata' ), ), _descriptor.MethodDescriptor( @@ -3494,7 +3860,7 @@ input_type=_LISTGLOSSARIESREQUEST, output_type=_LISTGLOSSARIESRESPONSE, serialized_options=_b( - "\202\323\344\223\0025\0223/v3beta1/{parent=projects/*/locations/*}/glossaries" + "\202\323\344\223\0025\0223/v3beta1/{parent=projects/*/locations/*}/glossaries\332A\006parent\332A\rparent,filter" ), ), _descriptor.MethodDescriptor( @@ -3505,7 +3871,7 @@ input_type=_GETGLOSSARYREQUEST, output_type=_GLOSSARY, serialized_options=_b( - "\202\323\344\223\0025\0223/v3beta1/{name=projects/*/locations/*/glossaries/*}" + "\202\323\344\223\0025\0223/v3beta1/{name=projects/*/locations/*/glossaries/*}\332A\004name" ), ), _descriptor.MethodDescriptor( @@ -3516,7 +3882,7 @@ input_type=_DELETEGLOSSARYREQUEST, output_type=google_dot_longrunning_dot_operations__pb2._OPERATION, serialized_options=_b( - "\202\323\344\223\0025*3/v3beta1/{name=projects/*/locations/*/glossaries/*}" + "\202\323\344\223\0025*3/v3beta1/{name=projects/*/locations/*/glossaries/*}\332A\004name\312A0\n\026DeleteGlossaryResponse\022\026DeleteGlossaryMetadata" ), ), ], diff --git a/setup.py b/setup.py index 1f5339e7..82c5b394 100644 --- a/setup.py +++ b/setup.py @@ -22,15 +22,15 @@ name = "google-cloud-translate" description = "Google Cloud Translation API client library" -version = "1.6.0" +version = "1.7.0" # Should be one of: # 'Development Status :: 3 - Alpha' # 'Development Status :: 4 - Beta' # 'Development Status :: 5 - Production/Stable' release_status = "Development Status :: 5 - Production/Stable" dependencies = [ - "google-api-core[grpc] >= 1.6.0, < 2.0.0dev", - "google-cloud-core >= 1.0.0, < 2.0dev", + "google-api-core[grpc] >= 1.14.0, < 2.0.0dev", + "google-cloud-core >= 1.0.3, < 2.0dev", ] extras = {} diff --git a/synth.metadata b/synth.metadata index 93a6302d..fe995d41 100644 --- a/synth.metadata +++ b/synth.metadata @@ -1,19 +1,19 @@ { - "updateTime": "2019-07-03T12:43:20.608285Z", + "updateTime": "2019-10-05T12:42:06.391804Z", "sources": [ { "generator": { "name": "artman", - "version": "0.29.3", - "dockerImage": "googleapis/artman@sha256:8900f94a81adaab0238965aa8a7b3648791f4f3a95ee65adc6a56cfcc3753101" + "version": "0.38.0", + "dockerImage": "googleapis/artman@sha256:0d2f8d429110aeb8d82df6550ef4ede59d40df9062d260a1580fce688b0512bf" } }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "69916b6ffbb7717fa009033351777d0c9909fb79", - "internalRef": "256241904" + "sha": "ceb8e2fb12f048cc94caae532ef0b4cf026a78f3", + "internalRef": "272971705" } }, { @@ -34,6 +34,16 @@ "generator": "gapic", "config": "google/cloud/translate/artman_translate_v3beta1.yaml" } + }, + { + "client": { + "source": "googleapis", + "apiName": "translate", + "apiVersion": "v3", + "language": "python", + "generator": "gapic", + "config": "google/cloud/translate/artman_translate_v3.yaml" + } } ] } \ No newline at end of file diff --git a/synth.py b/synth.py index dd81273a..f9f3dbc9 100644 --- a/synth.py +++ b/synth.py @@ -19,7 +19,7 @@ gapic = gcp.GAPICGenerator() common = gcp.CommonTemplates() -versions = ["v3beta1"] +versions = ["v3beta1", "v3"] excludes = [ "setup.py", @@ -41,12 +41,12 @@ s.move(library / "tests") s.move(library / f"docs/gapic/{version}") -# translation -> translate -s.replace( - "google/**/translation_service_pb2_grpc.py", - "google.cloud.translation_v3beta1.proto", - "google.cloud.translate_v3beta1.proto", -) + # translation -> translate + s.replace( + "google/**/translation_service_pb2_grpc.py", + f"google.cloud.translation_{version}.proto", + f"google.cloud.translate_{version}.proto", + ) s.replace( "google/cloud/**/translation_service_pb2.py", diff --git a/tests/unit/gapic/v3/test_translation_service_client_v3.py b/tests/unit/gapic/v3/test_translation_service_client_v3.py new file mode 100644 index 00000000..16180aac --- /dev/null +++ b/tests/unit/gapic/v3/test_translation_service_client_v3.py @@ -0,0 +1,470 @@ +# -*- coding: utf-8 -*- +# +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""Unit tests.""" + +import mock +import pytest + +from google.rpc import status_pb2 + +from google.cloud import translate_v3 +from google.cloud.translate_v3.proto import translation_service_pb2 +from google.longrunning import operations_pb2 + + +class MultiCallableStub(object): + """Stub for the grpc.UnaryUnaryMultiCallable interface.""" + + def __init__(self, method, channel_stub): + self.method = method + self.channel_stub = channel_stub + + def __call__(self, request, timeout=None, metadata=None, credentials=None): + self.channel_stub.requests.append((self.method, request)) + + response = None + if self.channel_stub.responses: + response = self.channel_stub.responses.pop() + + if isinstance(response, Exception): + raise response + + if response: + return response + + +class ChannelStub(object): + """Stub for the grpc.Channel interface.""" + + def __init__(self, responses=[]): + self.responses = responses + self.requests = [] + + def unary_unary(self, method, request_serializer=None, response_deserializer=None): + return MultiCallableStub(method, self) + + +class CustomException(Exception): + pass + + +class TestTranslationServiceClient(object): + def test_translate_text(self): + # Setup Expected Response + expected_response = {} + expected_response = translation_service_pb2.TranslateTextResponse( + **expected_response + ) + + # Mock the API response + channel = ChannelStub(responses=[expected_response]) + patch = mock.patch("google.api_core.grpc_helpers.create_channel") + with patch as create_channel: + create_channel.return_value = channel + client = translate_v3.TranslationServiceClient() + + # Setup Request + contents = [] + target_language_code = "targetLanguageCode1323228230" + parent = client.location_path("[PROJECT]", "[LOCATION]") + + response = client.translate_text(contents, target_language_code, parent) + assert expected_response == response + + assert len(channel.requests) == 1 + expected_request = translation_service_pb2.TranslateTextRequest( + contents=contents, target_language_code=target_language_code, parent=parent + ) + actual_request = channel.requests[0][1] + assert expected_request == actual_request + + def test_translate_text_exception(self): + # Mock the API response + channel = ChannelStub(responses=[CustomException()]) + patch = mock.patch("google.api_core.grpc_helpers.create_channel") + with patch as create_channel: + create_channel.return_value = channel + client = translate_v3.TranslationServiceClient() + + # Setup request + contents = [] + target_language_code = "targetLanguageCode1323228230" + parent = client.location_path("[PROJECT]", "[LOCATION]") + + with pytest.raises(CustomException): + client.translate_text(contents, target_language_code, parent) + + def test_detect_language(self): + # Setup Expected Response + expected_response = {} + expected_response = translation_service_pb2.DetectLanguageResponse( + **expected_response + ) + + # Mock the API response + channel = ChannelStub(responses=[expected_response]) + patch = mock.patch("google.api_core.grpc_helpers.create_channel") + with patch as create_channel: + create_channel.return_value = channel + client = translate_v3.TranslationServiceClient() + + # Setup Request + parent = client.location_path("[PROJECT]", "[LOCATION]") + + response = client.detect_language(parent) + assert expected_response == response + + assert len(channel.requests) == 1 + expected_request = translation_service_pb2.DetectLanguageRequest(parent=parent) + actual_request = channel.requests[0][1] + assert expected_request == actual_request + + def test_detect_language_exception(self): + # Mock the API response + channel = ChannelStub(responses=[CustomException()]) + patch = mock.patch("google.api_core.grpc_helpers.create_channel") + with patch as create_channel: + create_channel.return_value = channel + client = translate_v3.TranslationServiceClient() + + # Setup request + parent = client.location_path("[PROJECT]", "[LOCATION]") + + with pytest.raises(CustomException): + client.detect_language(parent) + + def test_get_supported_languages(self): + # Setup Expected Response + expected_response = {} + expected_response = translation_service_pb2.SupportedLanguages( + **expected_response + ) + + # Mock the API response + channel = ChannelStub(responses=[expected_response]) + patch = mock.patch("google.api_core.grpc_helpers.create_channel") + with patch as create_channel: + create_channel.return_value = channel + client = translate_v3.TranslationServiceClient() + + # Setup Request + parent = client.location_path("[PROJECT]", "[LOCATION]") + + response = client.get_supported_languages(parent) + assert expected_response == response + + assert len(channel.requests) == 1 + expected_request = translation_service_pb2.GetSupportedLanguagesRequest( + parent=parent + ) + actual_request = channel.requests[0][1] + assert expected_request == actual_request + + def test_get_supported_languages_exception(self): + # Mock the API response + channel = ChannelStub(responses=[CustomException()]) + patch = mock.patch("google.api_core.grpc_helpers.create_channel") + with patch as create_channel: + create_channel.return_value = channel + client = translate_v3.TranslationServiceClient() + + # Setup request + parent = client.location_path("[PROJECT]", "[LOCATION]") + + with pytest.raises(CustomException): + client.get_supported_languages(parent) + + def test_batch_translate_text(self): + # Setup Expected Response + total_characters = 1368640955 + translated_characters = 1337326221 + failed_characters = 1723028396 + expected_response = { + "total_characters": total_characters, + "translated_characters": translated_characters, + "failed_characters": failed_characters, + } + expected_response = translation_service_pb2.BatchTranslateResponse( + **expected_response + ) + operation = operations_pb2.Operation( + name="operations/test_batch_translate_text", done=True + ) + operation.response.Pack(expected_response) + + # Mock the API response + channel = ChannelStub(responses=[operation]) + patch = mock.patch("google.api_core.grpc_helpers.create_channel") + with patch as create_channel: + create_channel.return_value = channel + client = translate_v3.TranslationServiceClient() + + # Setup Request + parent = client.location_path("[PROJECT]", "[LOCATION]") + source_language_code = "sourceLanguageCode1687263568" + target_language_codes = [] + input_configs = [] + output_config = {} + + response = client.batch_translate_text( + parent, + source_language_code, + target_language_codes, + input_configs, + output_config, + ) + result = response.result() + assert expected_response == result + + assert len(channel.requests) == 1 + expected_request = translation_service_pb2.BatchTranslateTextRequest( + parent=parent, + source_language_code=source_language_code, + target_language_codes=target_language_codes, + input_configs=input_configs, + output_config=output_config, + ) + actual_request = channel.requests[0][1] + assert expected_request == actual_request + + def test_batch_translate_text_exception(self): + # Setup Response + error = status_pb2.Status() + operation = operations_pb2.Operation( + name="operations/test_batch_translate_text_exception", done=True + ) + operation.error.CopyFrom(error) + + # Mock the API response + channel = ChannelStub(responses=[operation]) + patch = mock.patch("google.api_core.grpc_helpers.create_channel") + with patch as create_channel: + create_channel.return_value = channel + client = translate_v3.TranslationServiceClient() + + # Setup Request + parent = client.location_path("[PROJECT]", "[LOCATION]") + source_language_code = "sourceLanguageCode1687263568" + target_language_codes = [] + input_configs = [] + output_config = {} + + response = client.batch_translate_text( + parent, + source_language_code, + target_language_codes, + input_configs, + output_config, + ) + exception = response.exception() + assert exception.errors[0] == error + + def test_create_glossary(self): + # Setup Expected Response + name = "name3373707" + entry_count = 811131134 + expected_response = {"name": name, "entry_count": entry_count} + expected_response = translation_service_pb2.Glossary(**expected_response) + operation = operations_pb2.Operation( + name="operations/test_create_glossary", done=True + ) + operation.response.Pack(expected_response) + + # Mock the API response + channel = ChannelStub(responses=[operation]) + patch = mock.patch("google.api_core.grpc_helpers.create_channel") + with patch as create_channel: + create_channel.return_value = channel + client = translate_v3.TranslationServiceClient() + + # Setup Request + parent = client.location_path("[PROJECT]", "[LOCATION]") + glossary = {} + + response = client.create_glossary(parent, glossary) + result = response.result() + assert expected_response == result + + assert len(channel.requests) == 1 + expected_request = translation_service_pb2.CreateGlossaryRequest( + parent=parent, glossary=glossary + ) + actual_request = channel.requests[0][1] + assert expected_request == actual_request + + def test_create_glossary_exception(self): + # Setup Response + error = status_pb2.Status() + operation = operations_pb2.Operation( + name="operations/test_create_glossary_exception", done=True + ) + operation.error.CopyFrom(error) + + # Mock the API response + channel = ChannelStub(responses=[operation]) + patch = mock.patch("google.api_core.grpc_helpers.create_channel") + with patch as create_channel: + create_channel.return_value = channel + client = translate_v3.TranslationServiceClient() + + # Setup Request + parent = client.location_path("[PROJECT]", "[LOCATION]") + glossary = {} + + response = client.create_glossary(parent, glossary) + exception = response.exception() + assert exception.errors[0] == error + + def test_list_glossaries(self): + # Setup Expected Response + next_page_token = "" + glossaries_element = {} + glossaries = [glossaries_element] + expected_response = { + "next_page_token": next_page_token, + "glossaries": glossaries, + } + expected_response = translation_service_pb2.ListGlossariesResponse( + **expected_response + ) + + # Mock the API response + channel = ChannelStub(responses=[expected_response]) + patch = mock.patch("google.api_core.grpc_helpers.create_channel") + with patch as create_channel: + create_channel.return_value = channel + client = translate_v3.TranslationServiceClient() + + # Setup Request + parent = client.location_path("[PROJECT]", "[LOCATION]") + + paged_list_response = client.list_glossaries(parent) + resources = list(paged_list_response) + assert len(resources) == 1 + + assert expected_response.glossaries[0] == resources[0] + + assert len(channel.requests) == 1 + expected_request = translation_service_pb2.ListGlossariesRequest(parent=parent) + actual_request = channel.requests[0][1] + assert expected_request == actual_request + + def test_list_glossaries_exception(self): + channel = ChannelStub(responses=[CustomException()]) + patch = mock.patch("google.api_core.grpc_helpers.create_channel") + with patch as create_channel: + create_channel.return_value = channel + client = translate_v3.TranslationServiceClient() + + # Setup request + parent = client.location_path("[PROJECT]", "[LOCATION]") + + paged_list_response = client.list_glossaries(parent) + with pytest.raises(CustomException): + list(paged_list_response) + + def test_get_glossary(self): + # Setup Expected Response + name_2 = "name2-1052831874" + entry_count = 811131134 + expected_response = {"name": name_2, "entry_count": entry_count} + expected_response = translation_service_pb2.Glossary(**expected_response) + + # Mock the API response + channel = ChannelStub(responses=[expected_response]) + patch = mock.patch("google.api_core.grpc_helpers.create_channel") + with patch as create_channel: + create_channel.return_value = channel + client = translate_v3.TranslationServiceClient() + + # Setup Request + name = client.glossary_path("[PROJECT]", "[LOCATION]", "[GLOSSARY]") + + response = client.get_glossary(name) + assert expected_response == response + + assert len(channel.requests) == 1 + expected_request = translation_service_pb2.GetGlossaryRequest(name=name) + actual_request = channel.requests[0][1] + assert expected_request == actual_request + + def test_get_glossary_exception(self): + # Mock the API response + channel = ChannelStub(responses=[CustomException()]) + patch = mock.patch("google.api_core.grpc_helpers.create_channel") + with patch as create_channel: + create_channel.return_value = channel + client = translate_v3.TranslationServiceClient() + + # Setup request + name = client.glossary_path("[PROJECT]", "[LOCATION]", "[GLOSSARY]") + + with pytest.raises(CustomException): + client.get_glossary(name) + + def test_delete_glossary(self): + # Setup Expected Response + name_2 = "name2-1052831874" + expected_response = {"name": name_2} + expected_response = translation_service_pb2.DeleteGlossaryResponse( + **expected_response + ) + operation = operations_pb2.Operation( + name="operations/test_delete_glossary", done=True + ) + operation.response.Pack(expected_response) + + # Mock the API response + channel = ChannelStub(responses=[operation]) + patch = mock.patch("google.api_core.grpc_helpers.create_channel") + with patch as create_channel: + create_channel.return_value = channel + client = translate_v3.TranslationServiceClient() + + # Setup Request + name = client.glossary_path("[PROJECT]", "[LOCATION]", "[GLOSSARY]") + + response = client.delete_glossary(name) + result = response.result() + assert expected_response == result + + assert len(channel.requests) == 1 + expected_request = translation_service_pb2.DeleteGlossaryRequest(name=name) + actual_request = channel.requests[0][1] + assert expected_request == actual_request + + def test_delete_glossary_exception(self): + # Setup Response + error = status_pb2.Status() + operation = operations_pb2.Operation( + name="operations/test_delete_glossary_exception", done=True + ) + operation.error.CopyFrom(error) + + # Mock the API response + channel = ChannelStub(responses=[operation]) + patch = mock.patch("google.api_core.grpc_helpers.create_channel") + with patch as create_channel: + create_channel.return_value = channel + client = translate_v3.TranslationServiceClient() + + # Setup Request + name = client.glossary_path("[PROJECT]", "[LOCATION]", "[GLOSSARY]") + + response = client.delete_glossary(name) + exception = response.exception() + assert exception.errors[0] == error diff --git a/tests/unit/gapic/v3beta1/test_translation_service_client_v3beta1.py b/tests/unit/gapic/v3beta1/test_translation_service_client_v3beta1.py index c4d45f92..6bd32d82 100644 --- a/tests/unit/gapic/v3beta1/test_translation_service_client_v3beta1.py +++ b/tests/unit/gapic/v3beta1/test_translation_service_client_v3beta1.py @@ -80,13 +80,14 @@ def test_translate_text(self): # Setup Request contents = [] target_language_code = "targetLanguageCode1323228230" + parent = client.location_path("[PROJECT]", "[LOCATION]") - response = client.translate_text(contents, target_language_code) + response = client.translate_text(contents, target_language_code, parent) assert expected_response == response assert len(channel.requests) == 1 expected_request = translation_service_pb2.TranslateTextRequest( - contents=contents, target_language_code=target_language_code + contents=contents, target_language_code=target_language_code, parent=parent ) actual_request = channel.requests[0][1] assert expected_request == actual_request @@ -102,9 +103,10 @@ def test_translate_text_exception(self): # Setup request contents = [] target_language_code = "targetLanguageCode1323228230" + parent = client.location_path("[PROJECT]", "[LOCATION]") with pytest.raises(CustomException): - client.translate_text(contents, target_language_code) + client.translate_text(contents, target_language_code, parent) def test_detect_language(self): # Setup Expected Response @@ -120,11 +122,14 @@ def test_detect_language(self): create_channel.return_value = channel client = translate_v3beta1.TranslationServiceClient() - response = client.detect_language() + # Setup Request + parent = client.location_path("[PROJECT]", "[LOCATION]") + + response = client.detect_language(parent) assert expected_response == response assert len(channel.requests) == 1 - expected_request = translation_service_pb2.DetectLanguageRequest() + expected_request = translation_service_pb2.DetectLanguageRequest(parent=parent) actual_request = channel.requests[0][1] assert expected_request == actual_request @@ -136,8 +141,11 @@ def test_detect_language_exception(self): create_channel.return_value = channel client = translate_v3beta1.TranslationServiceClient() + # Setup request + parent = client.location_path("[PROJECT]", "[LOCATION]") + with pytest.raises(CustomException): - client.detect_language() + client.detect_language(parent) def test_get_supported_languages(self): # Setup Expected Response @@ -153,11 +161,16 @@ def test_get_supported_languages(self): create_channel.return_value = channel client = translate_v3beta1.TranslationServiceClient() - response = client.get_supported_languages() + # Setup Request + parent = client.location_path("[PROJECT]", "[LOCATION]") + + response = client.get_supported_languages(parent) assert expected_response == response assert len(channel.requests) == 1 - expected_request = translation_service_pb2.GetSupportedLanguagesRequest() + expected_request = translation_service_pb2.GetSupportedLanguagesRequest( + parent=parent + ) actual_request = channel.requests[0][1] assert expected_request == actual_request @@ -169,8 +182,11 @@ def test_get_supported_languages_exception(self): create_channel.return_value = channel client = translate_v3beta1.TranslationServiceClient() + # Setup request + parent = client.location_path("[PROJECT]", "[LOCATION]") + with pytest.raises(CustomException): - client.get_supported_languages() + client.get_supported_languages(parent) def test_batch_translate_text(self): # Setup Expected Response @@ -198,19 +214,25 @@ def test_batch_translate_text(self): client = translate_v3beta1.TranslationServiceClient() # Setup Request + parent = client.location_path("[PROJECT]", "[LOCATION]") source_language_code = "sourceLanguageCode1687263568" target_language_codes = [] input_configs = [] output_config = {} response = client.batch_translate_text( - source_language_code, target_language_codes, input_configs, output_config + parent, + source_language_code, + target_language_codes, + input_configs, + output_config, ) result = response.result() assert expected_response == result assert len(channel.requests) == 1 expected_request = translation_service_pb2.BatchTranslateTextRequest( + parent=parent, source_language_code=source_language_code, target_language_codes=target_language_codes, input_configs=input_configs, @@ -235,13 +257,18 @@ def test_batch_translate_text_exception(self): client = translate_v3beta1.TranslationServiceClient() # Setup Request + parent = client.location_path("[PROJECT]", "[LOCATION]") source_language_code = "sourceLanguageCode1687263568" target_language_codes = [] input_configs = [] output_config = {} response = client.batch_translate_text( - source_language_code, target_language_codes, input_configs, output_config + parent, + source_language_code, + target_language_codes, + input_configs, + output_config, ) exception = response.exception() assert exception.errors[0] == error @@ -322,14 +349,17 @@ def test_list_glossaries(self): create_channel.return_value = channel client = translate_v3beta1.TranslationServiceClient() - paged_list_response = client.list_glossaries() + # Setup Request + parent = client.location_path("[PROJECT]", "[LOCATION]") + + paged_list_response = client.list_glossaries(parent) resources = list(paged_list_response) assert len(resources) == 1 assert expected_response.glossaries[0] == resources[0] assert len(channel.requests) == 1 - expected_request = translation_service_pb2.ListGlossariesRequest() + expected_request = translation_service_pb2.ListGlossariesRequest(parent=parent) actual_request = channel.requests[0][1] assert expected_request == actual_request @@ -340,7 +370,10 @@ def test_list_glossaries_exception(self): create_channel.return_value = channel client = translate_v3beta1.TranslationServiceClient() - paged_list_response = client.list_glossaries() + # Setup request + parent = client.location_path("[PROJECT]", "[LOCATION]") + + paged_list_response = client.list_glossaries(parent) with pytest.raises(CustomException): list(paged_list_response) diff --git a/tests/unit/test__http.py b/tests/unit/test__http.py index d179ce33..208f207c 100644 --- a/tests/unit/test__http.py +++ b/tests/unit/test__http.py @@ -30,7 +30,21 @@ def _make_one(self, *args, **kw): def test_build_api_url_no_extra_query_params(self): conn = self._make_one(object()) URI = "/".join( - [conn.API_BASE_URL, "language", "translate", conn.API_VERSION, "foo"] + [ + conn.DEFAULT_API_ENDPOINT, + "language", + "translate", + conn.API_VERSION, + "foo", + ] + ) + self.assertEqual(conn.build_api_url("/foo"), URI) + + def test_build_api_url_w_custom_endpoint(self): + custom_endpoint = "https://foo-translation.googleapis.com" + conn = self._make_one(object(), api_endpoint=custom_endpoint) + URI = "/".join( + [custom_endpoint, "language", "translate", conn.API_VERSION, "foo"] ) self.assertEqual(conn.build_api_url("/foo"), URI) diff --git a/tests/unit/test_client.py b/tests/unit/test_client.py index e014657b..dfbc5aff 100644 --- a/tests/unit/test_client.py +++ b/tests/unit/test_client.py @@ -46,13 +46,57 @@ def test_constructor_explicit(self): target = "es" client_info = ClientInfo() client = self._make_one( - target_language=target, _http=http, client_info=client_info + target_language=target, + _http=http, + client_info=client_info, + client_options={"api_endpoint": "https://foo-translation.googleapis.com"}, ) self.assertIsInstance(client._connection, Connection) self.assertIsNone(client._connection.credentials) self.assertIs(client._connection.http, http) self.assertEqual(client.target_language, target) self.assertIs(client._connection._client_info, client_info) + self.assertEqual( + client._connection.API_BASE_URL, "https://foo-translation.googleapis.com" + ) + + def test_constructor_w_empty_client_options(self): + from google.cloud._http import ClientInfo + from google.api_core.client_options import ClientOptions + + http = object() + target = "es" + client_info = ClientInfo() + client_options = ClientOptions() + client = self._make_one( + target_language=target, + _http=http, + client_info=client_info, + client_options=client_options, + ) + self.assertEqual( + client._connection.API_BASE_URL, client._connection.DEFAULT_API_ENDPOINT + ) + + def test_constructor_w_client_options_object(self): + from google.cloud._http import ClientInfo + from google.api_core.client_options import ClientOptions + + http = object() + target = "es" + client_info = ClientInfo() + client_options = ClientOptions( + api_endpoint="https://foo-translation.googleapis.com" + ) + client = self._make_one( + target_language=target, + _http=http, + client_info=client_info, + client_options=client_options, + ) + self.assertEqual( + client._connection.API_BASE_URL, "https://foo-translation.googleapis.com" + ) def test_get_languages(self): from google.cloud.translate_v2.client import ENGLISH_ISO_639