> +/*
> + * Return whether the GUC name should be enclosed in double-quotes.
> + *
> + * Quoting is intended for names which could be mistaken for normal English
> + * words. Quotes are only applied to GUC names that are written entirely with
> + * lower-case alphabetical characters.
> + */
> +static bool
> +quotes_needed_for_GUC_name(const char *name)
> +{
> + for (const char *p = name; *p; p++)
> + {
> + if ('a' > *p || *p > 'z')
> + return false;
> + }
> +
> + return true;
> +}
I think you need a function that the name possibly quoted, in a way that
lets the translator handle the quoting:
static char buffer[SOMEMAXLEN];
quotes_needed = ...;
if (quotes_needed)
/* translator: a quoted configuration parameter name */
snprintf(buffer, _("\"%s\""), name);
return buffer
else
/* no translation needed in this case */
return name;
then the calling code just does a single %s that prints the string
returned by this function. (Do note that the function is not reentrant,
like pg_dump's fmtId. Shouldn't be a problem ...)
> @@ -3621,8 +3673,8 @@ set_config_option_ext(const char *name, const char *value,
> {
> if (changeVal && !makeDefault)
> {
> - elog(DEBUG3, "\"%s\": setting ignored because previous source is higher priority",
> - name);
> + elog(DEBUG3, "%s%s%s: setting ignored because previous source is higher priority",
> + GUC_FORMAT(name));
Note that elog() doesn't do translation, and DEBUG doesn't really need
to worry too much about style anyway. I'd leave these as-is.
--
Álvaro Herrera 48°01'N 7°57'E — https://www.EnterpriseDB.com/
"La primera ley de las demostraciones en vivo es: no trate de usar el sistema.
Escriba un guión que no toque nada para no causar daños." (Jakob Nielsen)