bug-gnu-utils
[Top][All Lists]
Advanced

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

Still not able to get gettext working


From: David Bruce
Subject: Still not able to get gettext working
Date: Sat, 10 Nov 2007 02:34:36 +0000
User-agent: KMail/1.9.7

Hi Bruno & colleagues,

I've been trying very diligently over the last couple of days to get gettext 
working on my program (tuxmath) - again went through the FAQ and Chapter 13 
of the gettext manual, and AFAICT I've followed everything, but my program 
still doesn't call bindtextdomain, textdomain, etc. as if NLS is disabled.  

I am definitely calling AM_GNU_GETTEXT, and ENABLE_NLS does indeed get set to 
1, but gettext is somehow still not activated.  I'm hoping someone can 
suggest other pitfalls I can look into.

Here are what I think are the relevant snippets - the complete files are 
attached:


------------------------
main() function:

/* (tuxmath.h brings in "gettext.h" and <locale.h> */
#include "tuxmath.h"

int main(int argc, char * argv[])
{
  setlocale(LC_ALL, "");
  bindtextdomain(PACKAGE, LOCALEDIR);
  bind_textdomain_codeset(PACKAGE, "UTF-8");
  textdomain(PACKAGE);
// Just exit for now while testing gettext:
/
  return 0;
}


---------------------------------------
from "configure.ac"

#                                               -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_INIT([Tux Of Math Command],[1.5.7],address@hidden,
[tuxmath])
AC_CONFIG_SRCDIR([src/tuxmath.c])

AC_PREREQ(2.61)
AC_CANONICAL_HOST
AC_CANONICAL_BUILD
AC_CANONICAL_TARGET

AM_INIT_AUTOMAKE(foreign)
AC_CONFIG_HEADERS([config.h])

NAME_VERSION=$PACKAGE-$VERSION

AC_DEFINE_UNQUOTED([PROGRAM_NAME], "$PACKAGE", [Tux Of Math Command])

AC_SUBST(NAME_VERSION)

# Checks for programs.
AC_PROG_CC
AC_PROG_MAKE_SET

# Needed for gettext:
AC_GNU_SOURCE
AM_GNU_GETTEXT_VERSION([0.16])
AM_GNU_GETTEXT
AM_GNU_GETTEXT_INTL_SUBDIR
...(skip)...

AC_CONFIG_FILES([
Makefile
...(skip)..
intl/Makefile
po/Makefile.in
])
AC_OUTPUT

---------------------------------------------------
Relevant (I think) part of top level Makefile.am:


## Top-level Makefile.am for tuxmath:
## Process with Automake to create Makefile.in
SUBDIRS = docs  \
        intl    \
        po      \
        src     \
        data

ACLOCAL_AMFLAGS = -I m4

EXTRA_DIST = config.rpath m4/ChangeLog
datadir = @datadir@
localedir = $(datadir)/locale
...(rest skipped)...


------------------------------------------------------
From src/Makefile.am:

## Makefile.am for tuxmath src:
## Process with Automake to create Makefile.in

# Support for gettext:
datadir = @datadir@
localedir = $(datadir)/locale
DEFS = -DLOCALEDIR=\"$(localedir)\" @DEFS@

AM_CFLAGS=-Wall -g -DDATA_PREFIX=\"${DATA_PREFIX}\" -DDEBUG \
        -DVERSION=\"@address@hidden" -D$(SOUND)SOUND

AM_CPPFLAGS = -DLOCALEDIR=\"$(localedir)\" \
        -I../intl -I$(top_srcdir)/intl
LDADD = @LIBINTL@
...(rest skipped)...

-----------------------------------------------------------------

Some relevant output - 
from configure:

checking whether NLS is requested... yes
checking for msgfmt... /usr/bin/msgfmt
checking for gmsgfmt... /usr/bin/msgfmt
checking for xgettext... /usr/bin/xgettext
checking for msgmerge... /usr/bin/msgmerge
-------------------------------------------------------------
from make:

Making all in src
make[2]: Entering directory `/home/dbruce/tux4kids/tuxmath/build/src'
gcc -DLOCALEDIR=\"/usr/local/share/locale\" -DHAVE_CONFIG_H -I. -I.. 
-I../../trunk/src  -DLOCALEDIR=\"/usr/local/share/locale\" -I../intl 
-I../../trunk/intl  -Wall -g -DDATA_PREFIX=\"/usr/local/share/tuxmath\" -DDEBUG 
-DVERSION=\"tuxmath-1.5.7\" -DSOUND -g -O2 -I/usr/include/SDL -D_GNU_SOURCE=1 
-D_REENTRANT -MT 
tuxmath.o -MD -MP -MF .deps/tuxmath.Tpo -c -o 
tuxmath.o ../../trunk/src/tuxmath.c
In file included from ../../trunk/src/tuxmath.h:46,
                 from ../../trunk/src/tuxmath.c:26:
../config.h:339:1: warning: "VERSION" redefined
<command-line>: warning: this is the location of the previous definition
../../trunk/src/tuxmath.c: In function ‘main’:
../../trunk/src/tuxmath.c:35: warning: statement with no effect
../../trunk/src/tuxmath.c:36: warning: statement with no effect
../../trunk/src/tuxmath.c:37: warning: statement with no effect

----------------------------------------
running the program under ltrace:

address@hidden:~/tux4kids/tuxmath/build$ ltrace tuxmath
__libc_start_main(0x4026e0, 1, 0x7fff1bef65d8, 0x416a80, 0x416a70 
<unfinished ...>
setlocale(6, "")                                                                
                              
= "nn_NO.UTF-8"
+++ exited (status 0) +++
address@hidden:~/tux4kids/tuxmath/build$     


I apologize for the length of this post, and again, thanks for any help.  I'm 
really trying to do my homework and read all the relevant manuals, but I'm 
pretty stuck on this one.  If no one can help, I won't post on this problem 
anymore.

-- 
David Bruce

Attachment: Makefile.am
Description: Text Data

Attachment: src/Makefile.am
Description: Text Data

Attachment: configure.ac
Description: Text document

Attachment: config.log
Description: Text Data


reply via email to

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