Stay organized with collections Save and categorize content based on your preferences.
LanguageAppThe Language service provides scripts a way to compute automatic translations of text.
// The code below will write "Esta es una prueba" to the log. const spanish = LanguageApp.translate('This is a test', 'en', 'es'); Logger.log(spanish);Detailed documentation
translate(text, sourceLanguage, targetLanguage)
Automatically translates some text from a source language to a destination language.
// The code below will write "Esta es una prueba" to the log. const spanish = LanguageApp.translate('This is a test', 'en', 'es'); Logger.log(spanish);
A list of language codes is available
here.
Parameters Name Type Descriptiontext
String
the text to translate sourceLanguage
String
the language code in which text is written. If it is set to the empty string, the source language code will be auto-detected targetLanguage
String
the language code to which the text should be translated Return
String
— the translated text
translate(text, sourceLanguage, targetLanguage, advancedArgs)
Automatically translates some text from a source language to a destination language.
// The code below will write "Esta es una <strong>prueba</strong>" to the log. const spanish = LanguageApp.translate( 'This is a <strong>test</strong>', 'en', 'es', {contentType: 'html'}, ); Logger.log(spanish);
A list of language codes is available
here.
Parameters Name Type Descriptiontext
String
the text to translate sourceLanguage
String
the language code in which text is written. If it is set to the empty string, the source language code will be auto-detected targetLanguage
String
the language code to which the text should be translated advancedArgs
Object
optional JavaScript object fields Advanced parameters Name Type Description contentType
String
the content type of the text; supported values are 'text' (default) and 'html' Return
String
— the translated text
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-12-02 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-12-02 UTC."],[[["The Language service automatically translates text between languages using the `translate()` method."],["You can specify the source and target languages using language codes, with auto-detection available for the source language."],["The `translate()` method supports optional advanced arguments for handling different content types like HTML."],["A comprehensive list of supported language codes can be found in the documentation."]]],[]]
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4