[ adding bug-gettext ] * David Bruce wrote on Thu, Mar 24, 2011 at 12:40:58PM CET: > On Wed, Jan 12, 2011 at 9:31 PM, David Bruce wrote: > > We have reorganized our package (tuxmath) into a smaller package for > > the game itself, plus a separate library package (t4k_common). Both > > packages use autotools, including autoheader. As part of t4k_common, > > we provide a couple of replacement functions (alphasort() and > > scandir()) for platforms lacking these functions. Thus, our > > t4k_common.h header needs to have an autoheader include so it can > > conditionally include the prototypes for these functions. > > > > Since just putting #include "config.h" at the top of our library > > header would cause a name collision with tuxmath's config.h, I have > > used the ax_prefix_config_h.m4 macro to rename t4k_common's config.h > > to "t4k_common-config.h", and adapted all the *.c files accordingly. > > I've discovered a more serious issue with my use of > ax_prefix_config_h.m4 - it appears to be interfering with gettext() > calls from within the library functions. Looking at the gettext > manual for using gettext within a library, it says "If it uses the > translation domain and POT file of the main program, then the previous > sections apply without changes.", which I believe is the case here - > the library source files don't have their own translatable strings, > but they do have gettext() calls to translate strings that are covered > by tuxmath's *.po files. > > I'm at a bit of a loss as to how to get this fixed. As a test, I've > tried hard-coding the gettext setup functions within the library to > use the same values as tuxmath (see below), but I still don't get > output of translated strings. > > { > const char *s1, *s2, *s3, *s4; > s1 = setlocale(LC_ALL, NULL); > s2 = bindtextdomain("tuxmath", "/usr/local/share/locale"); > s3 = bind_textdomain_codeset("tuxmath", "UTF-8"); > s4 = textdomain("tuxmath"); > printf("In InitT4KCommon():\n"); > printf("setlocale(LC_ALL, \"\") returned: %s\n", s1); > printf("bindtextdomain(\"tuxmath\", \"/usr/local/share/locale\") > returned: %s\n", s2); > printf("bind_textdomain_codeset(\"tuxmath\", \"UTF-8\") returned: > %s\n", s3); > printf("textdomain(\"tuxmath\") returned: %s\n", s4); > printf("gettext(\"Help\"): %s\n\n", gettext("Help")); > printf("_(\"Help\"): %s\n\n", _("Help")); > } > > I suspect that something about the renaming done by > ax_prefix_config_h.m4 is preventing gettext from locating the message > catelogs properly. Also, I realize this is getting more into gettext > than autoconf territory, but it seems there is a lot of overlap in > expertise within the autotools family. Should I take this to the > bug-gnu list that handles gettext issues? Let's ask on the (fairly new) bug-gettext list. Do you have a small reproducer setup? I guess that could help to pinpoint the issue quickly. Thanks, Ralf _______________________________________________ Autoconf mailing list Autoconf@xxxxxxx http://lists.gnu.org/mailman/listinfo/autoconf