[beast] PO: added merge-po FILE=*.po rule to easily merge transifex po files
- From: Tim Janik <timj src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [beast] PO: added merge-po FILE=*.po rule to easily merge transifex po files
- Date: Fri, 17 Sep 2010 01:57:16 +0000 (UTC)
commit 0f5976efe807ac4eaa16b9f985e0b6c633b4b7a9
Author: Tim Janik <timj gtk org>
Date: Fri Sep 17 03:37:12 2010 +0200
PO: added merge-po FILE=*.po rule to easily merge transifex po files
po/Makefile.am | 31 +++++++++++++++++++++++++++++++
1 files changed, 31 insertions(+), 0 deletions(-)
---
diff --git a/po/Makefile.am b/po/Makefile.am
index 80027a9..36eca29 100644
--- a/po/Makefile.am
+++ b/po/Makefile.am
@@ -129,6 +129,37 @@ CHECK_SCM_PATS=$(strip \
library/scripts/song-parts-operations.scm \
)
+shdie = { echo "ERROR:" $(1) >&2 ; exit $(or $(2), 127) ; }
+
+merge-po: $(srcdir)/messages.pot # FILE=...
+ @test -r "$(FILE)" || $(call shdie, "$@: source argument required: make $@ FILE=...")
+ @echo "Merging external po file: $(FILE)..."
+ @r=`realpath "$(FILE)"` ; for f in $(POFILES) ; do \
+ test "`realpath $$f`" != "$$r" || \
+ $(call shdie, "$@: FILE already exists in POFILES: $$r"); \
+ done
+ @c= ; : "# find POFILE candidate for merging FILE";\
+ p=`basename "$(FILE)" .po`; test -n "$$c" || \
+ for f in $(POFILES) ; do \
+ test "`basename $$f .po`" == "$$p" && \
+ { c="$$f" ; r="(basenames match)"; break ; } ; done ; \
+ p=`sed -n -e '/^"Language-Team:/p; 45q' < "$(FILE)"`; test -n "$$c" || \
+ for f in $(POFILES) ; do \
+ fp=`sed -n -e '/^"Language-Team:/p; 45q' < "$$f"`; \
+ test -n "$$p" -a "$$p" == "$$fp" && \
+ { c="$$f" ; r="(Language-Team fields match)"; break ; } ; done ; \
+ p=`sed -n -e '/^"Language:/p; 45q' < "$(FILE)"`; test -n "$$c" || \
+ for f in $(POFILES) ; do \
+ fp=`sed -n -e '/^"Language:/p; 45q' < "$$f"`; \
+ test -n "$$p" -a "$$p" == "$$fp" && \
+ { c="$$f" ; r="(Language fields match)"; break ; } ; done ; \
+ if test -z "$$c" ; then \
+ $(call shdie, "$@: failed to find po merging candidate; try renaming FILE") ; \
+ else \
+ echo "Target for merging: $$c $$r" ; \
+ $(MSGMERGE) -s -C "$$c" -o "$$c" "$(FILE)" $(srcdir)/messages.pot || exit $? ; \
+ $(GMSGFMT) -o /dev/null --verbose "$$c" ; \
+ fi
# force regeneration of all po files
update-po: Makefile
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]