Categories:

String & Binary Functions (Large Language Model)

TRANSLATE (SNOWFLAKE.CORTEX)¶

Fully qualified name: SNOWFLAKE.CORTEX.TRANSLATE

Translates the given input text from one supported language to another.

Note

This function does not transform a string given a search string and a replacement string. See the TRANSLATE function if that functionality is what you’re looking for.

Syntax¶

SNOWFLAKE.CORTEX.TRANSLATE(
    <text>, <source_language>, <target_language>)
Copy

Arguments¶

text

A string containing the text to be translated.

source_language

A string specifying the language code for the language the text is currently in. See Usage Notes for a list of supported language codes. If the source language code is an empty string, '', the source language is automatically detected.

target_language

A string specifying the language code into which the text should be translated. See Usage Notes for a list of supported language codes.

Returns¶

A string containing a translation of the original text into the target language.

Usage Notes¶

The following languages are supported by the TRANSLATE function. Use the corresponding language code for the source and target language.

Language

Code

English

'en'

French:

'fr'

German

'de'

Italian

'it'

Japanese

'ja'

Korean

'ko'

Polish

'pl'

Portuguese

'pt'

Russian

'ru'

Spanish

'es'

Swedish

'sv'

Access Control¶

Users must use a role that has been granted the SNOWFLAKE.CORTEX_USER database role. See Required Privileges for more information on granting this privilege.

Example¶

The following example translates each row of a table from English to German (in this example, review_content is a column from the reviews table):

SELECT SNOWFLAKE.CORTEX.TRANSLATE(review_content, 'en', 'de') FROM reviews LIMIT 10;
Copy