Search code examples
google-translate

Google Translate API Pricing and Language auto-detect Effeciency


I have the following three questions

  1. I want to use Google's API to translate text. I know that Google charges separately for translation and detection. Google translate also supports translation two ways to translate

    i) By specifying both source and target, as in https://www.googleapis.com/language/translate/v2?key=INSERT-YOUR-KEY&source=en&target=de&q=Hello%20world&q=My%20name%20is%20Jeff

    ii) By specifying just the target, where the source us auto-detected, like this https://www.googleapis.com/language/translate/v2?key=INSERT-YOUR-KEY&target=de&q=Hello%20world

My question is, if i call the API as in the second example, will I be charged for both detection and translation or just translation?

  1. Is it more efficient when you specify both source and target than when you just the target, or, are there any downsides of using the second way above?

  2. How many words should be sent to Google Translate API to detect a language reliably?

Thanks


Solution

  • I pretty much translate using the second approach most of the time (not informing to google the source language) and they only charge for the translation, not for the detection.

    However, you must be aware of the fact that, in case your source text is of the same language as your target language, google will attempt to translate it anyways, and sometimes it leads to confused results, or at least a translation which was not necessary, since you already had the text in the desired language.