MySQL error localization Lassi Kortela 27 Jul 2020 07:55 UTC

MySQL error messages can be based format strings: e.g. "Can't create
table '%s' (errno: %d)". This is another point in favor of localized
error message support separate from a generic gettext facility: the
MySQL server will presumably send the client a pre-formatted error
message instead of the format string with the `%s` and `%d`
placeholders. Hence a client-side gettext would not be able to match the
incoming error with its message catalog.

MySQL also has multilingual error messages, and the server has a setting
to select the language used for errors sent to the client:
<https://dev.mysql.com/doc/refman/8.0/en/error-message-language.html>.
Looks like it uses POSIX locale names.

There's also a setting for the error message character set. Presumably
our Scheme MySQL client library should take that charset into account
and convert into a Scheme string for the foreign-error object.

Unfortunately, I can't find any functions in the MySQL/MariaDB C client
library to tell which language and charset is used for errors.