changeset 2121:bd4370badbf7

Improve Makefile target `makemessages` * Change code to only run msginit, if the file is not there. This avoids losing data if msgmerge fails because of a temorarily bad .po file. Rewrite the used shell code using `if` instead of using more implicit `||` and `&&` operator to make it more readable. * Make the operation stop if one of the commands in the makemessages loop fails, so that errors are propagated up to the build process and can be noticed. Given to upstream at https://github.com/Polyconseil/vue-gettext/issues/84 .
author Bernhard Reiter <bernhard@intevation.de>
date Tue, 05 Feb 2019 13:34:29 +0100
parents 817cd8b89a86
children 2cec685c6519
files client/Makefile
diffstat 1 files changed, 7 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/client/Makefile	Tue Feb 05 12:27:40 2019 +0100
+++ b/client/Makefile	Tue Feb 05 13:34:29 2019 +0100
@@ -52,10 +52,14 @@
 # Generate .po files for each available language.
 	@for lang in $(LOCALES); do \
 		export PO_FILE=$(OUTPUT_DIR)/locale/$$lang/LC_MESSAGES/app.po; \
-		echo "msgmerge --update $$PO_FILE $@"; \
 		mkdir -p $$(dirname $$PO_FILE); \
-		[ -f $$PO_FILE ] && msgmerge --lang=$$lang --update $$PO_FILE $@ || msginit --no-translator --locale=$$lang --input=$@ --output-file=$$PO_FILE; \
-		msgattrib --no-wrap --no-obsolete -o $$PO_FILE $$PO_FILE; \
+		if [ -f $$PO_FILE ]; then  \
+			echo "msgmerge --update $$PO_FILE $@"; \
+			msgmerge --lang=$$lang --update $$PO_FILE $@ || break ;\
+		else \
+			msginit --no-translator --locale=$$lang --input=$@ --output-file=$$PO_FILE || break ; \
+			msgattrib --no-wrap --no-obsolete -o $$PO_FILE $$PO_FILE || break; \
+		fi; \
 	done;
 
 $(OUTPUT_DIR)/locale/translations.json: $(LOCALE_FILES)