2010-09-20 22:08:53 +02:00
|
|
|
# src/nls-global.mk
|
2001-06-02 20:25:18 +02:00
|
|
|
|
|
|
|
# Common rules for Native Language Support (NLS)
|
|
|
|
#
|
|
|
|
# If some subdirectory of the source tree wants to provide NLS, it
|
|
|
|
# needs to contain a file 'nls.mk' with the following make variable
|
|
|
|
# assignments:
|
|
|
|
#
|
2011-06-26 22:38:29 +02:00
|
|
|
# CATALOG_NAME -- name of the message catalog (xxx.po); probably
|
|
|
|
# name of the program
|
|
|
|
# AVAIL_LANGUAGES -- list of languages that are provided/supported
|
|
|
|
# GETTEXT_FILES -- list of source files that contain message strings
|
|
|
|
# GETTEXT_TRIGGERS -- (optional) list of functions that contain
|
2001-06-02 20:25:18 +02:00
|
|
|
# translatable strings
|
2011-06-26 23:13:10 +02:00
|
|
|
# GETTEXT_FLAGS -- (optional) list of gettext --flag arguments to mark
|
|
|
|
# function arguments that contain C format strings
|
|
|
|
# (functions must be listed in TRIGGERS and FLAGS)
|
2001-06-02 20:25:18 +02:00
|
|
|
#
|
|
|
|
# That's all, the rest is done here, if --enable-nls was specified.
|
|
|
|
#
|
|
|
|
# The only user-visible targets here are 'init-po', to make an initial
|
|
|
|
# "blank" catalog from program sources, and 'update-po', which is to
|
|
|
|
# be called if the messages in the program source have changed, in
|
|
|
|
# order to merge the changes into the existing .po files.
|
|
|
|
|
|
|
|
|
|
|
|
# existence checked by Makefile.global; otherwise we won't get here
|
|
|
|
include $(srcdir)/nls.mk
|
|
|
|
|
|
|
|
# If user specified the languages he wants in --enable-nls=LANGUAGES,
|
|
|
|
# filter out the rest. Else use all available ones.
|
|
|
|
ifdef WANTED_LANGUAGES
|
|
|
|
LANGUAGES = $(filter $(WANTED_LANGUAGES), $(AVAIL_LANGUAGES))
|
|
|
|
else
|
|
|
|
LANGUAGES = $(AVAIL_LANGUAGES)
|
|
|
|
endif
|
|
|
|
|
2002-08-21 22:42:27 +02:00
|
|
|
PO_FILES = $(addprefix po/, $(addsuffix .po, $(LANGUAGES)))
|
2012-03-28 20:06:45 +02:00
|
|
|
ALL_PO_FILES = $(addprefix po/, $(addsuffix .po, $(AVAIL_LANGUAGES)))
|
2002-08-21 22:42:27 +02:00
|
|
|
MO_FILES = $(addprefix po/, $(addsuffix .mo, $(LANGUAGES)))
|
2001-06-02 20:25:18 +02:00
|
|
|
|
2001-06-30 23:58:06 +02:00
|
|
|
ifdef XGETTEXT
|
2012-04-10 20:26:17 +02:00
|
|
|
XGETTEXT += -ctranslator --copyright-holder='PostgreSQL Global Development Group' --msgid-bugs-address=pgsql-bugs@postgresql.org --no-wrap --sort-by-file --package-name='$(CATALOG_NAME) (PostgreSQL)' --package-version='$(MAJORVERSION)'
|
2012-04-05 20:22:15 +02:00
|
|
|
endif
|
|
|
|
|
|
|
|
ifdef MSGMERGE
|
2012-12-14 05:12:12 +01:00
|
|
|
MSGMERGE += --no-wrap --previous --sort-by-file
|
2001-06-30 23:58:06 +02:00
|
|
|
endif
|
2001-06-02 20:25:18 +02:00
|
|
|
|
2011-06-26 22:05:30 +02:00
|
|
|
# _ is defined in c.h, so it's global
|
|
|
|
GETTEXT_TRIGGERS += _
|
2011-06-26 23:13:10 +02:00
|
|
|
GETTEXT_FLAGS += _:1:pass-c-format
|
2011-06-26 22:05:30 +02:00
|
|
|
|
2001-06-02 20:25:18 +02:00
|
|
|
|
2011-06-26 22:50:21 +02:00
|
|
|
# common settings that apply to backend and all backend modules
|
|
|
|
BACKEND_COMMON_GETTEXT_TRIGGERS = \
|
|
|
|
errmsg errmsg_plural:1,2 \
|
|
|
|
errdetail errdetail_log errdetail_plural:1,2 \
|
|
|
|
errhint \
|
Setup error context callback for transaction lock waits
With this in place, a session blocking behind another one because of
tuple locks will get a context line mentioning the relation name, tuple
TID, and operation being done on tuple. For example:
LOG: process 11367 still waiting for ShareLock on transaction 717 after 1000.108 ms
DETAIL: Process holding the lock: 11366. Wait queue: 11367.
CONTEXT: while updating tuple (0,2) in relation "foo"
STATEMENT: UPDATE foo SET value = 3;
Most usefully, the new line is displayed by log entries due to
log_lock_waits, although of course it will be printed by any other log
message as well.
Author: Christian Kruse, some tweaks by Álvaro Herrera
Reviewed-by: Amit Kapila, Andres Freund, Tom Lane, Robert Haas
2014-03-19 19:10:36 +01:00
|
|
|
errcontext \
|
|
|
|
XactLockTableWait:4 \
|
|
|
|
MultiXactIdWait:6 \
|
|
|
|
ConditionalMultiXactIdWait:6
|
2011-06-26 23:13:10 +02:00
|
|
|
BACKEND_COMMON_GETTEXT_FLAGS = \
|
|
|
|
errmsg:1:c-format errmsg_plural:1:c-format errmsg_plural:2:c-format \
|
|
|
|
errdetail:1:c-format errdetail_log:1:c-format errdetail_plural:1:c-format errdetail_plural:2:c-format \
|
|
|
|
errhint:1:c-format \
|
|
|
|
errcontext:1:c-format
|
2011-06-26 22:50:21 +02:00
|
|
|
|
|
|
|
|
2001-06-02 20:25:18 +02:00
|
|
|
all-po: $(MO_FILES)
|
|
|
|
|
|
|
|
%.mo: %.po
|
2013-09-11 20:34:28 +02:00
|
|
|
$(MSGFMT) $(MSGFMT_FLAGS) -o $@ $<
|
2001-06-02 20:25:18 +02:00
|
|
|
|
|
|
|
ifeq ($(word 1,$(GETTEXT_FILES)),+)
|
2009-01-15 10:01:24 +01:00
|
|
|
po/$(CATALOG_NAME).pot: $(word 2, $(GETTEXT_FILES)) $(MAKEFILE_LIST)
|
2010-10-14 21:15:46 +02:00
|
|
|
ifdef XGETTEXT
|
2016-06-08 00:55:18 +02:00
|
|
|
$(XGETTEXT) -D $(srcdir) -D . -n $(addprefix -k, $(GETTEXT_TRIGGERS)) $(addprefix --flag=, $(GETTEXT_FLAGS)) -f $<
|
2001-06-02 20:25:18 +02:00
|
|
|
else
|
2010-10-14 21:15:46 +02:00
|
|
|
@echo "You don't have 'xgettext'."; exit 1
|
|
|
|
endif
|
|
|
|
else # GETTEXT_FILES
|
2009-01-15 10:01:24 +01:00
|
|
|
po/$(CATALOG_NAME).pot: $(GETTEXT_FILES) $(MAKEFILE_LIST)
|
2001-07-15 13:43:55 +02:00
|
|
|
# Change to srcdir explicitly, don't rely on $^. That way we get
|
|
|
|
# consistent #: file references in the po files.
|
2010-10-14 21:15:46 +02:00
|
|
|
ifdef XGETTEXT
|
2016-06-08 00:55:18 +02:00
|
|
|
$(XGETTEXT) -D $(srcdir) -D . -n $(addprefix -k, $(GETTEXT_TRIGGERS)) $(addprefix --flag=, $(GETTEXT_FLAGS)) $(GETTEXT_FILES)
|
2010-10-14 21:15:46 +02:00
|
|
|
else
|
|
|
|
@echo "You don't have 'xgettext'."; exit 1
|
2001-06-02 20:25:18 +02:00
|
|
|
endif
|
2010-10-14 21:15:46 +02:00
|
|
|
endif # GETTEXT_FILES
|
2009-08-27 00:24:44 +02:00
|
|
|
@$(MKDIR_P) $(dir $@)
|
2009-01-02 16:15:42 +01:00
|
|
|
sed -e '1,18 { s/SOME DESCRIPTIVE TITLE./LANGUAGE message translation file for $(CATALOG_NAME)/;s/PACKAGE/PostgreSQL/g;s/VERSION/$(MAJORVERSION)/g;s/YEAR/'`date +%Y`'/g; }' messages.po >$@
|
|
|
|
rm messages.po
|
2001-06-02 20:25:18 +02:00
|
|
|
|
|
|
|
|
2012-04-24 04:43:09 +02:00
|
|
|
# catalog name extensions must match behavior of PG_TEXTDOMAIN() in c.h
|
2001-06-02 20:25:18 +02:00
|
|
|
install-po: all-po installdirs-po
|
2002-09-03 00:19:42 +02:00
|
|
|
ifneq (,$(LANGUAGES))
|
2001-06-02 20:25:18 +02:00
|
|
|
for lang in $(LANGUAGES); do \
|
2008-12-11 08:34:09 +01:00
|
|
|
$(INSTALL_DATA) po/$$lang.mo '$(DESTDIR)$(localedir)'/$$lang/LC_MESSAGES/$(CATALOG_NAME)$(SO_MAJOR_VERSION)-$(MAJORVERSION).mo || exit 1; \
|
2001-06-02 20:25:18 +02:00
|
|
|
done
|
2002-09-03 00:19:42 +02:00
|
|
|
endif
|
2001-06-02 20:25:18 +02:00
|
|
|
|
|
|
|
installdirs-po:
|
2010-05-13 16:35:28 +02:00
|
|
|
$(if $(LANGUAGES),$(MKDIR_P) $(foreach lang, $(LANGUAGES), '$(DESTDIR)$(localedir)'/$(lang)/LC_MESSAGES),:)
|
2001-06-02 20:25:18 +02:00
|
|
|
|
|
|
|
uninstall-po:
|
2010-05-13 16:35:28 +02:00
|
|
|
$(if $(LANGUAGES),rm -f $(foreach lang, $(LANGUAGES), '$(DESTDIR)$(localedir)'/$(lang)/LC_MESSAGES/$(CATALOG_NAME)$(SO_MAJOR_VERSION)-$(MAJORVERSION).mo),:)
|
2001-06-02 20:25:18 +02:00
|
|
|
|
|
|
|
|
|
|
|
clean-po:
|
2008-05-17 22:24:05 +02:00
|
|
|
$(if $(MO_FILES),rm -f $(MO_FILES))
|
2009-01-09 11:54:08 +01:00
|
|
|
@$(if $(wildcard po/*.po.new),rm -f po/*.po.new)
|
2003-09-15 00:40:38 +02:00
|
|
|
rm -f po/$(CATALOG_NAME).pot
|
2001-06-02 20:25:18 +02:00
|
|
|
|
|
|
|
|
2003-09-15 00:40:38 +02:00
|
|
|
init-po: po/$(CATALOG_NAME).pot
|
2001-06-02 20:25:18 +02:00
|
|
|
|
|
|
|
|
2009-01-09 11:54:08 +01:00
|
|
|
# For performance reasons, only calculate these when the user actually
|
|
|
|
# requested update-po or a specific file.
|
|
|
|
ifneq (,$(filter update-po %.po.new,$(MAKECMDGOALS)))
|
2011-12-27 19:22:51 +01:00
|
|
|
ALL_LANGUAGES := $(shell find $(top_srcdir) -name '*.po' -print | sed 's,^.*/\([^/]*\).po$$,\1,' | LC_ALL=C sort -u)
|
|
|
|
all_compendia := $(shell find $(top_srcdir) -name '*.po' -print | LC_ALL=C sort)
|
2001-06-02 20:25:18 +02:00
|
|
|
else
|
2009-01-09 11:54:08 +01:00
|
|
|
ALL_LANGUAGES = $(AVAIL_LANGUAGES)
|
|
|
|
all_compendia = FORCE
|
|
|
|
FORCE:
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifdef WANTED_LANGUAGES
|
|
|
|
ALL_LANGUAGES := $(filter $(WANTED_LANGUAGES), $(ALL_LANGUAGES))
|
2001-06-02 20:25:18 +02:00
|
|
|
endif
|
|
|
|
|
2009-01-09 11:54:08 +01:00
|
|
|
update-po: $(ALL_LANGUAGES:%=po/%.po.new)
|
|
|
|
|
|
|
|
$(AVAIL_LANGUAGES:%=po/%.po.new): po/%.po.new: po/%.po po/$(CATALOG_NAME).pot $(all_compendia)
|
2012-04-02 01:58:37 +02:00
|
|
|
$(MSGMERGE) --lang=$* $(word 1, $^) $(word 2,$^) -o $@ $(addprefix --compendium=,$(filter %/$*.po,$(wordlist 3,$(words $^),$^)))
|
2009-01-09 11:54:08 +01:00
|
|
|
|
2009-01-20 10:58:50 +01:00
|
|
|
# For languages not yet available, merge against oneself, to pick
|
|
|
|
# up translations from the compendia. (Merging against /dev/null
|
|
|
|
# doesn't work so well; it inserts the headers from the first-named
|
|
|
|
# compendium.)
|
2009-01-09 11:54:08 +01:00
|
|
|
po/%.po.new: po/$(CATALOG_NAME).pot $(all_compendia)
|
2012-04-02 01:58:37 +02:00
|
|
|
$(MSGMERGE) --lang=$* $(word 1,$^) $(word 1,$^) -o $@ $(addprefix --compendium=,$(filter %/$*.po,$(wordlist 2,$(words $^),$^)))
|
2009-01-09 11:54:08 +01:00
|
|
|
|
2001-06-02 20:25:18 +02:00
|
|
|
|
|
|
|
all: all-po
|
|
|
|
install: install-po
|
|
|
|
installdirs: installdirs-po
|
|
|
|
uninstall: uninstall-po
|
2003-09-15 00:40:38 +02:00
|
|
|
clean distclean maintainer-clean: clean-po
|
2001-06-02 20:25:18 +02:00
|
|
|
|
|
|
|
.PHONY: all-po install-po installdirs-po uninstall-po clean-po \
|
2013-09-11 20:34:28 +02:00
|
|
|
init-po update-po
|