📄 nls-global.mk
字号:
# $PostgreSQL: pgsql/src/nls-global.mk,v 1.12 2006/04/05 13:40:15 petere Exp $# 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:## 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# 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 hereinclude $(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_LANGUAGESLANGUAGES = $(filter $(WANTED_LANGUAGES), $(AVAIL_LANGUAGES))elseLANGUAGES = $(AVAIL_LANGUAGES)endifPO_FILES = $(addprefix po/, $(addsuffix .po, $(LANGUAGES)))MO_FILES = $(addprefix po/, $(addsuffix .mo, $(LANGUAGES)))ifdef XGETTEXTXGETTEXT += --foreign-user -ctranslatorendifall-po: $(MO_FILES)%.mo: %.po $(MSGFMT) -o $@ $<ifdef XGETTEXTifeq ($(word 1,$(GETTEXT_FILES)),+)po/$(CATALOG_NAME).pot: $(word 2, $(GETTEXT_FILES)) $(XGETTEXT) -D $(srcdir) -n $(addprefix -k, $(GETTEXT_TRIGGERS)) -f $<elsepo/$(CATALOG_NAME).pot: $(GETTEXT_FILES)# Change to srcdir explicitly, don't rely on $^. That way we get# consistent #: file references in the po files. $(XGETTEXT) -D $(srcdir) -n $(addprefix -k, $(GETTEXT_TRIGGERS)) $(GETTEXT_FILES)endif @$(mkinstalldirs) $(dir $@) mv messages.po $@else # not XGETTEXT @echo "You don't have 'xgettext'."; exit 1endif # not XGETTEXTinstall-po: all-po installdirs-poifneq (,$(LANGUAGES)) for lang in $(LANGUAGES); do \ $(INSTALL_DATA) po/$$lang.mo '$(DESTDIR)$(localedir)'/$$lang/LC_MESSAGES/$(CATALOG_NAME).mo || exit 1; \ doneendifinstalldirs-po: $(mkinstalldirs) $(foreach lang, $(LANGUAGES), '$(DESTDIR)$(localedir)'/$(lang)/LC_MESSAGES)uninstall-po: rm -f $(foreach lang, $(LANGUAGES), '$(DESTDIR)$(localedir)'/$(lang)/LC_MESSAGES/$(CATALOG_NAME).mo)clean-po: rm -f $(MO_FILES) @rm -f $(addsuffix .old, $(PO_FILES)) rm -f po/$(CATALOG_NAME).potmaintainer-check-po: $(PO_FILES) for file in $^; do \ $(MSGFMT) -c -v -o /dev/null $$file || exit 1; \ doneinit-po: po/$(CATALOG_NAME).potdefine merge-lang@printf 'merging $(1) '@if $(MSGMERGE) $(srcdir)/po/$(1).po $< -o po/$(1).po.new $(addprefix --compendium=,$(shell find $(top_srcdir) -name $(1).po -printf '%p ')); \then \ mv $(srcdir)/po/$(1).po po/$(1).po.old; \ mv po/$(1).po.new $(srcdir)/po/$(1).po; \else \ echo "msgmerge for $(1) failed"; \ rm -f po/$(1).po.new; \fiendefupdate-po: po/$(CATALOG_NAME).potifdef MSGMERGE $(foreach lang,$(LANGUAGES),$(call merge-lang,$(lang)))else @echo "You don't have 'msgmerge'." ; exit 1endifall: all-poinstall: install-poinstalldirs: installdirs-pouninstall: uninstall-poclean distclean maintainer-clean: clean-pomaintainer-check: maintainer-check-po.PHONY: all-po install-po installdirs-po uninstall-po clean-po \ maintainer-check-po init-po update-po.SILENT: installdirs-po
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -