This is anothor simple tutorial using Google Apps Script.
You can use this source code into your Code.gs file to translate a text into another language.
The source code has tree variables for input text and for the two languages.
The result is put into Logs and yo can see it by using Ctr+Enter keys.
var text_input = "Automatically translates some text from a source language to a destination language.";
var source_language = "en";
var target_language = "fr";
var french = LanguageApp.translate(text_input, source_language, target_language)