diff options
Diffstat (limited to 'makefiles/gmake/i18n.mk')
-rw-r--r-- | makefiles/gmake/i18n.mk | 88 |
1 files changed, 33 insertions, 55 deletions
diff --git a/makefiles/gmake/i18n.mk b/makefiles/gmake/i18n.mk index 660f62a..c5fa314 100644 --- a/makefiles/gmake/i18n.mk +++ b/makefiles/gmake/i18n.mk @@ -11,7 +11,7 @@ # # provides: # - target: init-po -# - target: update-po +# - target: merge-po # - taget: check-po .PHONY: init-po update-po all_po clean_po install_po @@ -29,7 +29,35 @@ po/$(CATALOG_NAME).pot: $(GETTEXT_FILES) $(addprefix -k, $(GETTEXT_TRIGGERS)) --flag=_:1:pass-c-format \ -d $(CATALOG_NAME) -n -F $(GETTEXT_FILES) +ifneq "$(GETTEXT_FILES)" "" init-po: po/$(CATALOG_NAME).pot +else +init-po: +endif + +ifneq "$(GETTEXT_FILES)" "" +merge-po: po/$(CATALOG_NAME).pot + @test -z "$(GETTEXT_LANGUAGES)" || \ + for lang in $(GETTEXT_LANGUAGES)""; do ( \ + echo "merging po/$$lang.mo and $<.." && \ + if $(MSGMERGE) -F -o po/$$lang.po.new po/$$lang.po $<; then \ + cp po/$$lang.po po/$$lang.po.bak && \ + mv po/$$lang.po.new po/$$lang.po; \ + else \ + echo "Please check, msgmerge for po/$$lang.po failed!"; \ + rm -f po/$$lang.po.new; \ + fi \ + ) done +else +merge-po: +endif + +check-po: $(PO_FILES) + @test -z "$^" || \ + for file in $^""; do ( \ + echo "checking gettext file $$file of catalog $(CATALOG_NAME).." && \ + $(MSGFMT) -c -v -o /dev/null $$file || exit 1 \ + ) done clean_po: @-rm -f $(MO_FILES) @@ -47,64 +75,14 @@ install_po: $(INSTALL) -m 644 po/$$lang.mo $(localedir)/$$lang/LC_MESSAGES/$(CATALOG_NAME).mo || exit 1 \ ) done -# TODO: sort out below - -# merge the changes into the translation tables keeping existing -# translations -# msgmerge -s -U test_gettext_de_CH.po test_gettext.pot -# -# compile message files into binary format: -# msgfmt -c -v -o test_gettext_de.mo test_gettext_de.po - -#test_gettext_de.po: test_gettext.pot -# msgmerge -s -U $@ -i $< -# touch $@ - -#test_gettext_de_CH.po: test_gettext.pot -# msgmerge -s -U $@ -i $< -# touch $@ - -# TODO: big cleanup for GCC compilation flags -# in older gcc (before 4.2.1) we can't switch off warnings selectivly with a -# prage. So gettext misses a format attribute which results in a warning -# test_gettext.c:81: warning: format not a string literal, argument types not checked -# (Solaris 8, NetBSD) -# on Solaris 10 we get a system header conflict if we don't specify -std=c99 -#test_gettext.o : test_gettext.c -# $(CC) -c -g -o $@ $(PLATFORM_COMPILE_FLAGS) $(INCLUDE_DIRS) $< - -# LANG setting differs from platform to platform a little bit :-( -#ifeq "$(PLATFORM)" "LINUX" -#TEST_LANG = de_CH -#endif -#ifeq "$(PLATFORM)" "FREEBSD" -#TEST_LANG = de_CH.ISO8859-1 -#endif -#ifeq "$(PLATFORM)" "OPENBSD" -#TEST_LANG = de_CH.ISO8859-1 -#endif -#ifeq "$(PLATFORM)" "SUNOS" -#TEST_LANG = de_CH.iso_8859_1 -#endif -#ifeq "$(PLATFORM)" "CYGWIN" -#TEST_LANG = de -#endif -#ifeq "$(PLATFORM)" "NETBSD" -#TEST_LANG = de -#endif - -#local_test: test_gettext_de.mo test_gettext_de_CH.mo -# @echo "Testing gettext.." -# @mkdir -p locale/de_CH/LC_MESSAGES -# @mkdir -p locale/de/LC_MESSAGES -# @cp test_gettext_de.mo locale/de_CH/LC_MESSAGES/test_gettext.mo -# @cp test_gettext_de.mo locale/de/LC_MESSAGES/test_gettext.mo -# @LANG=$(TEST_LANG) ./test_gettext >/dev/null 2>&1 - else # No NLS supported wanted, provide dummy targets +init-po: +merge-po: +check-po: + all_po: clean_po: install_po: |