1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-26 12:21:12 +03:00

Native Language Support (NLS)

Use --enable-nls to turn it on; see installation instructions for details.
See developer's guide how to make use of it in programs and how to add
translations.

psql sources have been almost fully prepared and an incomplete German
translation has been provided.  In the backend, only elog() calls are
currently translatable, and the provided German translation file is more
of a placeholder.
This commit is contained in:
Peter Eisentraut
2001-06-02 18:25:18 +00:00
parent 58193c5f37
commit e542036461
27 changed files with 13814 additions and 600 deletions

View File

@ -4,7 +4,7 @@
#
# Copyright (c) 1994, Regents of the University of California
#
# $Header: /cvsroot/pgsql/src/backend/Makefile,v 1.72 2001/05/24 15:53:32 momjian Exp $
# $Header: /cvsroot/pgsql/src/backend/Makefile,v 1.73 2001/06/02 18:25:17 petere Exp $
#
#-------------------------------------------------------------------------
@ -34,6 +34,9 @@ endif
##########################################################################
all: postgres $(POSTGRES_IMP)
ifeq ($(enable_nls), yes)
$(MAKE) -C po all
endif
ifneq ($(PORTNAME), win)
@ -113,7 +116,9 @@ distprep:
$(MAKE) -C parser gram.c parse.h scan.c
$(MAKE) -C bootstrap bootparse.c bootstrap_tokens.h bootscanner.c
$(MAKE) -C utils/misc guc-file.c
ifeq ($(enable_nls), yes)
$(MAKE) -C po $@
endif
##########################################################################
@ -127,9 +132,15 @@ endif
$(INSTALL_DATA) $(srcdir)/libpq/pg_hba.conf.sample $(DESTDIR)$(datadir)/pg_hba.conf.sample
$(INSTALL_DATA) $(srcdir)/libpq/pg_ident.conf.sample $(DESTDIR)$(datadir)/pg_ident.conf.sample
$(INSTALL_DATA) $(srcdir)/utils/misc/postgresql.conf.sample $(DESTDIR)$(datadir)/postgresql.conf.sample
ifeq ($(enable_nls), yes)
$(MAKE) -C po $@
endif
installdirs:
$(mkinstalldirs) $(DESTDIR)$(bindir) $(DESTDIR)$(libdir) $(DESTDIR)$(datadir)
ifeq ($(enable_nls), yes)
$(MAKE) -C po $@
endif
install-bin: postgres $(POSTGRES_IMP) installdirs
$(INSTALL_PROGRAM) postgres$(X) $(DESTDIR)$(bindir)/postgres$(X)
@ -157,6 +168,9 @@ endif
rm -f $(DESTDIR)$(datadir)/pg_hba.conf.sample \
$(DESTDIR)$(datadir)/pg_ident.conf.sample \
$(DESTDIR)$(datadir)/postgresql.conf.sample
ifeq ($(enable_nls), yes)
$(MAKE) -C po $@
endif
##########################################################################
@ -171,6 +185,9 @@ ifeq ($(MAKE_DLL), true)
endif
endif
for i in $(DIRS); do $(MAKE) -C $$i clean || exit; done
ifeq ($(enable_nls), yes)
$(MAKE) -C po $@
endif
distclean: clean
rm -f port/Makefile port/tas.s port/dynloader.c
@ -183,6 +200,7 @@ maintainer-clean: distclean
$(srcdir)/parser/scan.c \
$(srcdir)/parser/parse.h \
$(srcdir)/utils/misc/guc-file.c
$(MAKE) -C po maintainer-clean
##########################################################################

View File

@ -13,7 +13,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/main/main.c,v 1.43 2001/04/21 18:29:29 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/main/main.c,v 1.44 2001/06/02 18:25:17 petere Exp $
*
*-------------------------------------------------------------------------
*/
@ -21,7 +21,7 @@
#include <pwd.h>
#include <unistd.h>
#ifdef USE_LOCALE
#if defined(USE_LOCALE) || defined(ENABLE_NLS)
#include <locale.h>
#endif
@ -97,6 +97,14 @@ main(int argc, char *argv[])
beos_startup(argc, argv);
#endif
#ifdef ENABLE_NLS
#ifdef LC_MESSAGES
setlocale(LC_MESSAGES, "");
#endif
bindtextdomain("postgres", LOCALEDIR);
textdomain("postgres");
#endif
/*
* Not-quite-so-platform-specific startup environment checks. Still
* best to minimize these.

12
src/backend/po/Makefile Normal file
View File

@ -0,0 +1,12 @@
# $Header: /cvsroot/pgsql/src/backend/po/Attic/Makefile,v 1.1 2001/06/02 18:25:17 petere Exp $
subdir = src/backend/po
top_builddir = ../../..
include $(top_builddir)/src/Makefile.global
gettext-files:
find $(srcdir)/.. -name '*.c' >$@
maintainer-clean:
rm -f gettext-files

11339
src/backend/po/de.po Normal file

File diff suppressed because it is too large Load Diff

4
src/backend/po/nls.mk Normal file
View File

@ -0,0 +1,4 @@
CATALOG_NAME := postgres
AVAIL_LANGUAGES := de
GETTEXT_FILES := + gettext-files
GETTEXT_TRIGGERS:= elog:2

View File

@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/error/elog.c,v 1.84 2001/05/30 14:15:26 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/error/elog.c,v 1.85 2001/06/02 18:25:17 petere Exp $
*
*-------------------------------------------------------------------------
*/
@ -207,6 +207,7 @@ elog(int lev, const char *fmt,...)
if (Log_pid)
timestamp_size += PID_SIZE;
fmt = gettext(fmt);
/*
* Set up the expanded format, consisting of the prefix string plus
* input format, with any %m replaced by strerror() string (since