`text` now accepts either a single string or an array of strings. A string
is answered with a string in `data` exactly as before; an array is answered
with a position-aligned array, and the whole batch travels in a single
oneshot request, so a caller with many segments needs one round trip
instead of one per segment.
A batch is all-or-nothing: an empty array or an empty element answers with
the existing 404 "No text to translate", and if upstream returns a
different number of translations or leaves one empty the request fails with
503 "Translation failed" instead of returning placeholders or a misaligned
array. The anonymous length cap applies to the total length of the array,
which the README now documents.
Refs #240
DeepL only accepts the generic "zh" as a source hint; zh-Hans and
zh-Hant are target-only script variants and are silently ignored when
sent as source_lang. Ambiguous mixed-script Chinese therefore fell back
to auto-detection, was detected as English and echoed back untranslated.
ZH, ZH-HANS and ZH-HANT now resolve to "zh" for source_lang while the
target mapping is unchanged. /v2/translate also reads source_lang (JSON
and form) instead of always auto-detecting. Adds resolveSourceLang and
resolveTargetLang tests.
Fixes#239
Rebrand in response to a trademark report regarding the DEEPL mark.
Renames the Go module path, exported symbols, binary, systemd/launchd
services, Docker images, and CI artifacts; adds a trademark disclaimer
to the README and removes screenshots containing DeepL branding.
BREAKING CHANGE: Go module path is now github.com/OwO-Network/DLX.
translate.TranslateByDeepLX is now translate.TranslateByDLX and
DeepLXTranslationResult is now DLXTranslationResult. The release
binaries, systemd service, and Docker images are renamed from
deeplx to dlx.
Return a generic "Translation failed" message instead of echoing
err.Error() in the HTTP response, and log the underlying error
server-side via log.Printf. Avoids leaking internal details (proxy
address, upstream URL, etc.) to API clients while keeping the 500
behavior introduced in #224.
The two handlers ignored the error from c.BindJSON, so a malformed JSON body was silently processed as an empty payload. Check the error and return 400, consistent with /v2/translate.
The /translate, /v1/translate and /v2/translate handlers called log.Fatalf when TranslateByDeepLX returned an error. log.Fatalf calls os.Exit, so a single failed translation would tear down the whole server process. Return a 500 JSON response and keep serving instead.