Peter Eisentraut wrote:
> Bruce Momjian wrote:
> > I have two questions.  First, setlocale() seemed to be inconsistently
> > set inside and outside of ENABLE_NLS.  I assume the proper location
> > is inside.
> 
> No, in case of doubt it's outside.


OK, moved.  New code is:

        void
        set_pglocale(const char *argv0, const char *app)
        {
        #ifdef ENABLE_NLS
            char path[MAXPGPATH];
            char my_exec_path[MAXPGPATH];
        #endif
        
            /* don't set LC_ALL in the backend */
            if (strcmp(app, "postgres") != 0)
                setlocale(LC_ALL, "");
        
        #ifdef ENABLE_NLS
            if (find_my_exec(argv0, my_exec_path) < 0)
                return;
        
            get_locale_path(my_exec_path, path);
            bindtextdomain(app, path);
            textdomain(app);
        #endif
        }

> 
> >  Second, libpq has a locale setting for error messages,
> > but a libpq program could be in any directory, so I see no way to
> > make that relocatable.  Instead, I just use the hardcoded path.  I
> > could make it relocatable, but that seems to error-prone, plus I
> > would have to look up the exec path and stuff, and it seemed too
> > complicated.
> 
> Hmm, so this says that a relocatable install isn't in fact possible?

Yep.  I don't see how you can have a library know where to look for its
localized messages.  The only thing I can think of is an environment
variable to override the hard-coded default.  How is that?

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  [EMAIL PROTECTED]               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

               http://www.postgresql.org/docs/faqs/FAQ.html

Reply via email to