Thread: Re: [HACKERS] merge psql ef/ev sf/sv handling functions

Re: [HACKERS] merge psql ef/ev sf/sv handling functions

From
Tom Lane
Date:
Fabien COELHO <coelho@cri.ensmp.fr> writes:
> Here is an attempt at merging some functions which removes 160 lines of
> code.

Pushed with minor adjustments.  I thought a couple of variable names
could be better chosen, but mostly, you can't do this sort of thing:

-            psql_error("The server (version %s) does not support editing function source.\n",
+            psql_error("The server (version %s) does not support editing %s.\n",
formatPGVersionNumber(pset.sversion,false, 
-                                             sverbuf, sizeof(sverbuf)));
+                                             sverbuf, sizeof(sverbuf)),
+                       is_func ? "function source" : "view definitions");

It's too much of a pain in the rear for translators.  See
https://www.postgresql.org/docs/devel/static/nls-programmer.html#nls-guidelines
Usually we just use two independent messages, and that's what I did.
        regards, tom lane



Re: [HACKERS] merge psql ef/ev sf/sv handling functions

From
Fabien COELHO
Date:
> you can't do this sort of thing:
>
> -            psql_error("The server (version %s) does not support editing function source.\n",
> +            psql_error("The server (version %s) does not support editing %s.\n",
>                        formatPGVersionNumber(pset.sversion, false,
> -                                             sverbuf, sizeof(sverbuf)));
> +                                             sverbuf, sizeof(sverbuf)),
> +                       is_func ? "function source" : "view definitions");
>
> It's too much of a pain in the rear for translators.

Argh, indeed, I totally forgot about translations. Usually there is a _() 
hint for gettext.

> See 
> https://www.postgresql.org/docs/devel/static/nls-programmer.html#nls-guidelines 
> Usually we just use two independent messages, and that's what I did.

Yep, makes sense. Thanks for the fix.

-- 
Fabien.