Skip to content

Translate

Translate text and detect its language offline with local neural models

Connector software
Free and open source
Service credentials
Not needed
Use with an agent

Install the Orchard skill in your project to help your agent find connectors, configure them, and verify SQL results.

npx skills add Query-farm/vgi-skills --skill orchard

Copy this request into your coding agent to get started.

Use https://query.farm/products/orchard/connectors/translate/index.md to help me query Translate with DuckDB or Haybarn 2.0.1 and VGI protocol 3.4. Ask only for missing details about the result I need or whether I want local execution, self-hosting or Query Farm hosting. Check the connector's actual hosting availability, credentials and input requirements. Read one format of each needed reference and the exact object declarations before writing SQL. Use a released connector, and distinguish a saved example result from anything you actually execute. If you cannot run the query, tell me what remains to verify.

Translate text between languages

Example output · captured
Connector release
v0.5.0
Engine
2.0.1
VGI protocol
3.4.0
SELECT translate.main.translate('The quick brown fox jumps over the lazy dog.', 'es')
Result
translate.main.translate('The quick brown fox jumps over the lazy dog.', 'es')
El zorro marrón rápido salta sobre el perrito perezoso.

Quick start

Choose where to run Translate, then follow the steps below.

The connector runs alongside DuckDB or Haybarn. No Query Farm account is needed.

1. Install the vgi extension

Run this in your SQL client. On DuckDB, keep FROM query_farm on LOAD in later sessions.

setup.sql
SET allow_extension_repositories = 'allowed';

CREATE EXTENSION REPOSITORY IF NOT EXISTS query_farm
    WITH PREFIX 'https://duckdb-extensions.query.farm';

INSTALL vgi FROM query_farm;
LOAD vgi FROM query_farm;

2. Attach the connector

Attach with uvx

Needs uv. uvx builds the worker from its release tag on first attach and reuses the cached environment after that.

ATTACH 'translate' AS translate (
  TYPE vgi,
  LOCATION 'uvx --from git+https://github.com/Query-farm/[email protected] vgi-translate-worker'
);

3. Run a query

query.sql
SELECT translate.main.translate('The quick brown fox jumps over the lazy dog.', 'es')
More example queries →
Technical details
Verified connector release
v0.5.0
Engine
2.0.1
VGI protocol
3.4.0
Verified on
December 1, 2026
Release notes on GitHub
Pin a version for production

When running the connector yourself, keep a specific release until you’re ready to upgrade. Replace the ATTACH statement above with this one and follow the same extension and credential setup.

Attach with uvx

Needs uv. uvx builds the worker from its release tag on first attach and reuses the cached environment after that.

ATTACH 'translate' AS translate (
  TYPE vgi,
  LOCATION 'uvx --from git+https://github.com/Query-farm/[email protected] vgi-translate-worker'
);

Overview

Local neural machine translation and language detection for DuckDB/SQL.

Catalog

Everything translate exposes once attached — read straight from the worker's released build.

translate 1 schema
main 1 view · 3 functions

Local neural machine translation and language detection for SQL.

Schema examples (8)
Examples (8)

Translate an English sentence into Spanish (auto-detecting the source).

SELECT translate.main.translate('The quick brown fox jumps over the lazy dog.', 'es');
Result
translate.main.translate('The quick brown fox jumps over the lazy dog.', 'es')
El zorro marrón rápido salta sobre el perrito perezoso.

Translate a Spanish string back into English with an explicit source.

SELECT translate.main.translate('Hola, mundo.', 'en', 'es');

Detect the ISO 639-1 language code of a French phrase.

SELECT translate.main.detect_lang('Bonjour le monde');

Batch-translate a table of rows, projecting the id and its translation.

SELECT id, translation
FROM translate.main.translate_all((SELECT 1 AS id, 'The quick brown fox jumps over the lazy dog.' AS body), id := 'id', target := 'es', source := 'en');
4 more examples

Look up the ISO 639-1 code for a language by its English name.

SELECT code FROM translate.main.languages WHERE name = 'Spanish';

Detect the language of each message and label it with its English name from the languages reference view (returns fr/French, de/German, es/Spanish, en/English).

WITH detected AS (SELECT id, body, translate.main.detect_lang(body) AS code FROM (VALUES (1, 'Bonjour le monde, comment allez-vous ce matin?'), (2, 'Guten Morgen, wie geht es Ihnen heute?'), (3, 'Hola, mucho gusto en conocerte.'), (4, 'The weather is lovely today.')) AS messages(id, body)) SELECT d.id, d.code, l.name AS language
FROM detected AS d
LEFT JOIN translate.main.languages AS l ON l.code = d.code
ORDER BY d.id;

Use detect_lang to pick out the Spanish rows of a mixed-language review table and translate only those into English with an explicit 'es' source (the English review is filtered out; reviews 1 and 3 come back translated).

