Skip to main content
Translates text from the source language into the target language.

Syntax

Arguments

  • input: A VARCHAR expression containing the text to translate.
  • source_language: A VARCHAR expression specifying the source language. Use an empty string '' to request automatic detection.
  • target_language: A VARCHAR expression specifying the target language.
Use a language code such as en, zh, or fr, or a language name the model recognizes. Available languages depend on the model. The database has no fixed language list. For the types and default behavior of provider and model, see Common calling rules.

Return value

Returns the translated text as a nullable VARCHAR. If input evaluates to NULL, the function returns NULL. If source_language evaluates to NULL, the model detects the source language. If target_language evaluates to NULL, an empty string, or a string containing only ASCII whitespace, the function returns NULL without sending a request. All three semantic arguments are required and cannot be bare NULL literals. To detect the source language automatically, explicitly pass an empty string.

Examples