vTrans combines several text-processing APIs behind a single interface, stores results in the database, and adds backend pages for testing, analysis, and maintenance.
The main use case is translation. With LLM-based providers (for example the OpenAI provider), it can also be used for cases where the source and target language are the same, for example summarising, rephrasing, or content editing.
Note: vTrans is currently in an early beta stage. Production use is only recommended after careful review and close monitoring.
Install it via the REDAXO installer, or copy it manually to redaxo/src/addons/vtrans and activate it in the backend.
Requirements:
- REDAXO >= 5.17.0
- PHP >= 8.2
- In the backend, open
vTrans -> Connectionsand create a connection. - Select a provider such as
deepl-api-free-v2,openai, orgoogle-translate-basic-v2. - Enter the API key / API URL and any additional provider-specific settings.
- Optionally mark it as the default and/or enable it for the playground.
- Open
vTrans -> Playgroundand test it.
Example for a DeepL Free connection:
- Key:
deepl_free - Label:
DeepL Free - Provider:
deepl-api-free-v2 - API URL:
https://api-free.deepl.com/v2/translate - API Key:
YOUR_DEEPL_KEY
Notes:
- Free keys use the free translation endpoint
https://api-free.deepl.com/v2/translate. - The default connector is used automatically whenever no
connectionvalue is passed.
- Access multiple providers through one unified API
- Manage connections centrally in the backend
- Test requests manually in the Playground
- Use DB caching by hash, connection, language, and format
- Support stable keys for reusable content
- Search, filter, review, and maintain stored records under
Data - Keep provider metadata such as usage or rate limits as raw data
deepl-api-free-v2deepl-api-pro-v2- Supports
contextandcustomInstructions
amazon-translate-v1- Credential/API-key based, depending on the provider implementation
google-translate-basic-v2- API-key based
- No prompt-style options
google-translate-v3- Service-account / OAuth based
- No prompt-style options
libretranslate-v1- Optional
apiKey - No prompt-style options
mymemory-v2- Endpoint based (default:
https://api.mymemory.translated.net/get) - Optional
apiKeyandemail - No prompt-style options
openai- Freely configurable endpoints and parameters
- Supports
contextandcustomInstructions
Configuration now takes place on the backend page Connections. There, connections are managed with:
- Key
- Label
- Provider
- API key / API URL
- System prompt
- Timeout
- Maximum characters
- Debug
- Playground flag
- Provider-specific parameters
Important notes:
- The default connector is used automatically when no
connectionvalue is provided. - API usage loads connections from the database and passes them into
VTrans::translate(). - Multiple provider configurations can exist side by side for new integrations.
This is where requests can be tested manually.
- Connection
- Source and target language
- Format (
textorhtml) - Text
- Optional key
- Additional
contextandcustomInstructionswhere supported
When a key is set, vTrans works with stable, reusable records per connection and target language.
- If an entry with the same hash already exists, it is reused.
- If the content changes, the existing key record is updated.
- Without a key, only the normal hash-based cache is used.
The result panel shows, among other things:
- connection and record ID
- whether the result came from cache or the API
- token and rate-limit data, if available
- a link to the details view under
Data
VTrans::getLastResultMeta() also provides request-local metadata such as:
idcachedcacheModeconnectionapikeyhashsourceLangtargetLangformatcontentLengthpromptOptionsUseddurationMs
Records are stored in rex_vtrans.
Important fields include:
apiconnectionkeyhashsource,target,formattext,translationlength,duration_msprompt,custom_instructionsdatacreatedate,createuser,updatedate,updateuser
Cache and reuse are based on:
- request hash
- connection / provider
- source / target language
- format
Key-based records are bound to key + target + connection.
vTrans uses the namespace FriendsOfRedaxo\\VTrans.
use FriendsOfRedaxo\\VTrans\\VTrans;
$translated = VTrans::translate(
'<p>Hello world</p>',
'en',
'de',
'html',
'homepage_hero',
[
'connection' => 'deepl_free',
'context' => 'Marketing headline',
'customInstructions' => [
'Use a formal tone.',
'Keep HTML tags unchanged.',
],
]
);
$meta = VTrans::getLastResultMeta();
$data = VTrans::getLastResultData();Supported request options include:
connection: key of a stored connection (recommended)context: additional context for supported providerscustomInstructions: array or multiline string with extra guidancedebug: enables provider debug data in the raw resultcache: boolean (trueby default). Set tofalseto skip DB cache lookup and persistence.
Use cache => false for direct API calls that should not look up or store anything in the database.
$translated = VTrans::translate(
$text,
'de',
'en',
'text',
null,
[
'connection' => 'openai_default',
'cache' => false,
]
);
$meta = VTrans::getLastResultMeta();
$data = VTrans::getLastResultData();In no-cache mode:
- no database lookup is performed before the provider call
- no result record is saved afterwards
- raw provider data is still available directly via
VTrans::getLastResultData()
VTrans::getLastResultData() returns the raw data from the last request, for example usage values, rate limits, debug information, or provider-specific metadata.
When using the html format, a provider-independent HTML filter automatically protects certain content before the API call and restores it after translation.
<span translate=\"no\">Thomas König</span>
<span class=\"notranslate\">REDAXO CMS</span><div data-vtrans-exclude>
<script>var config = { lang: 'de' };</script>
<p>This block is not sent to the API.</p>
</div><script>…</script><style>…</style><code>…</code><svg>…</svg>
- “No active translation connections configured for vTrans.”: No active connection exists in the backend.
- “Translation connection not found”: The passed
connectionkey does not exist. - “Unsupported translation API”: The provider name of a connection is unknown.
- No usage display: Only supported by providers that return such endpoints.
- Project: https://github.com/FriendsOfREDAXO/vtrans
- Community: https://www.redaxo.org
- Friends Of REDAXO
- Matthias Weiss / VIEWSION.net (Lead)
MIT, see LICENSE.