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:
|
|
|
|
#
|
2004-06-01 05:32:42 +02:00
|
|
|
# CATALOG_NAME -- name of the message catalog (xxx.po); probably
|
|
|
|
# name of the program
|
2001-06-02 20:25:18 +02:00
|
|
|
# AVAIL_LANGUAGES -- list of languages that are provided/supported
|
2004-06-01 05:32:42 +02:00
|
|
|
# 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
|
|
|
|
#
|
|
|
|
# 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)))
|
|
|
|
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
|
2009-01-02 16:15:42 +01:00
|
|
|
XGETTEXT += -ctranslator --copyright-holder='PostgreSQL Global Development Group' --msgid-bugs-address=pgsql-bugs@postgresql.org
|
2001-06-30 23:58:06 +02:00
|
|
|
endif
|
2001-06-02 20:25:18 +02:00
|
|
|
|
|
|
|
|
|
|
|
all-po: $(MO_FILES)
|
|
|
|
|
|
|
|
%.mo: %.po
|
|
|
|
$(MSGFMT) -o $@ $<
|
|
|
|
|
|
|
|
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
|
2001-06-30 23:58:06 +02:00
|
|
|
$(XGETTEXT) -D $(srcdir) -n $(addprefix -k, $(GETTEXT_TRIGGERS)) -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
|
2001-07-15 13:43:55 +02:00
|
|
|
$(XGETTEXT) -D $(srcdir) -n $(addprefix -k, $(GETTEXT_TRIGGERS)) $(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
|
|
|
|
|
|
|
|
2008-12-11 08:34:09 +01:00
|
|
|
# catalog name extentions 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
|
|
|
|
|
|
|
|
|
|
|
maintainer-check-po: $(PO_FILES)
|
|
|
|
for file in $^; do \
|
2001-07-15 13:43:55 +02:00
|
|
|
$(MSGFMT) -c -v -o /dev/null $$file || exit 1; \
|
2001-06-02 20:25:18 +02:00
|
|
|
done
|
|
|
|
|
|
|
|
|
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)))
|
2009-01-09 13:37:37 +01:00
|
|
|
ALL_LANGUAGES := $(shell find $(top_srcdir) -name '*.po' -print | sed 's,^.*/\([^/]*\).po$$,\1,' | sort -u)
|
|
|
|
all_compendia := $(shell find $(top_srcdir) -name '*.po' -print)
|
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)
|
|
|
|
$(MSGMERGE) $(word 1, $^) $(word 2,$^) -o $@ $(addprefix --compendium=,$(filter %/$*.po,$(wordlist 3,$(words $^),$^)))
|
|
|
|
|
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)
|
2009-01-20 10:58:50 +01:00
|
|
|
$(MSGMERGE) $(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
|
|
|
maintainer-check: maintainer-check-po
|
|
|
|
|
|
|
|
.PHONY: all-po install-po installdirs-po uninstall-po clean-po \
|
2003-09-15 00:40:38 +02:00
|
|
|
maintainer-check-po init-po update-po
|