Re: CURL errors codes and messages - are they globalized?

Ray Satiro via curl-users <[email protected]> Thu, 16 Jan 2025 13:43:47 -0500
Newsgroups gmane.comp.web.curl.general
Message-ID <[email protected]>
On 1/16/2025 9:25 AM, Michael Conners via curl-users wrote:
>
> I'm doing a libcurl implementation in a Windows C++ project and the 
> app has users from various countries (Japan, France, Germany).
>
> If a CURLE_SSL_CONNECT_ERROR is returned from curl_easy_perform, the 
> error text I see is "SSL connect error". What error text would a 
> German user see?
>
> Are CURL error messages globalized? If so, which languages?
>

The CURLcode error messages that you retrieve via curl_easy_strerror are 
only in English. [1] Sometimes there is a more detailed error message 
available from the Operating System that may or may not be in the local 
language and it is stored in ERRORBUFFER . [2][3] When the error buffer 
was written to by posix strerror or windows formatmessage it might be in 
the local language, from a third party library like OpenSSL it might not.

The curl tool prefers showing what is in error buffer instead of the 
generic error message. [4] You could use logic similar to that. It does 
not guarantee that users will see an error message in their native 
language but it may help. To ensure all error messages are in the native 
language I think you'd have to forgo detailed error messages in 
ERRORBUFFER and translate your own curl_easy_strerror for that language.


[1]: https://github.com/curl/curl/blob/curl-8_11_1/lib/strerror.c#L56
[2]: https://github.com/curl/curl/blob/curl-8_11_1/lib/strerror.c#L788-L800
[3]: https://curl.se/libcurl/c/CURLOPT_ERRORBUFFER.html
[4]: 
https://github.com/curl/curl/blob/curl-8_11_1/src/tool_operate.c#L483-L490

-- 
Unsubscribe: https://lists.haxx.se/mailman/listinfo/curl-users
Etiquette:   https://curl.se/mail/etiquette.html