Page translation via AI

TeqCMS uses language models (LLM) for automatic HTML page translation. The mechanism works locally, is initiated manually, and takes translation metadata into account.

1. Launch command

Translations are initiated via CLI command:

npm run translate

The system scans all templates of the base locale and compares their last modification date with the date of the last translation into other locales.

2. Metadata storage

Translation information is stored in a JSON file:

var/teq-cms/db_translate.json

The file contains modification dates of the original and last translation dates for each locale. This allows precise identification of which pages need updating.

3. Template structure

4. LLM prompts

By default, the system instruction embedded in CMS is used. It can be overridden in the file:

var/teq-cms/system.prompt.md

Additionally, a local prompt can be set for each page in the target locale:

tmpl/web/ru/about.prompt.md

Such a file is added to the LLM request and allows refining style or terminology for a specific translation.

5. API support

TeqCMS works with any providers compatible with OpenAI API (e.g., OpenAI, DeepSeek). Configuration is set via environment variables:

TEQ_CMS_AI_API_BASE_URL=
TEQ_CMS_AI_API_KEY=
TEQ_CMS_AI_API_MODEL=
TEQ_CMS_AI_API_ORG=