Interface GoogleMTv3API
-
- All Superinterfaces:
AutoCloseable
- All Known Implementing Classes:
GoogleMTv3APIImpl
public interface GoogleMTv3API extends AutoCloseable
Interface for Google Cloud Translation API v3 operations.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidclose()Closes the underlying client resources.List<String>getLanguages()Get the list of supported language codes.<T> List<TranslationResponse>translate(GoogleQueryBuilder<T> qb)Translate a batch of text segments.<T> TranslationResponsetranslateSingleSegment(GoogleQueryBuilder<T> qb, String sourceText)Translate a single text segment.
-
-
-
Method Detail
-
translate
<T> List<TranslationResponse> translate(GoogleQueryBuilder<T> qb) throws GoogleMTv3ErrorException
Translate a batch of text segments. * @param qb the query builder containing the segments to translate- Returns:
- list of translation responses
- Throws:
GoogleMTv3ErrorException- if an error occurs during translation
-
translateSingleSegment
<T> TranslationResponse translateSingleSegment(GoogleQueryBuilder<T> qb, String sourceText) throws GoogleMTv3ErrorException
Translate a single text segment. * @param qb the query builder for context- Parameters:
sourceText- the text to translate- Returns:
- translation response
- Throws:
GoogleMTv3ErrorException- if an error occurs during translation
-
getLanguages
List<String> getLanguages() throws GoogleMTv3ErrorException
Get the list of supported language codes. * @return list of BCP-47 language codes- Throws:
GoogleMTv3ErrorException- if an error occurs retrieving languages
-
close
void close()
Closes the underlying client resources.- Specified by:
closein interfaceAutoCloseable
-
-