SELECT id, body, translate.main.translate(body, 'en', 'es') AS english
FROM (VALUES (1, 'El envío llegó tarde y la caja estaba dañada.'), (2, 'Great product, works as described.'), (3, 'Muy buena calidad, lo recomiendo.')) AS reviews(id, body)
WHERE translate.main.detect_lang(body) = 'es'
ORDER BY id;

Normalize a mixed Spanish/English review table to English in one batch, auto-detecting each row's source and naming it via the languages view (Spanish rows are translated; the English row passes through unchanged).

SELECT t.id, l.name AS source_language, t.text, t.translation
FROM translate.main.translate_all((SELECT id, body FROM (VALUES (1, 'El envío llegó tarde y la caja estaba dañada.'), (2, 'Great product, works as described.'), (3, 'Muy buena calidad, lo recomiendo.')) AS reviews(id, body)), id := 'id', target := 'en', source := 'auto') AS t
LEFT JOIN translate.main.languages AS l ON l.code = t.src_lang
ORDER BY t.id;
Views
languages 2 examples2 cols

Common ISO 639-1 language codes (and English names) accepted by translate and detect_lang.

Columns
code VARCHAR
ISO 639-1 two-letter language code to pass as the source/target of translate() or translate_all().
name VARCHAR
English name of the language.
Examples (2)

Look up the ISO 639-1 code for a language by its English name.

SELECT code FROM translate.main.languages WHERE name = 'Spanish';

Count how many reference languages are listed.

SELECT count(*) AS n FROM translate.main.languages;
Link
Scalar functions
detect_lang (text VARCHAR) 3 examples

Detect the ISO 639-1 language code of text

Arguments
text VARCHAR
Text whose language to detect.
ReturnsVARCHAR
Examples (3)

Detect the ISO 639-1 language code of a French phrase (returns 'fr').

SELECT translate.main.detect_lang('Bonjour le monde');

Detect the language of a German greeting (returns 'de').

SELECT translate.main.detect_lang('Guten Morgen');

Detect the language of each message and label it with its English name from the languages reference view (returns fr/French, de/German, es/Spanish, en/English).

WITH detected AS (SELECT id, body, translate.main.detect_lang(body) AS code FROM (VALUES (1, 'Bonjour le monde, comment allez-vous ce matin?'), (2, 'Guten Morgen, wie geht es Ihnen heute?'), (3, 'Hola, mucho gusto en conocerte.'), (4, 'The weather is lovely today.')) AS messages(id, body)) SELECT d.id, d.code, l.name AS language
FROM detected AS d
LEFT JOIN translate.main.languages AS l ON l.code = d.code
ORDER BY d.id;
Link
translate (text VARCHAR, to_lang VARCHAR, from_lang VARCHAR) +1 overload 6 examples

Translate text into a target language (source auto-detected) using a local neural model

Arguments
text VARCHAR
Text to translate.
to_lang VARCHAR
Target language code to translate the text into, e.g. 'es'.
from_lang VARCHAR
Source language code, or 'auto' to detect.
Overloads
translate(text VARCHAR, to_lang VARCHAR) → VARCHARtranslate(text VARCHAR, to_lang VARCHAR, from_lang VARCHAR) → VARCHAR
ReturnsVARCHAR
Examples (6)

Translate an English sentence into Spanish, auto-detecting the source language.

SELECT translate.main.translate('The quick brown fox jumps over the lazy dog.', 'es');
Result
translate.main.translate('The quick brown fox jumps over the lazy dog.', 'es')
El zorro marrón rápido salta sobre el perrito perezoso.

Translate a Spanish string into English with an explicit source language.

SELECT translate.main.translate('Hola, mundo.', 'en', 'es');

Use detect_lang to pick out the Spanish rows of a mixed-language review table and translate only those into English with an explicit 'es' source (the English review is filtered out; reviews 1 and 3 come back translated).

SELECT id, body, translate.main.translate(body, 'en', 'es') AS english
FROM (VALUES (1, 'El envío llegó tarde y la caja estaba dañada.'), (2, 'Great product, works as described.'), (3, 'Muy buena calidad, lo recomiendo.')) AS reviews(id, body)
WHERE translate.main.detect_lang(body) = 'es'
ORDER BY id;
3 more examples
SELECT translate.main.translate('The quick brown fox jumps over the lazy dog.', 'es') AS es;
SELECT translate.main.translate('Hola, mundo.', 'en', 'es') AS en;
SELECT translate.main.detect_lang('Bonjour le monde') AS lang;
Link
Table in-out functions
translate_all (data TABLE, id := VARCHAR, source := VARCHAR, target := VARCHAR) 2 examples

Translate a table of text rows in batch, carrying an id column through

