Hi Folks!
I'd like to improve the facilities of our `intl' unit which interfaces GNU Gettext. There is one little problem with it: The user of this unit might not know where to install and retrive the locale informations, needed by `BindTextDomain'.
* A common place under Unix like systems might be /Executable-Path-Without-Bin/share/locale which is well defined for Linux.
* What about DJGPP, MinGW, CygWin, MacOS, ...? Are there common rules to find the locale directory?
As a reference source code for this problem, you might want to have a look at `gettextdemo.pas'.
Thanks for your help
Eike
Eike Lange a écrit:
Hi Folks!
I'd like to improve the facilities of our `intl' unit which interfaces GNU Gettext. There is one little problem with it: The user of this unit might not know where to install and retrive the locale informations, needed by `BindTextDomain'.
- A common place under Unix like systems might be
/Executable-Path-Without-Bin/share/locale which is well defined for Linux.
- What about DJGPP, MinGW, CygWin, MacOS, ...?
Are there common rules to find the locale directory?
As a reference source code for this problem, you might want to have a look at `gettextdemo.pas'.
For DJGPP, in the program "GetTextTest.pas" of the test suite you read
LocaleDir := {$ifdef DJGPP} GetEnv ('$DJDIR') + '/share/locale' {$else} '/usr/share/locale' {$endif}; <...> s := BindTextDomain ('gettext', LocaleDir);
Is that you need ?
Maurice
Hi!
On Wed, Apr 02, 2003 at 01:35:18PM +0200, Maurice Lombardi wrote:
LocaleDir := {$ifdef DJGPP} GetEnv ('$DJDIR') + '/share/locale' {$else} '/usr/share/locale' {$endif}; <...> s := BindTextDomain ('gettext', LocaleDir); Is that you need ?
Yes, if this is the default. I wasn't sure if 'LocaleDir' was something special by your environment.
Eike
Eike Lange wrote:
Hi Folks!
I'd like to improve the facilities of our `intl' unit which interfaces GNU Gettext. There is one little problem with it: The user of this unit might not know where to install and retrive the locale informations, needed by `BindTextDomain'.
- A common place under Unix like systems might be
/Executable-Path-Without-Bin/share/locale which is well defined for Linux.
- What about DJGPP, MinGW, CygWin, MacOS, ...?
Are there common rules to find the locale directory?
As a reference source code for this problem, you might want to have a look at `gettextdemo.pas'.
Trying to compile `gettextdemo.pas' on Mac OS X results in an error message:
[G4:doc/gpc/demos] adriaan% gpc --automake -o gettextdemo gettextdemo.pas /Developer/Pascal/gpc321d10/lib/gcc-lib/powerpc-apple-darwin6.3/3.2.1/ units/intlc.c:23:21: libintl.h: No such file or directory
There is no 'libintl.h' anywhere on my Mac. I looked in contribs/eike at www.gnu-pascal.de for additional files to install, but the README file states "The Unit for internationalisation (i18n) has moved to the official GPC 2.1 source tree."
So, can you give me some more information ?
Regards,
Adriaan van Os
-------
[G4:doc/gpc/demos] adriaan% gpc -v Reading specs from /Developer/Pascal/gpc321d10/lib/gcc-lib/powerpc-apple-darwin6.3/3.2.1/ specs Configured with: ../gpc-20030323/configure --enable-languages=pascal,c --prefix=/Developer/Pascal/gpc321d10 --enable-threads=posix Thread model: posix gpc version 20030323, based on gcc-3.2.1
[G4:doc/gpc/demos] adriaan% gpc --automake -o gettextdemo gettextdemo.pas /Developer/Pascal/gpc321d10/lib/gcc-lib/powerpc-apple-darwin6.3/3.2.1/ units/intlc.c:23:21: libintl.h: No such file or directory /Developer/Pascal/gpc321d10/lib/gcc-lib/powerpc-apple-darwin6.3/3.2.1/ units/intlc.c: In function `_p_CGetText': /Developer/Pascal/gpc321d10/lib/gcc-lib/powerpc-apple-darwin6.3/3.2.1/ units/intlc.c:94: warning: return makes pointer from integer without a cast /Developer/Pascal/gpc321d10/lib/gcc-lib/powerpc-apple-darwin6.3/3.2.1/ units/intlc.c: In function `_p_CDGetText': /Developer/Pascal/gpc321d10/lib/gcc-lib/powerpc-apple-darwin6.3/3.2.1/ units/intlc.c:99: warning: return makes pointer from integer without a cast /Developer/Pascal/gpc321d10/lib/gcc-lib/powerpc-apple-darwin6.3/3.2.1/ units/intlc.c: In function `_p_CDCGetText': /Developer/Pascal/gpc321d10/lib/gcc-lib/powerpc-apple-darwin6.3/3.2.1/ units/intlc.c:104: warning: return makes pointer from integer without a cast /Developer/Pascal/gpc321d10/lib/gcc-lib/powerpc-apple-darwin6.3/3.2.1/ units/intlc.c: In function `_p_CTextDomain': /Developer/Pascal/gpc321d10/lib/gcc-lib/powerpc-apple-darwin6.3/3.2.1/ units/intlc.c:109: warning: return makes pointer from integer without a cast /Developer/Pascal/gpc321d10/lib/gcc-lib/powerpc-apple-darwin6.3/3.2.1/ units/intlc.c: In function `_p_CBindTextDomain': /Developer/Pascal/gpc321d10/lib/gcc-lib/powerpc-apple-darwin6.3/3.2.1/ units/intlc.c:114: warning: return makes pointer from integer without a cast gpc1: gpc exited with status 1 gpc1: gpc exited with status 1
Hi Adriaan, List!
On Wed, Apr 02, 2003 at 06:57:27PM +0200, Adriaan van Os wrote:
Trying to compile `gettextdemo.pas' on Mac OS X results in an error message: [G4:doc/gpc/demos] adriaan% gpc --automake -o gettextdemo gettextdemo.pas /Developer/Pascal/gpc321d10/lib/gcc-lib/powerpc-apple-darwin6.3/3.2.1/ units/intlc.c:23:21: libintl.h: No such file or directory There is no 'libintl.h' anywhere on my Mac. I looked in contribs/eike at www.gnu-pascal.de for additional files to install, but the README file states "The Unit for internationalisation (i18n) has moved to the official GPC 2.1 source tree."
Yes, this is the intl unit, which I want to improve with you help. See /unit-path/intl.pas and /unit-path/intlc.c where unit-path is you location of GPC's units.
So, can you give me some more information ?
The top of libintl.h shows, that this file is part of GNU C Library:
/* Message catalogs for internationalization. Copyright (C) 1995-1999, 2000 Free Software Foundation, Inc. This file is part of the GNU C Library. This file is derived from the file libgettext.h in the GNU gettext package. ... */
Do you have 'gettext' and 'glibc' installed? I don't know what Macs come with... Are there *.mo files installed on your system?
Thank you for your help
Eike
Eike Lange wrote:
The top of libintl.h shows, that this file is part of GNU C Library:
/* Message catalogs for internationalization. Copyright (C) 1995-1999, 2000 Free Software Foundation, Inc. This file is part of the GNU C Library. This file is derived from the file libgettext.h in the GNU gettext package. ... */
Do you have 'gettext' and 'glibc' installed? I don't know what Macs come with... Are there *.mo files installed on your system?
There are no *.mo files standard on the system. The *.mo files that I find, seem to belong to software that I added later, like gcc.mo and gnu sed.mo. Also, there is 'gettext' stuff, but only as part of the gpc and gcc sources in the gcc/intl directories.
Here are the relevant parts of gcc/autohost.h from the configure/build of gcc/gpc
/* Define if you have the dcgettext function. */ /* #undef HAVE_DCGETTEXT */
/* Define if you have the <libintl.h> header file. */ /* #undef HAVE_LIBINTL_H */
/* Define if the GNU gettext() function is already present or preinstalled. */ /* #undef HAVE_GETTEXT */
/* Define to use the libintl included with this package instead of any version in the system libraries. */ #define USE_INCLUDED_LIBINTL 1
Here is a relevant part of gcc/intl/libgnuintl.h:
#ifndef _LIBINTL_H #define _LIBINTL_H 1
#include <locale.h>
/* The LC_MESSAGES locale category is the category used by the functions gettext() and dgettext(). It is specified in POSIX, but not in ANSI C. On systems that don't define it, use an arbitrary value instead. On Solaris, <locale.h> defines __LOCALE_H then includes <libintl.h> (i.e. this file!) and then only defines LC_MESSAGES. To avoid a redefinition warning, don't define LC_MESSAGES in this case. */ #if !defined LC_MESSAGES && !defined __LOCALE_H # define LC_MESSAGES 1729 #endif
Regards,
Adriaan van Os
Am Donnerstag, 03.04.03 um 00:58 Uhr schrieb Adriaan van Os:
Eike Lange wrote:
The top of libintl.h shows, that this file is part of GNU C Library:
/* Message catalogs for internationalization. Copyright (C) 1995-1999, 2000 Free Software Foundation, Inc. This file is part of the GNU C Library. This file is derived from the file libgettext.h in the GNU gettext package. ... */
Do you have 'gettext' and 'glibc' installed? I don't know what Macs come with... Are there *.mo files installed on your system?
There are no *.mo files standard on the system. The *.mo files that I find, seem to belong to software that I added later, like gcc.mo and gnu sed.mo. Also, there is 'gettext' stuff, but only as part of the gpc and gcc sources in the gcc/intl directories.
Here are the relevant parts of gcc/autohost.h from the configure/build of gcc/gpc
/* Define if you have the dcgettext function. */ /* #undef HAVE_DCGETTEXT */
/* Define if you have the <libintl.h> header file. */ /* #undef HAVE_LIBINTL_H */
/* Define if the GNU gettext() function is already present or preinstalled. */ /* #undef HAVE_GETTEXT */
/* Define to use the libintl included with this package instead of any version in the system libraries. */ #define USE_INCLUDED_LIBINTL 1
Here is a relevant part of gcc/intl/libgnuintl.h:
#ifndef _LIBINTL_H #define _LIBINTL_H 1
#include <locale.h>
/* The LC_MESSAGES locale category is the category used by the functions gettext() and dgettext(). It is specified in POSIX, but not in ANSI C. On systems that don't define it, use an arbitrary value instead. On Solaris, <locale.h> defines __LOCALE_H then includes <libintl.h> (i.e. this file!) and then only defines LC_MESSAGES. To avoid a redefinition warning, don't define LC_MESSAGES in this case. */ #if !defined LC_MESSAGES && !defined __LOCALE_H # define LC_MESSAGES 1729 #endif
Regards,
Adriaan van Os
I have on Mac OS X (10.2):
/sw/include/libintl.h
obviously installed through one of the packages in fink - maybe gettext.
All the best
Dr. Karl-Michael Schindler Fachbereich Physik Martin-Luther-Univerisität Halle-Wittenberg D-06099 Halle/Saale
Tel.: ++49 (0) 345-55 25563