bug-gettext
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Build relocation into libintl


From: Bruno Haible
Subject: Re: Build relocation into libintl
Date: Fri, 03 Jan 2025 17:15:33 +0100

Hi,

Erwin Waterlander wrote in
<https://lists.gnu.org/archive/html/bug-gnu-utils/2009-11/msg00011.html>
(see also <https://sourceforge.net/p/mingw/bugs/1808/>
and <https://waterlan.home.xs4all.nl/libintl.html>):

> Isn't it a good idea to build relocation support into the library,
> like the GnuWin32 maintainers did?

What your patch does, is to change the code of bindtextdomain() in such a way
that

  bindtextdomain (PACKAGE, relocate (LOCALEDIR));

can be simplified to

  bindtextdomain (PACKAGE, LOCALEDIR);

and that the invocation

  set_program_name (argv[0]);

(that usually informs the relocate() logic about the INSTALLPREFIX and
INSTALLDIR) can be omitted.

This is fine for a distribution with a small set of packages (like
GnuWin32).

However, it is not fine in general, because in your patch, the missing
pieces of information are replaced with heuristics, in other words,
with assumptions that are not universally valid.

These assumptions are:

  1) that $LOCALEDIR is $PREFIX/share/locale

     as can be seen from your overridden bindtextdomain() code:
          char *locale_dirname, *installdir = strdup (dirname), *s;
          if ((s = strrchr (installdir, '/'))) *s = '\0';
          if ((s = strrchr (installdir, '/'))) *s = '\0';

  2) that there is only one translation domain, and it is associated
     with the executable. This can be seen from the use of
     GetModuleFileName in the function set_current_prefix.

     Translation domains belonging to libraries won't work in all
     cases.

     But even GNU gettext now uses 3 translation domains:
       bindtextdomain (PACKAGE, relocate (LOCALEDIR));
       bindtextdomain ("gnulib", relocate (GNULIB_LOCALEDIR));
       bindtextdomain ("bison-runtime", relocate (BISON_LOCALEDIR));

Since these assumptions are not universally valid, your patch cannot
be upstreamed.

Bruno






reply via email to

[Prev in Thread] Current Thread [Next in Thread]