The quickstart examples show the shortest possible curl commands. For package scripts, CI jobs, or any workflow you run repeatedly, add a few flags so failed requests are easy to diagnose and transfers stay efficient.
Recommended flags
For normal script usage, start with:
--fail-with-body --silent--show-error--compressed
For CI or other unattended automation, consider adding timeouts:
--connect-timeout 10 --max-time 300
Flag
Purpose
--fail-with-body
Makes HTTP 4xx/5xx responses fail with a non-zero exit code while keeping the response body. doloc error responses often contain useful help text.
--silent --show-error
Hides curl’s progress meter but still shows curl-level errors. This keeps package-script and CI output readable.
--compressed
Sends an Accept-Encoding header and lets curl decompress compressed responses automatically. Useful for larger localization files and harmless for small ones.
--connect-timeout 10
Avoids waiting forever while establishing the connection.
--max-time 300
Caps the whole request duration. Adjust this for very large files or slow networks.
Direct output to a version-controlled file
If your translation files are tracked in Git, direct output is usually the simplest production-friendly setup:
If the request fails, curl exits with a non-zero status. Because --fail-with-body keeps the response body, the target file may contain doloc’s error/help text. For network-level failures, it may also contain an incomplete or empty response. Read it if there is useful information, revert the file from version control, fix the issue, and retry.
This is often more helpful than hiding the error response, especially while setting up a project.
When the target file must not be overwritten
Use a temporary output file when overwriting the target is unacceptable, for example when:
the file is not version-controlled,
local edits must be preserved,
a later automation step may continue even after curl fails, or
This pattern prints doloc’s error response to stderr and replaces the target file only after a successful request. The flags are the same on Bash and PowerShell; only the shell syntax changes. In PowerShell, use curl.exe to call curl instead of PowerShell’s aliases.
Compatibility fallback
--fail-with-body requires curl 7.76.0 or newer. If you must support older curl versions, use --fail as a fallback:
This still fails on HTTP 4xx/5xx responses, but the HTTP response body is not preserved. Use it only when compatibility is more important than seeing doloc’s error details.