Re: Relocatable locale - Mailing list pgsql-patches

From Bruce Momjian
Subject Re: Relocatable locale
Date
Msg-id 200405250159.i4P1xeP08496@candle.pha.pa.us
Whole thread Raw
In response to Re: Relocatable locale  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Relocatable locale
List pgsql-patches
Tom Lane wrote:
> Bruce Momjian <pgman@candle.pha.pa.us> writes:
> > Tom Lane wrote:
> >> I don't really believe that path.c has any business doing this at
> >> all, in any program.
>
> > Well, all our client apps used to do it in their own code.  Now they
> > call set_pglocale to do it centrally and relocabably.
>
> I don't care if the clients do it.  I don't want main.c doing it.

Well, as coded now, it will behave the same.

The old code has in main.c:

-       bindtextdomain("postgres", LOCALEDIR);
-       textdomain("postgres");

and now it has a call to set_pgsetlocale which does:

    if (find_my_exec(argv0, my_exec_path) < 0)
        return;

    get_locale_path(argv0, path);
    bindtextdomain(app, path);
    textdomain(app);

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
Index: main.c
===================================================================
RCS file: /cvsroot/pgsql-server/src/backend/main/main.c,v
retrieving revision 1.81
retrieving revision 1.82
diff -c -r1.81 -r1.82
*** main.c    24 May 2004 02:47:44 -0000    1.81
--- main.c    25 May 2004 01:00:20 -0000    1.82
***************
*** 150,155 ****
--- 150,157 ----
       * startup error messages to be localized.
       */

+     set_pglocale(argv[0], "postgres");
+
  #ifdef WIN32
      /*
       * Windows uses codepages rather than the environment, so we work around
***************
*** 184,194 ****
      setlocale(LC_MONETARY, "C");
      setlocale(LC_NUMERIC, "C");
      setlocale(LC_TIME, "C");
-
- #ifdef ENABLE_NLS
-     bindtextdomain("postgres", LOCALEDIR);
-     textdomain("postgres");
- #endif

      /*
       * Skip permission checks if we're just trying to do --help or
--- 186,191 ----

pgsql-patches by date:

Previous
From: Tom Lane
Date:
Subject: Re: Relocatable locale
Next
From: Tom Lane
Date:
Subject: Re: Relocatable locale