WeblateOrg / WeblateOrg/weblate

String-specific context for DeepL machine translation

Open
#15,188 0 comments 0 reactions 0 assignees View on GitHub
Area: Automatic translation Waiting for: Demand
Dominant language
Python
Stars
6.1k
Forks
1.4k
Avg merge
9h 53m
Merged PRs (30d)
395

Description

### Describe the problem

In the DeepL machine translation there is no unit-specific context like the _explanation_ field is considered. Providing more context might help to get better results, especially for short strings.

### Solution brainstorm

Provide a setting in the DeepL machinery to enable strings specific context.
Enabling it would mean:
- no more batching (slower, more expensive)
- context from the machinery settings is expanded with _explanation_ and possibly other sources, like nearby keys.

### Describe alternatives you have considered

Just merge the set of explanations of all keys set to the API: This might lead even worse results because the context might be confusing/contradictory and won't apply to the whole batch of texts.

Allow placeholders for context sources like _explanation_ in the context setting of the machinery configuration: over-complicated with little benefit compared to simple appending.

Skip batching only on keys that have a _explanation_ text: could be a future optimization.

### Screenshots

_No response_

### Additional context

Similar requests exists for LLM based machine translations.

> Weblate currently tries to batch the translation by passing more strings at once while doing automatic translations. Besides speed and costs, this helps quality as well, as the LLM sees more strings at once and keeps the translations more consistent. But this makes adding additional information per string tricky. Passing explanation might also be useful, see https://github.com/orgs/WeblateOrg/discussions/14273.

_Originally posted by @nijel in [#13398](https://github.com/WeblateOrg/weblate/issues/13398#issuecomment-2754095581)_

Contributor guide

Open the contributing guide

Research direction

The issue does not name files, tests, or an entry point. Start by locating the DeepL translation machinery, its batching logic, and configuration handling, then review how per-string explanations are represented. Done would require an agreed design and implementation that can add string-specific context while preserving the existing batching behavior when the setting is disabled.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
localization
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.