com.google.cloud.translate.package-info Maven / Gradle / Ivy
/*
* Copyright 2016 Google Inc. All Rights Reserved.
*
* 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.
*/
/**
* A client to Google Translate.
*
* Here's a simple usage example for using google-cloud. This example shows how to detect the
* language of some text and how to translate some text. The example assumes that the
* {@code GOOGLE_API_KEY} is set and contains a valid API key. Alternatively, you can use
* {@link com.google.cloud.translate.TranslateOptions.Builder#setApiKey(java.lang.String)} to set
* the API key. For the complete source code see
*
* DetectLanguageAndTranslate.java.
*
{@code
* Translate translate = TranslateOptions.getDefaultInstance().getService();
*
* Detection detection = translate.detect("Hola");
* String detectedLanguage = detection.getLanguage();
*
* Translation translation = translate.translate(
* "World",
* TranslateOption.sourceLanguage("en"),
* TranslateOption.targetLanguage(detectedLanguage));
*
* System.out.printf("Hola %s%n", translation.getTranslatedText());
* }
*/
package com.google.cloud.translate;
© 2015 - 2025 Weber Informatics LLC | Privacy Policy