DeepL.jl is a Julia SDK for the DeepL translation API. It provides functions to translate text, detect languages, and list supported languages.
# Install dependencies
julia --project=. -e 'using Pkg; Pkg.instantiate()'
# Run tests (requires DEEPL_API_KEY env var)
julia --project=. -e 'using Pkg; Pkg.test()'src/
DeepL.jl # Main module — exports, constants, includes
client.jl # HTTP helpers (post_request, get_request)
translate.jl # translate_text + language constant lists
detect.jl # detect_language
languages.jl # get_languages
test/
runtests.jl # Full test suite using @testset
DEEPL_API_KEY— required for all API calls and testsDEEPL_API_URL— optional override (defaults tohttps://api.deepl.com/v2)
- Multiple dispatch: define the same function for
StringandVector{String}signatures - Pair syntax: support
source => targetas a language pair argument (e.g.,"EN" => "DE") - Nullable types: use
Optional{T} = Union{T, Nothing} - Input validation: guard clauses at the top of public functions; throw
ArgumentErrorfor invalid inputs - Errors:
handle_api_error()inclient.jlchecks HTTP status codes - Exports: only public API functions are exported from the module (
translate_text,detect_language,get_languages) - Imports: use qualified imports (
using HTTP: HTTP,using JSON: JSON) - Docstrings: all public functions have Julia-style docstrings
GitHub Actions runs on push/PR to main with Julia 1.11. The main environment provides the DEEPL_API_KEY secret.
Conventional commits: feat:, fix:, chore:, test:, docs: