mirror of
https://github.com/postgres/postgres.git
synced 2025-04-24 10:47:04 +03:00
Rewrite update-po target, so that it works less like a shell script and more
like a makefile with real dependencies. Instead of overwriting the old po file, write the new one to .po.new. This is less annoying and integrates better with the NLS web site. Also, we can now merge languages that don't have a po file yet, by merging against all other po files of that language, to pick up recurring translations automatically. This previously only worked when a po file already existed.
This commit is contained in:
parent
1b4e729eaa
commit
26dc14b6b2
@ -1,4 +1,4 @@
|
|||||||
<!-- $PostgreSQL: pgsql/doc/src/sgml/nls.sgml,v 1.16 2007/02/01 00:28:17 momjian Exp $ -->
|
<!-- $PostgreSQL: pgsql/doc/src/sgml/nls.sgml,v 1.17 2009/01/09 10:54:07 petere Exp $ -->
|
||||||
|
|
||||||
<chapter id="nls">
|
<chapter id="nls">
|
||||||
<chapterinfo>
|
<chapterinfo>
|
||||||
@ -200,9 +200,8 @@ gmake update-po
|
|||||||
which will create a new blank message catalog file (the pot file
|
which will create a new blank message catalog file (the pot file
|
||||||
you started with) and will merge it with the existing PO files.
|
you started with) and will merge it with the existing PO files.
|
||||||
If the merge algorithm is not sure about a particular message it
|
If the merge algorithm is not sure about a particular message it
|
||||||
marks it <quote>fuzzy</quote> as explained above. For the case
|
marks it <quote>fuzzy</quote> as explained above. The new PO file
|
||||||
where something went really wrong, the old PO file is saved with a
|
is saved with a <filename>.po.new</filename> extension.
|
||||||
<filename>.po.old</filename> extension.
|
|
||||||
</para>
|
</para>
|
||||||
</sect2>
|
</sect2>
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
# $PostgreSQL: pgsql/src/nls-global.mk,v 1.16 2009/01/02 15:15:42 petere Exp $
|
# $PostgreSQL: pgsql/src/nls-global.mk,v 1.17 2009/01/09 10:54:08 petere Exp $
|
||||||
|
|
||||||
# Common rules for Native Language Support (NLS)
|
# Common rules for Native Language Support (NLS)
|
||||||
#
|
#
|
||||||
@ -80,7 +80,7 @@ uninstall-po:
|
|||||||
|
|
||||||
clean-po:
|
clean-po:
|
||||||
$(if $(MO_FILES),rm -f $(MO_FILES))
|
$(if $(MO_FILES),rm -f $(MO_FILES))
|
||||||
@$(if $(PO_FILES),rm -f $(addsuffix .old, $(PO_FILES)))
|
@$(if $(wildcard po/*.po.new),rm -f po/*.po.new)
|
||||||
rm -f po/$(CATALOG_NAME).pot
|
rm -f po/$(CATALOG_NAME).pot
|
||||||
|
|
||||||
|
|
||||||
@ -93,26 +93,31 @@ maintainer-check-po: $(PO_FILES)
|
|||||||
init-po: po/$(CATALOG_NAME).pot
|
init-po: po/$(CATALOG_NAME).pot
|
||||||
|
|
||||||
|
|
||||||
define merge-lang
|
# For performance reasons, only calculate these when the user actually
|
||||||
@printf 'merging $(1) '
|
# requested update-po or a specific file.
|
||||||
@if $(MSGMERGE) $(srcdir)/po/$(1).po $< -o po/$(1).po.new $(addprefix --compendium=,$(shell find $(top_srcdir) -name $(1).po -printf '%p ')); \
|
ifneq (,$(filter update-po %.po.new,$(MAKECMDGOALS)))
|
||||||
then \
|
ALL_LANGUAGES := $(shell find $(top_srcdir) -name '*.po' -printf '%f\n' | sort -u | sed 's/\.po$$//')
|
||||||
mv $(srcdir)/po/$(1).po po/$(1).po.old; \
|
all_compendia := $(shell find $(top_srcdir) -name '*.po' -printf '%p ')
|
||||||
mv po/$(1).po.new $(srcdir)/po/$(1).po; \
|
|
||||||
else \
|
|
||||||
echo "msgmerge for $(1) failed"; \
|
|
||||||
rm -f po/$(1).po.new; \
|
|
||||||
fi
|
|
||||||
|
|
||||||
endef
|
|
||||||
|
|
||||||
update-po: po/$(CATALOG_NAME).pot
|
|
||||||
ifdef MSGMERGE
|
|
||||||
$(foreach lang,$(LANGUAGES),$(call merge-lang,$(lang)))
|
|
||||||
else
|
else
|
||||||
@echo "You don't have 'msgmerge'." ; exit 1
|
ALL_LANGUAGES = $(AVAIL_LANGUAGES)
|
||||||
|
all_compendia = FORCE
|
||||||
|
FORCE:
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifdef WANTED_LANGUAGES
|
||||||
|
ALL_LANGUAGES := $(filter $(WANTED_LANGUAGES), $(ALL_LANGUAGES))
|
||||||
|
endif
|
||||||
|
|
||||||
|
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 $^),$^)))
|
||||||
|
|
||||||
|
# For languages not yet available, merge against empty file, to pick
|
||||||
|
# up translations from the compendia.
|
||||||
|
po/%.po.new: po/$(CATALOG_NAME).pot $(all_compendia)
|
||||||
|
$(MSGMERGE) /dev/null $(word 1,$^) -o $@ $(addprefix --compendium=,$(filter %/$*.po,$(wordlist 2,$(words $^),$^)))
|
||||||
|
|
||||||
|
|
||||||
all: all-po
|
all: all-po
|
||||||
install: install-po
|
install: install-po
|
||||||
|
Loading…
x
Reference in New Issue
Block a user