Positional arguments
data TABLE
Rows to translate: a subquery selecting one text column plus, optionally, the id column.
Named arguments
id := VARCHAR
Name of an id column to carry through (excluded from translation). · default ""
source := VARCHAR
Source language code, or 'auto' to detect it per row. · default "auto"
target := VARCHAR
Target language code to translate the text into, e.g. 'es' (required). · default ""
Returns columns
id BIGINT
Passthrough id column, copied unchanged so the result joins back to the source. Its type mirrors the input id column (shown here as `BIGINT`).
text VARCHAR
The original source text.
translation VARCHAR
The translated text.
src_lang VARCHAR
Source language used (detected when `source := 'auto'`).
text VARCHAR
The original source text.
translation VARCHAR
The translated text.
src_lang VARCHAR
Source language used (detected when `source := 'auto'`).
Returns columns · depends on the arguments
With an `id :=` passthrough column
id BIGINT
Passthrough id column, copied unchanged so the result joins back to the source. Its type mirrors the input id column (shown here as `BIGINT`).
text VARCHAR
The original source text.
translation VARCHAR
The translated text.
src_lang VARCHAR
Source language used (detected when `source := 'auto'`).
Without an id column
text VARCHAR
The original source text.
translation VARCHAR
The translated text.
src_lang VARCHAR
Source language used (detected when `source := 'auto'`).
Examples (2)

Batch-translate a table of rows from English to Spanish, carrying the id through and projecting just the id and its translation.

SELECT id, translation
FROM translate.main.translate_all((SELECT 1 AS id, 'The quick brown fox jumps over the lazy dog.' AS body), id := 'id', target := 'es', source := 'en');

Normalize a mixed Spanish/English review table to English in one batch, auto-detecting each row's source and naming it via the languages view (Spanish rows are translated; the English row passes through unchanged).

SELECT t.id, l.name AS source_language, t.text, t.translation
FROM translate.main.translate_all((SELECT id, body FROM (VALUES (1, 'El envío llegó tarde y la caja estaba dañada.'), (2, 'Great product, works as described.'), (3, 'Muy buena calidad, lo recomiendo.')) AS reviews(id, body)), id := 'id', target := 'en', source := 'auto') AS t
LEFT JOIN translate.main.languages AS l ON l.code = t.src_lang
ORDER BY t.id;
Link

Try these queries

Translate a Spanish string back into English with an explicit source.

SELECT translate.main.translate('Hola, mundo.', 'en', 'es')

Uses translate

Detect the ISO 639-1 language code of a French phrase.

SELECT translate.main.detect_lang('Bonjour le monde')

Uses detect_lang

Batch-translate a table of rows, projecting the id and its translation.

SELECT id, translation
FROM translate.main.translate_all((SELECT 1 AS id, 'The quick brown fox jumps over the lazy dog.' AS body), id := 'id', target := 'es', source := 'en')

Uses translate_all

Look up the ISO 639-1 code for a language by its English name.

SELECT code FROM translate.main.languages WHERE name = 'Spanish'

Uses languages

Detect the language of each message and label it with its English name from the languages reference view (returns fr/French, de/German, es/Spanish, en/English).

WITH detected AS (SELECT id, body, translate.main.detect_lang(body) AS code FROM (VALUES (1, 'Bonjour le monde, comment allez-vous ce matin?'), (2, 'Guten Morgen, wie geht es Ihnen heute?'), (3, 'Hola, mucho gusto en conocerte.'), (4, 'The weather is lovely today.')) AS messages(id, body)) SELECT d.id, d.code, l.name AS language
FROM detected AS d
LEFT JOIN translate.main.languages AS l ON l.code = d.code
ORDER BY d.id

Uses detect_langlanguages

Use detect_lang to pick out the Spanish rows of a mixed-language review table and translate only those into English with an explicit 'es' source (the English review is filtered out; reviews 1 and 3 come back translated).

SELECT id, body, translate.main.translate(body, 'en', 'es') AS english
FROM (VALUES (1, 'El envío llegó tarde y la caja estaba dañada.'), (2, 'Great product, works as described.'), (3, 'Muy buena calidad, lo recomiendo.')) AS reviews(id, body)
WHERE translate.main.detect_lang(body) = 'es'
ORDER BY id

Uses translatedetect_lang

6 more examples in the Catalog, each listed under the table or function it uses.

Questions it can answer

Plain-English questions from the worker's agent test tasks. An AI agent with this catalog attached should answer each one with SQL.

  • A user pasted the text 'Bonjour le monde, comment allez-vous ce matin?'. Using this worker, return the ISO 639-1 language code it detects for that text.
  • Identify the language of the sentence 'Guten Morgen, wie geht es Ihnen heute?' and return its ISO 639-1 code using this worker.
  • Translate the English sentence 'The quick brown fox jumps over the lazy dog.' into Spanish using this worker. The source language is English.

Translate is an independent open-source connector from Query.Farm. It is not affiliated with, endorsed by or sponsored by the services, projects or organisations it works with. Product names, logos and trademarks belong to their respective owners.