Route translations INTO English, not just out of it

FixTranslateService
Shipped
August 12, 2026 at 4:05 AM UTC
Author
Kamo
Commit
92f4b7a

Both providers gated supports() on "en".equals(sourceLang), so every inbound pair was decoderd before a provider was ever asked. ProviderRouter treats "no provider supports this" as a legitimate passthrough and returns the input verbatim, so a Romanian message shown to an English reader came back untranslated with no exception and no log line anywhere — the failure was invisible in the service logs. - LibreTranslateProvider now caches the full source->targets matrix from /languages instead of only English's row. Argos ships each direction as a separate package, so en->ro tells you nothing about ro->en. - Locale aliasing (zh -> zh-Hans) now applies to the source side too, and translate() posts the same resolved code that supports() matched on. - BergamotProvider keys off an explicit pair map. It still only ships en->X models, but the direction is now data rather than a hardcoded assumption. - ProviderRouter warns when no provider supports a pair rather than silently returning the source, and short-circuits blank text (an empty q earns a permanent, non-retryable HTTP 400 that requeued forever). Also repairs BergamotProviderTest, which was already failing on main: it asserted en->ru/pt/it/uk/tr/ro/id/vi/ar after the supported set had been narrowed to the four confirmed models (ende, enes, enfr, enpl).

All changes

Like what you see shipping?

Every one of these updates lands in your workspace automatically. Start free and watch it grow week after week.

Start Free ForeverView Pricing