Translate with one line of code Google Apps Script

function translateText() {
  var text = 'Hello world'; // Replace with the text you want to translate
  var targetLanguage = 'es'; // Replace with the target language code (e.g. 'es' for Spanish)

  var translatedText = LanguageApp.translate(text, '', targetLanguage); // Call the LanguageApp.translate() method to translate the text

  Logger.log(translatedText); // Log the translated text to the console

This code defines a function called translateText() that takes the text you want to translate and the target language as inputs. In this example, the text is “Hello world” and the target language is Spanish.

The LanguageApp.translate() method is then

WP Twitter Auto Publish Powered By :